mirror of
https://github.com/nsacyber/HIRS.git
synced 2025-01-30 08:04:05 +00:00
Merge pull request #97 from nsacyber/issue-90
Modify build scripts to enable installation on Amazon Linux
This commit is contained in:
commit
6dba37be80
17
.ci/docker/Dockerfile.amazonlinux2
Normal file
17
.ci/docker/Dockerfile.amazonlinux2
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
FROM amazonlinux:2
|
||||||
|
|
||||||
|
MAINTAINER apl.dev3@jhuapl.edu
|
||||||
|
|
||||||
|
# Install packages for building HIRS
|
||||||
|
RUN yum -y update && yum clean all
|
||||||
|
RUN yum groupinstall -y "Development Tools"
|
||||||
|
RUN yum install -y wget java-1.8.0-openjdk-devel protobuf-compiler rpm-build cmake make git gcc-c++ doxygen graphviz python libssh2-devel openssl protobuf-devel tpm2-tss-devel trousers-devel libcurl-devel
|
||||||
|
|
||||||
|
# Install EPEL
|
||||||
|
WORKDIR /tmp
|
||||||
|
RUN wget -O epel.rpm -nv https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
|
||||||
|
RUN yum install -y ./epel.rpm
|
||||||
|
RUN yum install -y cppcheck log4cplus-devel re2-devel
|
||||||
|
|
||||||
|
# Set Environment Variables
|
||||||
|
ENV JAVA_HOME /usr/lib/jvm/java
|
@ -40,6 +40,11 @@ jobs:
|
|||||||
script: docker run --rm -v $(pwd):/HIRS hirs/hirs-ci:ubuntu18 /bin/bash -c "cd /HIRS; ./package/package.ubuntu.sh"
|
script: docker run --rm -v $(pwd):/HIRS hirs/hirs-ci:ubuntu18 /bin/bash -c "cd /HIRS; ./package/package.ubuntu.sh"
|
||||||
env: null
|
env: null
|
||||||
name: "Package Ubuntu"
|
name: "Package Ubuntu"
|
||||||
|
# TODO: Explore reason behind Building/Packaging Failing on Amazon Linux
|
||||||
|
# - stage: Packaging and System Tests
|
||||||
|
# script: docker run --rm -v $(pwd):/HIRS hirs/hirs-ci:amazonlinux2 /bin/bash -c "cd /HIRS; ./package/package.centos.sh"
|
||||||
|
# env: null
|
||||||
|
# name: "Package Amazon Linux"
|
||||||
- stage: Packaging and System Tests
|
- stage: Packaging and System Tests
|
||||||
script: .ci/system-tests/./run-system-tests.sh
|
script: .ci/system-tests/./run-system-tests.sh
|
||||||
env: null
|
env: null
|
||||||
|
@ -3,8 +3,8 @@ set -e
|
|||||||
|
|
||||||
# Check packager OS is Centos
|
# Check packager OS is Centos
|
||||||
OS_NAME=$(awk -F= '/^NAME/{print $2}' /etc/os-release)
|
OS_NAME=$(awk -F= '/^NAME/{print $2}' /etc/os-release)
|
||||||
if [ "$OS_NAME" != "\"CentOS Linux\"" ]; then
|
if [ "$OS_NAME" != "\"CentOS Linux\"" ] && [ "$OS_NAME" != "\"Amazon Linux\"" ] ; then
|
||||||
echo "Error: RPMs must be built with CentOS"
|
echo "Error: RPMs must be built with CentOS or Amazon Linux"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -23,13 +23,17 @@ else
|
|||||||
service $SQL_SERVICE start
|
service $SQL_SERVICE start
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -f /etc/redhat-release ]] ; then
|
||||||
CENTOS_VER=`/opt/hirs/scripts/common/get_centos_major_version.sh`
|
CENTOS_VER=`/opt/hirs/scripts/common/get_centos_major_version.sh`
|
||||||
|
elif [[ -f /etc/os-release ]] ; then
|
||||||
|
AMAZON_VER=`/opt/hirs/scripts/common/get_amazon_linux_major_version.sh`
|
||||||
|
fi
|
||||||
if [ $CENTOS_VER -eq "6" ] ; then
|
if [ $CENTOS_VER -eq "6" ] ; then
|
||||||
DB_CREATE_SCRIPT=/opt/hirs/scripts/common/db_create.sql.el6
|
DB_CREATE_SCRIPT=/opt/hirs/scripts/common/db_create.sql.el6
|
||||||
elif [ $CENTOS_VER -eq "7" ] ; then
|
elif [ $CENTOS_VER -eq "7" ] || [ $AMAZON_VER -eq "2" ] ; then
|
||||||
DB_CREATE_SCRIPT=/opt/hirs/scripts/common/db_create.sql.el7
|
DB_CREATE_SCRIPT=/opt/hirs/scripts/common/db_create.sql.el7
|
||||||
else
|
else
|
||||||
echo "Unsupported CentOS version: ${CENTOS_VER}"
|
echo "Unsupported Linux detected"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -3,7 +3,11 @@ if ! [ $(id -u) = 0 ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -f /etc/redhat-release ]] ; then
|
||||||
CENTOS_VER=`/opt/hirs/scripts/common/get_centos_major_version.sh`
|
CENTOS_VER=`/opt/hirs/scripts/common/get_centos_major_version.sh`
|
||||||
|
elif [[ -f /etc/os-release ]] ; then
|
||||||
|
AMAZON_VER=`/opt/hirs/scripts/common/get_amazon_linux_major_version.sh`
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $CENTOS_VER -eq "6" ] ; then
|
if [ $CENTOS_VER -eq "6" ] ; then
|
||||||
checkHTTPS=`iptables-save | grep -- "--dport 8443 -j ACCEPT"`
|
checkHTTPS=`iptables-save | grep -- "--dport 8443 -j ACCEPT"`
|
||||||
@ -12,10 +16,11 @@ if [ $CENTOS_VER -eq "6" ] ; then
|
|||||||
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
|
service iptables save
|
||||||
fi
|
fi
|
||||||
elif [ $CENTOS_VER -eq "7" ] ; then
|
elif [ $CENTOS_VER -eq "7" ] || [ $AMAZON_VER -eq "2" ] ; then
|
||||||
firewall-cmd --direct --permanent --add-rule ipv4 filter INPUT 0 -p tcp --dport 8443 -j ACCEPT
|
firewall-cmd --direct --permanent --add-rule ipv4 filter INPUT 0 -p tcp --dport 8443 -j ACCEPT
|
||||||
firewall-cmd --reload
|
firewall-cmd --reload
|
||||||
else
|
else
|
||||||
echo "Unsupported CentOS version: ${CENTOS_VER}"
|
echo "Unsupported Linux detected"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
1
package/scripts/common/get_amazon_linux_major_version.sh
Normal file
1
package/scripts/common/get_amazon_linux_major_version.sh
Normal file
@ -0,0 +1 @@
|
|||||||
|
cat /etc/os-release | grep -Eo "VERSION=\"[0-9]" | tail -c 2
|
@ -219,13 +219,17 @@ if [[ $1 = "server" ]]; then
|
|||||||
chmod -R 770 $MYSQL_CERT_DIR
|
chmod -R 770 $MYSQL_CERT_DIR
|
||||||
|
|
||||||
# update MySQL/MariaDB SSL and index configuration
|
# update MySQL/MariaDB SSL and index configuration
|
||||||
CENTOS_VER=`/opt/hirs/scripts/common/get_centos_major_version.sh`
|
if [[ -f /etc/redhat-release ]] ; then
|
||||||
|
CENTOS_VER=`/opt/hirs/scripts/common/get_centos_major_version.sh`
|
||||||
|
elif [[ -f /etc/os-release ]] ; then
|
||||||
|
AMAZON_VER=`/opt/hirs/scripts/common/get_amazon_linux_major_version.sh`
|
||||||
|
fi
|
||||||
if [ $CENTOS_VER -eq "6" ] ; then
|
if [ $CENTOS_VER -eq "6" ] ; then
|
||||||
MYSQL_ADDITIONS_FILE=/opt/hirs/scripts/common/my.cnf.el6
|
MYSQL_ADDITIONS_FILE=/opt/hirs/scripts/common/my.cnf.el6
|
||||||
elif [ $CENTOS_VER -eq "7" ] ; then
|
elif [ $CENTOS_VER -eq "7" ] || [ $AMAZON_VER -eq "2" ] ; then
|
||||||
MYSQL_ADDITIONS_FILE=/opt/hirs/scripts/common/my.cnf.el7
|
MYSQL_ADDITIONS_FILE=/opt/hirs/scripts/common/my.cnf.el7
|
||||||
else
|
else
|
||||||
echo "Unsupported CentOS version: ${CENTOS_VER}"
|
echo "Unsupported Linux detected"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -246,4 +250,4 @@ if [[ $1 = "server" ]]; then
|
|||||||
service $SQL_SERVICE restart
|
service $SQL_SERVICE restart
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user