From 37f5e4ed716abb2c07524960387edf44dc267671 Mon Sep 17 00:00:00 2001 From: bunkerity Date: Wed, 23 Jun 2021 15:46:04 +0200 Subject: [PATCH] linux - fixed debian/ubuntu but still some work needed on centos --- helpers/dependencies.sh | 10 ++++++---- helpers/install.sh | 4 ++-- tests/linux.sh | 6 ++++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/helpers/dependencies.sh b/helpers/dependencies.sh index 75e7d72..ed7767b 100644 --- a/helpers/dependencies.sh +++ b/helpers/dependencies.sh @@ -532,11 +532,13 @@ echo "./configure $CONFARGS --add-dynamic-module=/tmp/bunkerized-nginx/ModSecuri do_and_check_cmd chmod +x "/tmp/bunkerized-nginx/nginx-${NGINX_VERSION}/configure-fix.sh" CHANGE_DIR="/tmp/bunkerized-nginx/nginx-${NGINX_VERSION}" LUAJIT_LIB="/usr/local/lib/" LUAJIT_INC="/usr/local/include/luajit-2.1" do_and_check_cmd ./configure-fix.sh CHANGE_DIR="/tmp/bunkerized-nginx/nginx-${NGINX_VERSION}" do_and_check_cmd make -j $NTASK modules -if [ "$OS" = "centos" ] ; then - CHANGE_DIR="/tmp/bunkerized-nginx/nginx-${NGINX_VERSION}" do_and_check_cmd cp ./objs/*.so /usr/lib64/nginx/modules -else - CHANGE_DIR="/tmp/bunkerized-nginx/nginx-${NGINX_VERSION}" do_and_check_cmd cp ./objs/*.so /usr/lib/nginx/modules +if [ ! -d "/usr/lib/nginx/modules" ] ; then + do_and_check_cmd mkdir -p /usr/lib/nginx/modules fi +do_and_check_cmd chown -R root:root /usr/lib/nginx +do_and_check_cmd chmod -R 755 /usr/lib/nginx +CHANGE_DIR="/tmp/bunkerized-nginx/nginx-${NGINX_VERSION}" do_and_check_cmd cp ./objs/*.so /usr/lib/nginx/modules +do_and_check_cmd chmod 744 /usr/lib/nginx/modules/* # We're done if [ "$OS" = "alpine" ] ; then diff --git a/helpers/install.sh b/helpers/install.sh index 101ab0c..2e7b991 100644 --- a/helpers/install.sh +++ b/helpers/install.sh @@ -83,11 +83,11 @@ if [ "$OS" = "debian" ] || [ "$OS" = "ubuntu" ] ; then fi echo "[*] Install dependencies" if [ "$OS" = "debian" ] || [ "$OS" = "ubuntu" ] ; then - DEBIAN_DEPS="git cron curl python3 python3-pip" + DEBIAN_DEPS="git cron curl python3 python3-pip procps" DEBIAN_FRONTEND=noninteractive do_and_check_cmd apt install -y $DEBIAN_DEPS elif [ "$OS" = "centos" ] ; then do_and_check_cmd yum install -y epel-release - CENTOS_DEPS="git crontabs curl python3 python3-pip" + CENTOS_DEPS="git crontabs curl python3 python3-pip procps luajit lua" do_and_check_cmd yum install -y $CENTOS_DEPS fi do_and_check_cmd pip3 install jinja2 diff --git a/tests/linux.sh b/tests/linux.sh index 625c864..5d64761 100755 --- a/tests/linux.sh +++ b/tests/linux.sh @@ -72,16 +72,18 @@ fi echo "[*] Exec bunkerized-nginx" docker exec "$id" bunkerized-nginx -if [ $? -ne 0 ] || [ "$res" != "ok" ] ; then +if [ $? -ne 0 ] ; then echo "[!] docker exec failed" cleanup "$id" exit 9 fi echo "[*] Exec curl" -res="$(curl -s -H "User-Agent: LegitOne" http://localhost/") +res="$(curl -s -H "User-Agent: LegitOne" http://localhost/)" if [ $? -ne 0 ] || [ "$res" != "ok" ] ; then echo "[!] curl failed" cleanup "$id" exit 10 fi + +cleanup "$id"