diff --git a/build.sh b/build.sh index 949dda5..398f906 100755 --- a/build.sh +++ b/build.sh @@ -50,21 +50,21 @@ else exit 1 fi -APP_MGR_CMD= -for APP_MGR in ${APP_MGRS}; do - APP_MGR_CHECK=`which ${APP_MGR} &>/dev/null` - if [ $? -eq 0 ] ; then - APP_MGR_CMD="${APP_MGR}" - FULL_APP_MGR_CMD=$APP_MGR_CMD - break - fi -done - -echo OS is ${OS}, APP_MGR_CMD is ${APP_MGR_CMD}. -if [ "x${APP_MGR_CMD}" = "x" ] ; then - echo 'Can not find package installation command, quit.' - exit 1 -fi +#APP_MGR_CMD= +#for APP_MGR in ${APP_MGRS}; do +# APP_MGR_CHECK=`which ${APP_MGR} &>/dev/null` +# if [ $? -eq 0 ] ; then +# APP_MGR_CMD="${APP_MGR}" +# FULL_APP_MGR_CMD=$APP_MGR_CMD +# break +# fi +#done +# +#echo OS is ${OS}, APP_MGR_CMD is ${APP_MGR_CMD}. +#if [ "x${APP_MGR_CMD}" = "x" ] ; then +# echo 'Can not find package installation command, quit.' +# exit 1 +#fi # getVersionNumber0() @@ -229,27 +229,6 @@ installgo() fi } - -preparelibquic() -{ - if [ -e lsquic ] ; then - ls src/ | grep liblsquic - if [ $? -eq 0 ] ; then - echo Need to git download the submodule ... - rm -rf lsquic - git clone https://github.com/litespeedtech/lsquic.git - cd lsquic - - LIBQUICVER=`cat ../LSQUICCOMMIT` - echo "LIBQUICVER is ${LIBQUICVER}" - git checkout ${LIBQUICVER} - git submodule update --init --recursive - cd .. - - fi - fi -} - prepareLinux() { OSTYPE=unknownlinux @@ -490,14 +469,14 @@ cpModuleSoFiles() mkdir dist/modules/ fi - for module in build/src/modules/*; do - cp -f ${module}/*.so dist/modules/ - done + #for module in build/src/modules/*; do + # cp -f ${module}/*.so dist/modules/ + #done if [ -e build/src/modules/modsecurity-ls/mod_security.so ] ; then cp -f build/src/modules/modsecurity-ls/mod_security.so dist/modules/ fi - + if [ -e build/src/modules/lua/mod_lua.so ] ; then cp -f build/src/modules/lua/mod_lua.so dist/modules/ fi @@ -514,9 +493,6 @@ fixshmdir() mkdir /tmp/shm chmod 777 /tmp/shm sed -i -e "s/\/dev\/shm/\/tmp\/shm/g" dist/conf/httpd_config.conf.in - if [ "${OS}" = "FreeBSD" ] ; then - echo 'link /tmp/shm shm' >> /etc/devfs.conf - fi fi } @@ -574,7 +550,7 @@ if [ "${OS}" = "FreeBSD" ] ; then prepareBsd elif [ "${OS}" = "Linux" ] ; then ISLINUX=yes - prepareLinux +# prepareLinux elif [ "${OS}" = "Darwin" ] ; then prepareMac fi @@ -582,32 +558,26 @@ fi cd .. -if [ ! -d third-party ]; then - - git clone https://github.com/litespeedtech/third-party.git - mkdir third-party/lib64 - cd third-party/script/ - - #Remove unittest-cpp and add bcrypt - sed -i -e "s/unittest-cpp/bcrypt/g" ./build_ols.sh - if [ "$MOD_SECURITY" != "ON" ]; then - sed -i -e "s/libmodsec/ /g" ./build_ols.sh - fi - if [ "$MOD_PAGESPEED" != "ON" ]; then - sed -i -e "s/psol/ /g" ./build_ols.sh - fi - if [ "$MOD_LUA" != "ON" ]; then - sed -i -e "s/luajit/ /g" ./build_ols.sh - fi - - ./build_ols.sh +mkdir third-party/lib64 +cd third-party/script/ +#Remove unittest-cpp and add bcrypt +sed -i -e "s/unittest-cpp/bcrypt/g" ./build_ols.sh +if [ "$MOD_SECURITY" != "ON" ]; then + sed -i -e "s/libmodsec/ /g" ./build_ols.sh +fi +if [ "$MOD_PAGESPEED" != "ON" ]; then + sed -i -e "s/psol/ /g" ./build_ols.sh fi +if [ "$MOD_LUA" != "ON" ]; then + sed -i -e "s/luajit/ /g" ./build_ols.sh +fi + +./build_ols.sh cd ${CURDIR} updateSrcCMakelistfile -preparelibquic if [ "$MOD_PAGESPEED" = "ON" ]; then @@ -625,7 +595,7 @@ fi cd src/modules/lsrecaptcha export GOPATH=$CUR_PATH/src/modules/lsrecaptcha export GO111MODULE=off -go build lsrecaptcha +./build_lsrecaptcha.sh cp lsrecaptcha ../../../dist/lsrecaptcha/_recaptcha cd ../../../ @@ -660,9 +630,9 @@ jobs=$(nproc) make -j${jobs} cd .. -cp build/src/openlitespeed dist/bin/ +mv build/src/openlitespeed dist/bin/ if [ -e build/support/unmount_ns/unmount_ns ] ; then - cp build/support/unmount_ns/unmount_ns dist/bin/ + mv build/support/unmount_ns/unmount_ns dist/bin/ fi cpModuleSoFiles @@ -672,11 +642,11 @@ if [ -e src/liblsquic ] ; then freebsdFix fi -cat > ./ols.conf < ./dist/ols.conf < ./install.sh < ./dist/install.sh </dev/null 2>&1 @@ -796,7 +765,7 @@ fi END -chmod 777 ./install.sh +chmod 777 ./dist/install.sh echo -e "\033[38;5;71mBuilding finished, please run ./install.sh for installation.\033[39m" echo -e "\033[38;5;71mYou may want to update the ols.conf to change the settings before installation.\033[39m" diff --git a/dist/admin/misc/lscmctl b/dist/admin/misc/lscmctl index ee0f595..e2372e8 100755 --- a/dist/admin/misc/lscmctl +++ b/dist/admin/misc/lscmctl @@ -92,14 +92,7 @@ printHelp() updateMinAPIVerFile() { - MIN_VER=$(wget -q https://www.litespeed.sh/sub/shared/MIN_VER -O -) - RET=$? - - if [ "${RET}" = "127" ] ; then - errorExit "Required command 'wget' not found with exit code 127." - elif [ "$RET" != "0" ] ; then - errorExit "Failed to download latest MIN_VER file with wget exit status ${RET}." - fi + MIN_VER=1.17.1.1 echo "${MIN_VER}" > "${SHARED_API_MIN_VER_FILE}" } diff --git a/dist/functions.sh b/dist/functions.sh index fb7a33c..9ef9038 100755 --- a/dist/functions.sh +++ b/dist/functions.sh @@ -398,11 +398,11 @@ EOF DIR_OWN=$WS_USER:$WS_GROUP CONF_OWN=$WS_USER:$WS_GROUP - if [ $INST_USER = "root" ]; then - if [ $SUCC -eq "1" ]; then - chown -R "$DIR_OWN" "$LSWS_HOME" - fi - fi +# if [ $INST_USER = "root" ]; then +# if [ $SUCC -eq "1" ]; then + # chown -R "$DIR_OWN" "$LSWS_HOME" + # fi + # fi } stopLshttpd() @@ -650,7 +650,7 @@ util_mkdir() if [ ! -d "$LSWS_HOME/$arg" ]; then mkdir "$LSWS_HOME/$arg" fi - chown "$OWNER" "$LSWS_HOME/$arg" + #chown "$OWNER" "$LSWS_HOME/$arg" chmod $PERM "$LSWS_HOME/$arg" done @@ -667,7 +667,7 @@ util_cpfile() do if [ -f "$LSINSTALL_DIR/$arg" ]; then cp -f "$LSINSTALL_DIR/$arg" "$LSWS_HOME/$arg" - chown "$OWNER" "$LSWS_HOME/$arg" + #chown "$OWNER" "$LSWS_HOME/$arg" chmod $PERM "$LSWS_HOME/$arg" fi done @@ -686,7 +686,7 @@ util_ccpfile() cp "$LSINSTALL_DIR/$arg" "$LSWS_HOME/$arg" fi if [ -f "$LSWS_HOME/$arg" ]; then - chown "$OWNER" "$LSWS_HOME/$arg" + #chown "$OWNER" "$LSWS_HOME/$arg" chmod $PERM "$LSWS_HOME/$arg" fi done @@ -702,7 +702,7 @@ util_cpdir() for arg do cp -R "$LSINSTALL_DIR/$arg/"* "$LSWS_HOME/$arg/" - chown -R "$OWNER" "$LSWS_HOME/$arg/"* + #chown -R "$OWNER" "$LSWS_HOME/$arg/"* #chmod -R $PERM $LSWS_HOME/$arg/* done } @@ -713,7 +713,7 @@ util_cp_htaccess() PERM=$2 arg=$3 cp -R "$LSINSTALL_DIR/$arg/".htaccess "$LSWS_HOME/$arg/" - chown -R "$OWNER" "$LSWS_HOME/$arg/".htaccess + #chown -R "$OWNER" "$LSWS_HOME/$arg/".htaccess } @@ -729,7 +729,7 @@ util_cpdirv() for arg do cp -R "$LSINSTALL_DIR/$arg/"* "$LSWS_HOME/$arg.$VERSION/" - chown -R "$OWNER" "$LSWS_HOME/$arg.$VERSION" + #chown -R "$OWNER" "$LSWS_HOME/$arg.$VERSION" $TEST_BIN -L "$LSWS_HOME/$arg" if [ $? -eq 0 ]; then rm -f "$LSWS_HOME/$arg" @@ -751,7 +751,7 @@ util_cpfilev() for arg do cp -f "$LSINSTALL_DIR/$arg" "$LSWS_HOME/$arg.$VERSION" - chown "$OWNER" "$LSWS_HOME/$arg.$VERSION" + #chown "$OWNER" "$LSWS_HOME/$arg.$VERSION" chmod $PERM "$LSWS_HOME/$arg.$VERSION" $TEST_BIN -L "$LSWS_HOME/$arg" if [ $? -eq 0 ]; then @@ -768,7 +768,7 @@ installation1() umask 022 if [ $INST_USER = "root" ]; then SDIR_OWN="root:$ROOTGROUP" - chown $SDIR_OWN $LSWS_HOME + #chown $SDIR_OWN $LSWS_HOME else SDIR_OWN=$DIR_OWN fi @@ -783,7 +783,7 @@ installation1() if [ ! -f "$LSWS_HOME/$arg" ]; then cp "$LSINSTALL_DIR/$arg" "$LSWS_HOME/$arg" fi - chown "$OWNER" "$LSWS_HOME/$arg" + #chown "$OWNER" "$LSWS_HOME/$arg" chmod $PERM "$LSWS_HOME/$arg" done } @@ -798,7 +798,7 @@ util_cpdir() for arg do cp -R "$LSINSTALL_DIR/$arg/"* "$LSWS_HOME/$arg/" - chown -R "$OWNER" "$LSWS_HOME/$arg/"* + #chown -R "$OWNER" "$LSWS_HOME/$arg/"* #chmod -R $PERM $LSWS_HOME/$arg/* done } @@ -817,7 +817,7 @@ util_cpdirv() do if [ -d "$LSINSTALL_DIR/$arg" ]; then cp -R "$LSINSTALL_DIR/$arg/"* "$LSWS_HOME/$arg.$VERSION/" - chown -R "$OWNER" "$LSWS_HOME/$arg.$VERSION" + #chown -R "$OWNER" "$LSWS_HOME/$arg.$VERSION" $TEST_BIN -L "$LSWS_HOME/$arg" if [ $? -eq 0 ]; then rm -f "$LSWS_HOME/$arg" @@ -842,7 +842,7 @@ util_cpfilev() if [ -f "$LSINSTALL_DIR/$arg" ]; then cp -f "$LSINSTALL_DIR/$arg" "$LSWS_HOME/$arg.$VERSION" - chown "$OWNER" "$LSWS_HOME/$arg.$VERSION" + #chown "$OWNER" "$LSWS_HOME/$arg.$VERSION" chmod $PERM "$LSWS_HOME/$arg.$VERSION" $TEST_BIN -L "$LSWS_HOME/$arg" if [ $? -eq 0 ]; then @@ -914,7 +914,7 @@ installation_lscpd() fi SDIR_OWN="root:$ROOTGROUP" LOGDIR_OWN="root:$WS_GROUP" - chown $SDIR_OWN $LSWS_HOME + #chown $SDIR_OWN $LSWS_HOME else SDIR_OWN=$DIR_OWN LOGDIR_OWN=$DIR_OWN @@ -974,7 +974,7 @@ installation() fi SDIR_OWN="root:$ROOTGROUP" LOGDIR_OWN="root:$WS_GROUP" - chown $SDIR_OWN $LSWS_HOME + #chown $SDIR_OWN $LSWS_HOME else SDIR_OWN=$DIR_OWN LOGDIR_OWN=$DIR_OWN @@ -991,12 +991,12 @@ installation() util_mkdir "$CONF_OWN" $SDIR_MOD conf conf/cert conf/templates conf/vhosts conf/vhosts/Example admin/conf admin/tmp phpbuild util_mkdir "$SDIR_OWN" $SDIR_MOD cgid admin/cgid admin/cgid/secret util_mkdir "$DIR_OWN" $SDIR_MOD tmp/ocspcache - chgrp $WS_GROUP $LSWS_HOME/admin/tmp $LSWS_HOME/admin/cgid $LSWS_HOME/cgid + #chgrp $WS_GROUP $LSWS_HOME/admin/tmp $LSWS_HOME/admin/cgid $LSWS_HOME/cgid chmod g+x $LSWS_HOME/admin/tmp $LSWS_HOME/admin/cgid $LSWS_HOME/cgid - chown $CONF_OWN $LSWS_HOME/admin/tmp/sess_* 1>/dev/null 2>&1 - chown $DIR_OWN $LSWS_HOME/cachedata - chown $DIR_OWN $LSWS_HOME/autoupdate - chown $DIR_OWN $LSWS_HOME/tmp + #chown $CONF_OWN $LSWS_HOME/admin/tmp/sess_* 1>/dev/null 2>&1 + #chown $DIR_OWN $LSWS_HOME/cachedata + #chown $DIR_OWN $LSWS_HOME/autoupdate + #chown $DIR_OWN $LSWS_HOME/tmp util_mkdir "$SDIR_OWN" $DIR_MOD Example find "$LSWS_HOME/admin/tmp" -type s -atime +1 -delete 2>/dev/null @@ -1076,7 +1076,7 @@ installation() fi #change conf own as lsadm:nobody permission 750 - chown -R lsadm:$WS_GROUP "$LSWS_HOME/conf/" + #chown -R lsadm:$WS_GROUP "$LSWS_HOME/conf/" chmod -R 0750 "$LSWS_HOME/conf/" chmod 0600 "$LSWS_HOME/conf/httpd_config.conf" diff --git a/dist/install.sh b/dist/install.sh index d38d958..acd4a94 100755 --- a/dist/install.sh +++ b/dist/install.sh @@ -33,7 +33,7 @@ inst_admin_php() if [ "x$OS" = "xLinux" ] ; then if [ "x$ARCH" = "xx86_64" ] ; then - $DLCMD $LSWS_HOME/admin/fcgi-bin/admin_php http://www.litespeedtech.com/packages/lsphp5_bin/x86_64/lsphp5 + mv $TEMPDIR/admin/fcgi-bin/admin_php $LSWS_HOME/admin/fcgi-bin/ elif [ "x$ARCH" = "xaarch64" ] ; then $DLCMD $LSWS_HOME/admin/fcgi-bin/admin_php http://www.litespeedtech.com/packages/lsphp7_bin/aarch64/lsphp else @@ -183,6 +183,7 @@ inst_lsphp7() #script start here cd `dirname "$0"` +TEMPDIR=$(pwd) . ./functions.sh if [ $? != 0 ] ; then echo "[ERROR] Can not include 'functions.sh'." @@ -404,10 +405,9 @@ if [ "x$IS_LSCPD" != "xyes" ] ; then $LSWS_HOME/admin/misc/create_admin_keypair.sh fi - chown "$CONF_OWN" "$LSWS_HOME/admin/conf/jcryption_keypair" + chmod 0600 "$LSWS_HOME/admin/conf/jcryption_keypair" - chown "$CONF_OWN" "$LSWS_HOME/admin/conf/htpasswd" chmod 0600 "$LSWS_HOME/admin/conf/htpasswd" diff --git a/src/modules/modsecurity-ls/CMakeLists.txt b/src/modules/modsecurity-ls/CMakeLists.txt index c091ad9..f110452 100644 --- a/src/modules/modsecurity-ls/CMakeLists.txt +++ b/src/modules/modsecurity-ls/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.0) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11 -Wall") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++17 -Wall") include_directories(${PROJECT_SOURCE_DIR}/../third-party/ModSecurity/headers/)