mirror of
https://github.com/nsacyber/HIRS.git
synced 2025-06-21 16:39:36 +00:00
* [#46] Ensure Travis mounts repository rather than clones it in Docker * [#46] Containerize HIRS ACA and prep ACA container for Integration Tests * [#46] Containerize HIRS TPM2Provisioner and prep TPM2Provisioner container for Integration Tests * [#46] Replace localinstall with install * [#46] Prevent rebuilding of packages unnecessarily * [#46] Finish initial docker compose setup for integration tests * [#46] Allow for detection of complete Integration Environment Setup * [#46] Fix Travis CI to allow for detecting Integ Test Environ Stand-Up * [#46] Fix Initial Integration Test Script * [#46] Troubleshoot Integration Test script
This commit is contained in:
@ -1,10 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
SQL_SERVICE=`/opt/hirs/scripts/common/get_db_service.sh`
|
||||
# Check if we're in a Docker container
|
||||
if [ -f /.dockerenv ]; then
|
||||
DOCKER_CONTAINER=true
|
||||
else
|
||||
DOCKER_CONTAINER=false
|
||||
fi
|
||||
|
||||
echo "Creating HIRS Database..."
|
||||
chkconfig $SQL_SERVICE on
|
||||
service $SQL_SERVICE start
|
||||
|
||||
if [ $DOCKER_CONTAINER = true ]; then
|
||||
# If in Docker container, avoid services that invoke the D-Bus
|
||||
if [[ $(pgrep -c -u mysql mysqld) -eq 0 ]]; then
|
||||
/usr/libexec/mariadb-prepare-db-dir
|
||||
nohup /usr/bin/mysqld_safe --basedir=/usr &>/dev/null &
|
||||
MYSQLD_PID=$(pgrep -u mysql mysqld)
|
||||
/usr/libexec/mariadb-wait-ready $MYSQLD_PID
|
||||
fi
|
||||
else
|
||||
SQL_SERVICE=`/opt/hirs/scripts/common/get_db_service.sh`
|
||||
chkconfig $SQL_SERVICE on
|
||||
service $SQL_SERVICE start
|
||||
fi
|
||||
|
||||
CENTOS_VER=`/opt/hirs/scripts/common/get_centos_major_version.sh`
|
||||
if [ $CENTOS_VER -eq "6" ] ; then
|
||||
|
@ -1,15 +1,20 @@
|
||||
if ! [ $(id -u) = 0 ]; then
|
||||
echo "Please run this script as root."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CENTOS_VER=`/opt/hirs/scripts/common/get_centos_major_version.sh`
|
||||
|
||||
if [ $CENTOS_VER -eq "6" ] ; then
|
||||
checkHTTPS=`iptables-save | grep -- "--dport 8443 -j ACCEPT"`
|
||||
if [[ $checkHTTPS == "" ]]; then
|
||||
echo "Tomcat HTTPS firewall rule doesn't exist, adding now"
|
||||
sudo iptables -I INPUT 1 -p tcp -m tcp --dport 8443 -j ACCEPT
|
||||
iptables -I INPUT 1 -p tcp -m tcp --dport 8443 -j ACCEPT
|
||||
service iptables save
|
||||
fi
|
||||
elif [ $CENTOS_VER -eq "7" ] ; then
|
||||
sudo firewall-cmd --direct --permanent --add-rule ipv4 filter INPUT 0 -p tcp --dport 8443 -j ACCEPT
|
||||
sudo firewall-cmd --reload
|
||||
firewall-cmd --direct --permanent --add-rule ipv4 filter INPUT 0 -p tcp --dport 8443 -j ACCEPT
|
||||
firewall-cmd --reload
|
||||
else
|
||||
echo "Unsupported CentOS version: ${CENTOS_VER}"
|
||||
exit 1
|
||||
|
44
package/scripts/common/ssl_configure.sh
Normal file → Executable file
44
package/scripts/common/ssl_configure.sh
Normal file → Executable file
@ -14,6 +14,13 @@ P12_DATA=${CERTIFICATES}/private/p12.data
|
||||
|
||||
echo 'Checking SSL configuration for HIRS'
|
||||
|
||||
# Check if we're in a Docker container
|
||||
if [ -f /.dockerenv ]; then
|
||||
DOCKER_CONTAINER=true
|
||||
else
|
||||
DOCKER_CONTAINER=false
|
||||
fi
|
||||
|
||||
#################
|
||||
# Key Generation
|
||||
#################
|
||||
@ -115,7 +122,15 @@ if [[ $1 = "server" ]]; then
|
||||
chkconfig ${TOMCAT_SERVICE} on
|
||||
|
||||
# Configure the server.xml file such that it uses our key store and trust store
|
||||
service ${TOMCAT_SERVICE} stop
|
||||
if [ $DOCKER_CONTAINER = true ]; then
|
||||
# If in Docker container, avoid services that invoke the D-Bus
|
||||
if [[ $(pgrep -c -f /usr/share/tomcat) -ne 0 ]]; then
|
||||
echo "Tomcat is running, so we stop it."
|
||||
/usr/libexec/tomcat/server stop
|
||||
fi
|
||||
else
|
||||
service ${TOMCAT_SERVICE} stop
|
||||
fi
|
||||
|
||||
# Configure Tomcat SSL properly. The method for doing this changes from 6.0.38 onward.
|
||||
rpmdev-vercmp 6.0.38 $TOMCAT_VERSION
|
||||
@ -143,7 +158,16 @@ EOF
|
||||
# (3) set tomcat user as owner of tomcat installation
|
||||
chgrp -R tomcat ${CATALINA_HOME}
|
||||
|
||||
service ${TOMCAT_SERVICE} start
|
||||
if [ $DOCKER_CONTAINER = true ]; then
|
||||
# If in Docker container, avoid services that invoke the D-Bus
|
||||
(/usr/libexec/tomcat/server start) &
|
||||
# Wait for Tomcat to boot completely
|
||||
until [ "`curl --silent --connect-timeout 1 -I http://localhost:8080 | grep 'Coyote'`" != "" ]; do
|
||||
:
|
||||
done
|
||||
else
|
||||
service ${TOMCAT_SERVICE} start
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -207,7 +231,19 @@ if [[ $1 = "server" ]]; then
|
||||
|
||||
sed -i "/\[mysqld\]/r $MYSQL_ADDITIONS_FILE" /etc/my.cnf
|
||||
|
||||
SQL_SERVICE=`/opt/hirs/scripts/common/get_db_service.sh`
|
||||
service $SQL_SERVICE restart
|
||||
if [ $DOCKER_CONTAINER = true ]; then
|
||||
# If in Docker container, avoid services that invoke the D-Bus
|
||||
if [[ $(pgrep -c -u mysql mysqld) -ne 0 ]]; then
|
||||
echo "MariaDB is running, so we'll need to restart it."
|
||||
mysqladmin shutdown
|
||||
/usr/libexec/mariadb-prepare-db-dir
|
||||
nohup /usr/bin/mysqld_safe --basedir=/usr &>/dev/null &
|
||||
MYSQLD_PID=$(pgrep -u mysql mysqld)
|
||||
/usr/libexec/mariadb-wait-ready $MYSQLD_PID
|
||||
fi
|
||||
else
|
||||
SQL_SERVICE=`/opt/hirs/scripts/common/get_db_service.sh`
|
||||
service $SQL_SERVICE restart
|
||||
fi
|
||||
fi
|
||||
fi
|
Reference in New Issue
Block a user