Added the hirs-aca service

This commit is contained in:
iadgovuser26 2024-03-18 12:32:30 -04:00 committed by chubtub
parent d12e74c2a8
commit b44232a1a4
7 changed files with 78 additions and 4 deletions

View File

@ -130,6 +130,7 @@ ospackage {
// Uninstall // Uninstall
preUninstall 'bash /opt/hirs/aca/scripts/aca/aca_remove_setup.sh' preUninstall 'bash /opt/hirs/aca/scripts/aca/aca_remove_setup.sh'
preUninstall 'bash /opt/hirs/aca/scripts/systemd/aca_disable_service.sh'
postUninstall 'if [ -d /etc/hirs ]; then rm -rf /etc/hirs; fi;' postUninstall 'if [ -d /etc/hirs ]; then rm -rf /etc/hirs; fi;'
buildRpm { buildRpm {
@ -147,9 +148,10 @@ ospackage {
postTrans 'firewall-cmd --add-port=8443/tcp --permanent' postTrans 'firewall-cmd --add-port=8443/tcp --permanent'
postTrans 'firewall-cmd --reload' postTrans 'firewall-cmd --reload'
postTrans 'bash /opt/hirs/aca/scripts/aca/aca_setup.sh -u' postTrans 'bash /opt/hirs/aca/scripts/aca/aca_setup.sh -u'
postTrans 'bash /opt/hirs/aca/scripts/aca/aca_bootRun.sh -w &' postTrans 'bash /opt/hirs/aca/scripts/systemd/aca_enable_service.sh'
// postTrans 'bash /opt/hirs/aca/scripts/aca/aca_bootRun.sh -w &'
// add chrontab to run ACA at boot // add chrontab to run ACA at boot
postTrans 'echo "@reboot root /opt/hirs/aca/scripts/aca/aca_bootRun.sh -w" >> /etc/crontab' //postTrans 'echo "@reboot root /opt/hirs/aca/scripts/aca/aca_bootRun.sh -w" >> /etc/crontab'
postTrans 'chmod +x /opt/hirs/aca/scripts/aca/*' postTrans 'chmod +x /opt/hirs/aca/scripts/aca/*'
postTrans 'if [ -f /opt/hirs/aca/VERSION ]; then rm /opt/hirs/aca/VERSION; fi;' postTrans 'if [ -f /opt/hirs/aca/VERSION ]; then rm /opt/hirs/aca/VERSION; fi;'
// Wait for ACA to start up before finishing the install // Wait for ACA to start up before finishing the install
@ -166,7 +168,8 @@ ospackage {
requires('curl') requires('curl')
// Install after required packages // Install after required packages
postInstall 'bash /opt/hirs/aca/scripts/aca/aca_setup.sh -u' postInstall 'bash /opt/hirs/aca/scripts/aca/aca_setup.sh -u'
postInstall '/opt/hirs/aca/scripts/aca/aca_bootRun.sh -w &' //postInstall '/opt/hirs/aca/scripts/aca/aca_bootRun.sh -w &'
postInstall 'bash /opt/hirs/aca/scripts/systemd/aca_enable_service.sh'
postInstall 'echo "@reboot root /opt/hirs/aca/scripts/aca/aca_bootRun.sh -w" >> /etc/crontab' postInstall 'echo "@reboot root /opt/hirs/aca/scripts/aca/aca_bootRun.sh -w" >> /etc/crontab'
postInstall 'chmod +x /opt/hirs/aca/scripts/aca/*' postInstall 'chmod +x /opt/hirs/aca/scripts/aca/*'
postInstall 'if [ -f /opt/hirs/aca/VERSION ]; then rm /opt/hirs/aca/VERSION; fi;' postInstall 'if [ -f /opt/hirs/aca/VERSION ]; then rm /opt/hirs/aca/VERSION; fi;'

View File

@ -132,5 +132,6 @@ if [ -z "$USE_WAR" ]; then
else else
echo "Booting the ACA from a war file..." echo "Booting the ACA from a war file..."
# java -jar $WAR_PATH $CONNECTOR_PARAMS$WEB_TLS_PARAMS & # java -jar $WAR_PATH $CONNECTOR_PARAMS$WEB_TLS_PARAMS &
java -jar $WAR_PATH --spring.config.location=$SPRING_PROP_FILE & disown -h java -jar $WAR_PATH --spring.config.location=$SPRING_PROP_FILE &
exit 0
fi fi

View File

@ -0,0 +1,9 @@
#!/bin/bash
#####################################################################################
#
# Script to stop the ACA when running
#
#####################################################################################
kill -15 $(pgrep -f HIRS_AttestationCAPortal)

View File

@ -11,9 +11,11 @@ SQL_SERVICE="mariadb"
# -p to print status # -p to print status
check_systemd () { check_systemd () {
DB_SERVICE=false DB_SERVICE=false
SYSD_SERVICE=false
PRINT_STATUS=$1 PRINT_STATUS=$1
# Check if systemctl is present (not present in a Docker container) # Check if systemctl is present (not present in a Docker container)
if [[ $(ps --no-headers -o comm 1) == "systemd" ]]; then if [[ $(ps --no-headers -o comm 1) == "systemd" ]]; then
SYSD_SERVICE=true
systemctl is-active --quiet mariadb systemctl is-active --quiet mariadb
if [[ $? -eq 0 ]]; then if [[ $? -eq 0 ]]; then
DB_SERVICE=true DB_SERVICE=true

View File

@ -0,0 +1,19 @@
#!/bin/bash
#####################################################################################
#
# Script to remove the ACA service when running as a service if not running in a container
#
#####################################################################################
SCRIPT_DIR=$( dirname -- "$( readlink -f -- "$0"; )"; )
pushd $SCRIPT_DIR > /dev/null
source ../db/mysql_util.sh
check_systemd
if [ $SYSD_SERVICE = true ]; then
systemctl stop hirs-aca
systemctl disable hirs-aca.service
systemctl reset-failed hirs-aca
fi
popd > /dev/null

View File

@ -0,0 +1,22 @@
#!/bin/bash
#####################################################################################
#
# Script to add the ACA service when running as a service if not running in a container
#
#####################################################################################
SCRIPT_DIR=$( dirname -- "$( readlink -f -- "$0"; )"; )
pushd $SCRIPT_DIR > /dev/nill
source ../db/mysql_util.sh
check_systemd
if [ $SYSD_SERVICE = true ]; then
echo "Starting the ACA as a service..."
systemctl enable /opt/hirs/aca/scripts/systemd/hirs-aca.service
systemctl start hirs-aca
else
echo "Starting the ACA via Springboot..."
bash /opt/hirs/aca/scripts/aca/aca_bootRun.sh -w &
fi
popd > /dev/null

View File

@ -0,0 +1,18 @@
[Unit]
Description=Host Integrity at Runtime and Startup (HIRS) Attestation CA service
After=network.target
[Service]
User=root
Group=root
ExecStart=/usr/bin/bash /opt/hirs/aca/scripts/aca/aca_bootRun.sh -w
SuccessExitStatus=0
Restart=always
RestartSec=60
Environment="JAVA_HOME=/usr/bin/java"
ExecStop=/usr/bin/bash /opt/hirs/aca/scripts/aca/aca_stop.sh
Type=forking
[Install]
WantedBy=multi-user.target