From 0a7d0ceed7ff5b2653a06b55caf390b62b8f5c70 Mon Sep 17 00:00:00 2001 From: Code-Egg Date: Fri, 8 Nov 2024 14:31:06 +0800 Subject: [PATCH] modified: .travis/verify.sh modified: README.md --- .travis/verify.sh | 58 ++++++++++++++++++++++++++++++++++++++ README.md | 2 +- bin/container/domainctl.sh | 6 ++-- 3 files changed, 62 insertions(+), 4 deletions(-) diff --git a/.travis/verify.sh b/.travis/verify.sh index c528b06..cf78831 100755 --- a/.travis/verify.sh +++ b/.travis/verify.sh @@ -1,6 +1,7 @@ #!/bin/bash set -o errexit +EX_DM='example.com' install_demo(){ ./bin/demosite.sh @@ -22,6 +23,7 @@ verify_page(){ echo '[O] http://localhost:80/' else echo '[X] http://localhost:80/' + curl -sIk http://localhost:80/ exit 1 fi curl -sIk https://localhost:443/ | grep -i WordPress @@ -29,6 +31,7 @@ verify_page(){ echo '[O] https://localhost:443/' else echo '[X] https://localhost:443/' + curl -sIk https://localhost:443/ exit 1 fi } @@ -50,10 +53,65 @@ verify_phpadmin(){ fi } +verify_add_vh_wp(){ + echo "Setup a WordPress site with ${EX_DM} domain" + bash bin/domain.sh --add "${EX_DM}" + bash bin/database.sh --domain "${EX_DM}" + bash bin/appinstall.sh --app wordpress --domain "${EX_DM}" + curl -sIk http://${EX_DM}:80/ --resolve ${EX_DM}:80:127.0.0.1 | grep -i WordPress + if [ ${?} = 0 ]; then + echo "[O] http://${EX_DM}:80/" + else + echo "[X] http://${EX_DM}:80/" + curl -sIk http://${EX_DM}:80/ + exit 1 + fi +} +verify_del_vh_wp(){ + echo "Remove ${EX_DM} domain" + bash bin/domain.sh --del ${EX_DM} + if [ ${?} = 0 ]; then + echo "[O] ${EX_DM} VH is removed" + else + echo "[X] ${EX_DM} VH is not removed" + exit 1 + fi + echo "Remove examplecom DataBase" + bash bin/database.sh --delete -DB examplecom +} + +verify_owasp(){ + echo 'Updating LSWS' + bash bin/webadmin.sh --upgrade 2>&1 /dev/null + echo 'Enabling OWASP' + bash bin/webadmin.sh --mod-secure enable + curl -sIk http://localhost:80/phpinfo.php | awk '/HTTP/ && /403/' + if [ ${?} = 0 ]; then + echo '[O] OWASP enable' + else + echo '[X] OWASP enable' + curl -sIk http://localhost:80/phpinfo.php | awk '/HTTP/ && /403/' + exit 1 + fi + bash bin/webadmin.sh --mod-secure disable + curl -sIk http://localhost:80/phpinfo.php | grep -i WordPress + if [ ${?} = 0 ]; then + echo '[O] OWASP disable' + else + echo '[X] OWASP disable' + curl -sIk http://localhost:80/phpinfo.php + exit 1 + fi +} + + main(){ verify_lsws verify_phpadmin install_demo verify_page + verify_owasp + verify_add_vh_wp + verify_del_vh_wp } main \ No newline at end of file diff --git a/README.md b/README.md index 62a33ff..46b74ef 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [](litespeedtech.com/slack) [](https://twitter.com/litespeedtech) -Install a lightweight WordPress container with OpenLiteSpeed Edge or Stable version based on Ubuntu 22.04 Linux. +Install a lightweight WordPress container with OpenLiteSpeed Edge or Stable version based on Ubuntu 24.04 Linux. ### Prerequisites 1. [Install Docker](https://www.docker.com/) diff --git a/bin/container/domainctl.sh b/bin/container/domainctl.sh index 40e8b40..a194603 100755 --- a/bin/container/domainctl.sh +++ b/bin/container/domainctl.sh @@ -129,15 +129,15 @@ del_domain(){ echo "# Domain non-exist! Check the ${LS_HTTPD_CONF} if you believe this is a mistake!" exit 1 fi + del_ls_domain ${1} elif [ "${LSV}" = 'openlitespeed' ]; then check_duplicate "member.*${DOMAIN}" ${OLS_HTTPD_CONF} if [ "${CK_RESULT}" = '' ]; then echo "# Domain non-exist! Check the ${OLS_HTTPD_CONF} if you believe this is a mistake!" exit 1 - fi + fi + del_ols_domain ${1} fi - del_ls_domain ${1} - del_ols_domain ${1} } check_input ${1}