added trust cert upload

This commit is contained in:
iadgovuser26 2023-12-15 15:37:11 -05:00
parent 29b83cdef7
commit 93c7cb5aeb
2 changed files with 35 additions and 6 deletions

View File

@ -43,7 +43,7 @@ wget https://raw.githubusercontent.com/nsacyber/HIRS/v3_issue_645/scripts/remove
Expand-Archive -Path oem_certs.zip
Write-Host "Downloading images (This can take a while)"
docker pull ghcr.io/nsacyber/hirs/aca:latest
docker pull ghcr.io/nsacyber/hirs/hat:alpha6
docker pull ghcr.io/nsacyber/hirs/hat:latest
Write-Host "Creating shortcut for starting the Acceptance Test (HAT start)"
# Create a shortcut to the start_hat.ps1 script
@ -53,6 +53,26 @@ $Shortcut.Targetpath = "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.ex
$Shortcut.Arguments = "-ExecutionPolicy bypass $Home\hirs\start_hat.ps1"
$Shortcut.Save()
# Warn Admin that device needs to be attached for the next step
Write-Host "Please attach ethernet cable to this device and target device for the next step . Hit Any Key to Continue"
$Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
# Start up the containers in a detached mode
docker compose -f $Home\hirs\compose-acceptance-test.yml up --detach
# Wait for ACA to start
Write-Host "Waiting for ACA to start up on local host port 8443 ..."
Start-Sleep -seconds 10
while ((Test-NetConnection -computername localhost -Port 8443 ).TcpTestSucceeded -eq $FALSE ) { Start-Sleep -seconds 5 }
Write-Host "ACA is up!"
# Upload all files in the upload folder
Write-Host "Uploading OEM Certificates Chains to the ACA..."
Get-ChildItem ".\oem_certs\upload\" |
foreach-Object {
$filename = $_.FullName
Write-Host "Uploading $filename"
curl.exe -k -F "file=@$filename" `
"https://127.0.0.1:8443/HIRS_AttestationCAPortal/portal/certificate-request/trust-chain/upload"
}
# Done
Write-Host "HIRS Acceptance Test Installation complete."
Write-Host "Use the Desktop Shortcut to start the ACA and hat servers."

View File

@ -11,8 +11,9 @@ if ($Service.Status -ne 'Running') {
} else {
Write-Host "Docker is running, continuing HAT removal..."
}
$CurrntDir = Split-Path -Path (Get-Location) -Leaf
if ($CurrentDir -ne 'hirs') {
$CurrentDir = Split-Path -Path (Get-Location) -Leaf
if ($CurrentDir -eq 'hirs') {
Write-Host "Please run this script from the hirs directory"
Write-Host "Exiting without removing the HAT. Hit Any Key to exit"
$Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
@ -26,15 +27,23 @@ netsh advfirewall firewall delete rule name="ACA HTTPS"
$IsAcaRunning = docker container inspect -f '{{.State.Running}}' aca 2>&1 | out-null
$IsHatRunning = docker container inspect -f '{{.State.Running}}' hat 2>&1 | out-null
if ($IsHatRunning -eq $TRUE) {
if ($IsHatRunning -eq "true") {
Write-Host "Shutting down the HAT container"
docker stop hat
}
if ($IsAcaRunning -eq $TRUE) {
if ($IsAcaRunning -eq "true") {
Write-Host "Shutting down the ACA container"
docker stop aca
}
Write-Host "Removing HAT Containers"
docker stop aca
docker stop hat
docker rm aca
docker rm hat
Write-Host "Remove HAT docker network"
docker network rm hat_network
Write-Host "Removing HAT images"
@ -42,7 +51,7 @@ Write-Host "Removing HAT images"
#docker image rm ghcr.io/nsacyber/hirs/hat:alpha6
Write-Host "Removing local HAT folder and files"
cd ..
if (Test-Path -LiteralPath hirs) {
Remove-Item -LiteralPath hirs -Recurse
}