diff --git a/install_nginx.sh b/install_nginx.sh index ccd99ba..e58d949 100644 --- a/install_nginx.sh +++ b/install_nginx.sh @@ -72,21 +72,47 @@ extra_remove_packages="" extra_build_nginx_cmd="true" if [[ "$@" == *"--install-modsecurity"* ]];then install_modsecurity="1" + if [[ "$ubuntu_ver" < "16" ]]; then #use 3.0.6 + sudo bash -l -c " + cd /root && + apt-get install -y apt-utils autoconf automake build-essential git libcurl4-openssl-dev libgeoip-dev liblmdb-dev libpcre++-dev libtool libxml2-dev libyajl-dev pkgconf wget zlib1g-dev && + git clone https://github.com/SpiderLabs/ModSecurity.git && + cd ModSecurity && + git checkout v3.0.6 && + git submodule init && + git submodule update && + ./build.sh && + ./configure && + make && + make install && + cd .. && + git clone --depth 1 https://github.com/SpiderLabs/ModSecurity-nginx.git + " + else + sudo bash -l -c " + cd /root && + apt-get install -y apt-utils autoconf automake build-essential git libcurl4-openssl-dev libgeoip-dev liblmdb-dev libpcre++-dev libtool libxml2-dev libyajl-dev pkgconf wget zlib1g-dev && + git clone --depth 1 -b v3/master --single-branch https://github.com/SpiderLabs/ModSecurity && + cd ModSecurity && + git submodule init && + git submodule update && + ./build.sh && + ./configure && + make && + make install && + cd .. && + git clone --depth 1 https://github.com/SpiderLabs/ModSecurity-nginx.git + " + fi + nginx_configure="$nginx_configure --add-dynamic-module=../ModSecurity-nginx" +fi +if [[ "$@" == *"--install-naxsi"* ]];then + install_naxsi="1" sudo bash -l -c " cd /root && - apt-get install -y apt-utils autoconf automake build-essential git libcurl4-openssl-dev libgeoip-dev liblmdb-dev libpcre++-dev libtool libxml2-dev libyajl-dev pkgconf wget zlib1g-dev && - git clone --depth 1 -b v3/master --single-branch https://github.com/SpiderLabs/ModSecurity && - cd ModSecurity && - git submodule init && - git submodule update && - ./build.sh && - ./configure && - make && - make install && - cd .. && - git clone --depth 1 https://github.com/SpiderLabs/ModSecurity-nginx.git + git clone --depth 1 https://github.com/nbs-system/naxsi.git " - nginx_configure="$nginx_configure --add-dynamic-module=../ModSecurity-nginx" + nginx_configure="$nginx_configure --add-module=../naxsi/naxsi_src" fi if [[ "$@" == *"--install-passenger"* ]];then install_passenger="1" @@ -177,6 +203,7 @@ if [[ "$nginx_ver" < $nginx_target_ver ]] || [[ "$1" == '--force' ]] || [[ "$ins cd /root/nginx-$nginx_target_ver && \ make modules && \ cp -f objs/ngx_http_modsecurity_module.so /etc/nginx/modules/. && \ + mkdir -p /etc/nginx/modules-enabled && \ echo 'load_module modules/ngx_http_modsecurity_module.so;' > /etc/nginx/modules-enabled/50-mod-modsecurity.conf && \ mkdir -p /etc/nginx/modsec && \ wget -P /etc/nginx/modsec/ https://raw.githubusercontent.com/SpiderLabs/ModSecurity/v3/master/modsecurity.conf-recommended && \