mirror of
https://github.com/nsacyber/HIRS.git
synced 2024-12-20 13:33:13 +00:00
2ab1e548ce
* Look for Component Class json on Windows. Update aca-windows * Removed TPM from the ACA on Rocky image, changed container detection * Change healthcheck function on windows. * Remove commented code lines from aca_bootRun.ps1 * Added SWTPM to v3 ACA images. * Add build arg to the aca-windows Dockerfile to select base image tag * Make ACA accessible from localhost
81 lines
2.4 KiB
PowerShell
81 lines
2.4 KiB
PowerShell
param (
|
|
[string]$p, [string]$path = $null,
|
|
[switch]$w, [switch]$war = $false,
|
|
[switch]$h, [switch]$help = $false
|
|
)
|
|
|
|
$APP_HOME=(Split-Path -parent $PSCommandPath)
|
|
$ACA_COMMON_SCRIPT=(Join-Path $APP_HOME 'aca_common.ps1')
|
|
$ALG="RSA" # or "ECC"
|
|
$GRADLE_WRAPPER='./gradlew'
|
|
$DEPLOYED_WAR=$null
|
|
|
|
# Load other scripts
|
|
. $ACA_COMMON_SCRIPT
|
|
|
|
# Set up log
|
|
set_up_log
|
|
|
|
# Read aca.properties
|
|
read_aca_properties $global:HIRS_DATA_ACA_PROPERTIES_FILE
|
|
|
|
# Read spring application.properties
|
|
read_spring_properties $global:HIRS_DATA_SPRING_PROP_FILE
|
|
|
|
echo "-----------------------------------------------------------" | WriteAndLog
|
|
echo ("Running with these arguments: "+($PSBoundParameters | Out-String)) | WriteAndLog
|
|
|
|
# Parameter Consolidation
|
|
if ($p -and $path -and ($p -ne $path)) {
|
|
"-p and --path were given different paths. Use only one." | WriteAndLog
|
|
$help=$true
|
|
}
|
|
if ($p) {
|
|
$path = $p
|
|
}
|
|
$war = $w -or $war
|
|
$help = $h -or $help
|
|
|
|
if(!(New-Object Security.Principal.WindowsPrincipal(
|
|
[Security.Principal.WindowsIdentity]::GetCurrent())
|
|
).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
|
|
echo "This script requires root. Please run as root"
|
|
exit 1
|
|
}
|
|
|
|
if ($help) {
|
|
echo " Setup script for the HIRS ACA"
|
|
echo " Syntax: powershell -ExecutionPolicy Bypass aca_bootRun.ps1 [-h|p|w|--path|--war]"
|
|
echo " options:"
|
|
echo " -p | --path Path to the HIRS_AttestationCAPortal.war file"
|
|
echo " -w | --war Use deployed war file"
|
|
echo " -h | --help Print this help"
|
|
exit 1
|
|
}
|
|
|
|
if ($path) {
|
|
$DEPLOYED_WAR = $path
|
|
}
|
|
|
|
if (![System.IO.Directory]::Exists($global:HIRS_DATA_CERTIFICATES_HIRS_DIR)) {
|
|
echo "$global:HIRS_DATA_CERTIFICATES_HIRS_DIR directory does not exist. Please run aca_setup\.ps1 and try again."
|
|
exit 1;
|
|
}
|
|
|
|
if (!$DEPLOYED_WAR) {
|
|
if (![System.IO.File]::Exists($GRADLE_WRAPPER)) {
|
|
echo 'This script is expected to be run from the HIRS top level project directory. Exiting.'
|
|
exit 1;
|
|
}
|
|
$DEPLOYED_WAR='./HIRS_AttestationCAPortal/build/libs/HIRS_AttestationCAPortal.war'
|
|
}
|
|
|
|
$SPRING_PROP_FILE_FORWARDSLASHES=($global:HIRS_DATA_SPRING_PROP_FILE | ChangeBackslashToForwardSlash)
|
|
if ($w -or $war) {
|
|
echo "Booting the ACA from a war file..." | WriteAndLog
|
|
java -jar $DEPLOYED_WAR --spring.config.location=$SPRING_PROP_FILE_FORWARDSLASHES
|
|
} else {
|
|
echo "Booting the ACA from local build..." | WriteAndLog
|
|
./gradlew bootRun --args="--spring.config.location=$SPRING_PROP_FILE_FORWARDSLASHES"
|
|
}
|