From 2f41cdbc16789d25b220bd81592e52d15369296c Mon Sep 17 00:00:00 2001 From: qtwrk Date: Tue, 11 Feb 2020 17:16:51 +0100 Subject: [PATCH 1/8] DB name/user length check --- CPScripts/EasyEngine/EasyEngine-migration.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/CPScripts/EasyEngine/EasyEngine-migration.sh b/CPScripts/EasyEngine/EasyEngine-migration.sh index c029e5e8b..d807447ca 100644 --- a/CPScripts/EasyEngine/EasyEngine-migration.sh +++ b/CPScripts/EasyEngine/EasyEngine-migration.sh @@ -397,6 +397,16 @@ echo -e "\nNo file on this server will be touched.\n" read -rsn1 -p "Please press any key to continue..." } +db_length_check() { + ssh_v="ssh -o StrictHostKeyChecking=no root@$server_ip -p$server_port -i /root/.ssh/cyberpanel_migration_key" + output=$($ssh_v "$sudoer cat /usr/local/CyberCP/plogical/mysqlUtilities.py") + if echo $output | grep -q "should be 16 at max" ; then + echo -e "\nPlease upgrade your CyberPanel to latest first..." + clean_up + exit + fi +} + check_dir #check if this is an easyengine server and create a temp dir for storing files during the process. @@ -429,9 +439,10 @@ echo -e "\n\nchecking necessary package..." fi fetch_cyberpanel_key - #function to get cyberpanel server key so future SSH command won't require password input. +db_length_check + tLen=${#domains[@]} #get the domain list and number of domains. From 545041cc4b1f849affbcdc27db8bd033e9880361 Mon Sep 17 00:00:00 2001 From: qtwrk Date: Tue, 11 Feb 2020 17:27:11 +0100 Subject: [PATCH 2/8] add wp cli check/install --- CPScripts/EasyEngine/EasyEngine-migration.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CPScripts/EasyEngine/EasyEngine-migration.sh b/CPScripts/EasyEngine/EasyEngine-migration.sh index d807447ca..81357b083 100644 --- a/CPScripts/EasyEngine/EasyEngine-migration.sh +++ b/CPScripts/EasyEngine/EasyEngine-migration.sh @@ -329,8 +329,16 @@ fi install_lscwp() { ssh_v="ssh -o StrictHostKeyChecking=no root@$server_ip -p$server_port -i /root/.ssh/cyberpanel_migration_key" + +$ssh_v "ls -l /usr/bin/wp" +if [[ $? != "0" ]] ; then + $ssh_v "$sudoer wget -O /usr/bin/wp https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar" + $ssh_v "$sudoer chmod +x /usr/bin/wp" +fi +#install WP CLI if not yet installed. $ssh_v "sudo -u $owner_user -i -- wp --path=/home/${domains[$i]}/public_html plugin install litespeed-cache" echo -e "\nInstalling LiteSpeed Cache for WordPress..." + } export_database() { From 562584a9f2009d8376d828b2e6f0e9ac7bb5be3a Mon Sep 17 00:00:00 2001 From: qtwrk Date: Mon, 17 Feb 2020 13:18:02 +0100 Subject: [PATCH 3/8] openvz pid file --- cyberpanel.sh | 63 +++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 51 insertions(+), 12 deletions(-) diff --git a/cyberpanel.sh b/cyberpanel.sh index f34aa98f1..ca9468e34 100644 --- a/cyberpanel.sh +++ b/cyberpanel.sh @@ -4,15 +4,6 @@ SUDO_TEST=$(set) -export LC_CTYPE=en_US.UTF-8 -export LC_ALL=en_US.UTF-8 -if [[ $? != "0" ]] ; then - apt upgrade - DEBIAN_FRONTEND=noninteractive apt install -y locales - locale-gen "en_US.UTF-8" - update-locale LC_ALL="en_US.UTF-8" -fi - DEV="OFF" BRANCH="stable" POSTFIX_VARIABLE="ON" @@ -35,6 +26,7 @@ TOTAL_RAM=$(free -m | awk '/Mem\:/ { print $2 }') CENTOS_8="False" WATCHDOG="OFF" BRANCH_NAME="v${TEMP:12:3}.${TEMP:25:1}" +VIRT_TYPE="" check_return() { #check previous command result , 0 = ok , non-0 = something wrong. @@ -110,14 +102,46 @@ echo ${WEBADMIN_PASS} > /etc/cyberpanel/webadmin_passwd chmod 600 /etc/cyberpanel/webadmin_passwd } +openvz_change() { +if [[ $VIRT_TYPE == "OpenVZ" ]] ; then + if [[ ! -d /etc/systemd/system/pure-ftpd.service.d ]] ; then + mkdir /etc/systemd/system/pure-ftpd.service.d + echo "[Service] +PIDFile=/run/pure-ftpd.pid" > /etc/systemd/system/pure-ftpd.service.d/override.conf + echo -e "PureFTPd service file modified for OpenVZ..." + fi + + if [[ ! -d /etc/systemd/system/lshttpd.service.d ]] ; then + mkdir /etc/systemd/system/lshttpd.service.d + echo "[Service] +PIDFile=/tmp/lshttpd/lshttpd.pid" > /etc/systemd/system/lshttpd.service.d/override.conf + echo -e "LiteSPeed service file modified for OpenVZ..." + fi + + if [[ ! -d /etc/systemd/system/spamassassin.service.d ]] ; then + mkdir /etc/systemd/system/spamassassin.service.d + echo "[Service] +PIDFile=/run/spamassassin.pid" > /etc/systemd/system/spamassassin.service.d/override.conf + echo -e "SpamAssassin service file modified for OpenVZ..." + fi + +fi +} + check_virtualization() { echo -e "Checking virtualization type..." -if hostnamectl | grep "Virtualization: lxc" ; then +if hostnamectl | grep -q "Virtualization: lxc" ; then echo -e "\nLXC detected..." echo -e "CyberPanel does not support LXC" echo -e "Exiting..." exit fi + +if hostnamectl | grep -q "Virtualization: openvz" ; then + echo -e "\nOpenVZ detected..." + VIRT_TYPE="OpenVZ" + openvz_change +fi } license_validation() { @@ -168,7 +192,7 @@ sed -i 's|cyberpanel.sh|'$DOWNLOAD_SERVER'|g' install.py sed -i 's|mirror.cyberpanel.net|'$DOWNLOAD_SERVER'|g' install.py sed -i 's|git clone https://github.com/usmannasir/cyberpanel|echo downloaded|g' install.py #change to CDN first, regardless country -sed -i 's|http://|https://|g' install.py +#sed -i 's|http://|https://|g' install.py if [[ $PROVIDER == "Alibaba Cloud" ]] ; then if ! grep -q "100.100.2.136" /etc/resolv.conf ; then @@ -1099,6 +1123,9 @@ if [[ $debug == "0" ]] ; then fi if [[ $debug == "1" ]] ; then + wget -O requirements.txt https://raw.githubusercontent.com/usmannasir/cyberpanel/$BRANCH_NAME/requirments.txt + /usr/local/CyberPanel/bin/pip3 install --ignore-installed -r requirements.txt + rm -f requirements.txt /usr/local/CyberPanel/bin/python install.py $SERVER_IP $SERIAL_NO $LICENSE_KEY --postfix $POSTFIX_VARIABLE --powerdns $POWERDNS_VARIABLE --ftp $PUREFTPD_VARIABLE if grep "CyberPanel installation successfully completed" /var/log/installLogs.txt > /dev/null; then @@ -1119,6 +1146,16 @@ fi } pip_virtualenv() { +if [[ $SERVER_OS == "Ubuntu" ]] ; then +DEBIAN_FRONTEND=noninteractive apt install -y locales +locale-gen "en_US.UTF-8" +update-locale LC_ALL="en_US.UTF-8" +fi + +export LC_CTYPE=en_US.UTF-8 +export LC_ALL=en_US.UTF-8 +#need to set lang to address some pip module installation issue. + if [[ $DEV == "OFF" ]] ; then if [[ $SERVER_COUNTRY == "CN" ]] ; then mkdir /root/.config @@ -1593,8 +1630,10 @@ fi SECONDS=0 install_required +openvz_change + pip_virtualenv system_tweak -main_install \ No newline at end of file +main_install From 175d3efa4f17a21313ddde31921310153a6ad45b Mon Sep 17 00:00:00 2001 From: qtwrk Date: Mon, 17 Feb 2020 16:06:45 +0100 Subject: [PATCH 4/8] mirror libzip --- cyberpanel.sh | 4 ++-- cyberpanel_upgrade.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cyberpanel.sh b/cyberpanel.sh index ca9468e34..02dbea122 100644 --- a/cyberpanel.sh +++ b/cyberpanel.sh @@ -1373,8 +1373,8 @@ if [[ ! -f /usr/local/lsws/lsphp74/lib64/php/modules/zip.so ]] && [[ $SERVER_OS if [[ $? == "0" ]] ; then yum remove -y libzip-devel fi - yum install -y http://packages.psychotic.ninja/7/plus/x86_64/RPMS/libzip-0.11.2-6.el7.psychotic.x86_64.rpm - yum install -y http://packages.psychotic.ninja/7/plus/x86_64/RPMS/libzip-devel-0.11.2-6.el7.psychotic.x86_64.rpm + yum install -y https://$DOWNLOAD_SERVER/libzip-0.11.2-6.el7.psychotic.x86_64.rpm + yum install -y https://$DOWNLOAD_SERVER/misc/libzip-devel-0.11.2-6.el7.psychotic.x86_64.rpm /usr/local/lsws/lsphp74/bin/pecl install zip echo "extension=zip.so" > /usr/local/lsws/lsphp74/etc/php.d/20-zip.ini chmod 755 /usr/local/lsws/lsphp74/lib64/php/modules/zip.so diff --git a/cyberpanel_upgrade.sh b/cyberpanel_upgrade.sh index 311114562..4649929c2 100644 --- a/cyberpanel_upgrade.sh +++ b/cyberpanel_upgrade.sh @@ -227,8 +227,8 @@ if [[ ! -f /usr/local/lsws/lsphp74/lib64/php/modules/zip.so ]] && [[ $SERVER_OS yum remove -y libzip-devel fi - yum install -y http://packages.psychotic.ninja/7/plus/x86_64/RPMS/libzip-0.11.2-6.el7.psychotic.x86_64.rpm - yum install -y http://packages.psychotic.ninja/7/plus/x86_64/RPMS/libzip-devel-0.11.2-6.el7.psychotic.x86_64.rpm + yum install -y https://cdn.cyberpanel.sh/misc/libzip-0.11.2-6.el7.psychotic.x86_64.rpm + yum install -y https://cdn.cyberpanel.sh/misc/libzip-devel-0.11.2-6.el7.psychotic.x86_64.rpm yum install lsphp74-devel if [[ ! -d /usr/local/lsws/lsphp74/tmp ]] ; then From 6595016fff740533e5b1a5ab082f071b10130d57 Mon Sep 17 00:00:00 2001 From: qtwrk Date: Tue, 18 Feb 2020 22:13:38 +0100 Subject: [PATCH 5/8] update some FAQs --- faq.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/faq.sh b/faq.sh index b068f6fbb..454101017 100644 --- a/faq.sh +++ b/faq.sh @@ -80,4 +80,29 @@ ${BLUE}------------------------------------------------------------${NC} ${PURPLE}9.${NC} How to enable Auto-Index for my site ? Please check this post ${GREEN}https://forums.cyberpanel.net/discussion/3850/tutorial-how-to-enable-auto-index-on-openlitespeed-and-litespeed-enterprise${NC} + +${BLUE}------------------------------------------------------------${NC} + +${PURPLE}10.${NC} How to add additional headers for my website ? + +Please check this post ${GREEN}https://openlitespeed.org/kb/how-to-set-up-custom-headers/${NC} + +${BLUE}------------------------------------------------------------${NC} + +${PURPLE}11.${NC} How to mimic Apache deny/allow directive ? + +Please check this post ${GREEN}https://openlitespeed.org/kb/access-control/${NC} + +${BLUE}------------------------------------------------------------${NC} + +${PURPLE}12.${NC} How to fix max_allowed_packet error ? + +You may see this error when your PHP script requires a larger packet size + +add following code into ${RED}/etc/my.cnf${NC} + +${GREEN}[mysqld] +max_allowed_packet=500M${NC} + +and then restart MariaDB by command ${RED}systemctl restart mariadb${NC} " From a0da026552e5be78882739a7948963ab4b241531 Mon Sep 17 00:00:00 2001 From: qtwrk Date: Wed, 19 Feb 2020 23:50:34 +0100 Subject: [PATCH 6/8] set watchdog default on and update some help info --- cyberpanel.sh | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/cyberpanel.sh b/cyberpanel.sh index 02dbea122..95ced4872 100644 --- a/cyberpanel.sh +++ b/cyberpanel.sh @@ -1082,10 +1082,10 @@ fi echo -e "\nWould you like to set up a WatchDog \e[31m(beta)\e[39m for Web service and Database service ?" echo -e "The watchdog script will be automatically started up after installation and server reboot" echo -e "If you want to kill the watchdog , run \e[31mwatchdog kill\e[39m" -echo -e "Please type Yes or no (with capital \e[31mY\e[39m):" +echo -e "Please type Yes or no (with capital \e[31mY\e[39m, default Yes):" printf "%s" read TMP_YN -if [[ $TMP_YN == "Yes" ]] ; then +if [[ $TMP_YN == "Yes" ]] || [[ $TMP_YN == "" ]] ; then WATCHDOG="ON" else WATCHDOG="OFF" @@ -1398,12 +1398,9 @@ echo " Panel password: $ADMIN_PASS " echo " WebAdmin console username: admin " echo " WebAdmin console password: $WEBADMIN_PASS " echo " " -echo " Please change your default admin password " -echo " If you need to reset your panel password, please run: " -echo " adminPass YOUR_NEW_PASSWORD " -echo " " -echo " If you change mysql password, please modify file in " -echo -e " \e[31m/etc/cyberpanel/mysqlPassword\e[39m with new password as well " +echo -e " Run \e[31mcyberpanel help\e[39m to get FAQ info" +echo -e " Run \e[31mcyberpanel upgrade\e[39m to upgrade it to latest version." +echo -e " Run \e[31mcyberpanel utility\e[39m to access some handy tools ." echo " " echo " Website : https://www.cyberpanel.net " echo " Forums : https://forums.cyberpanel.net " From c6d0298f03dc19f7df909f50d69eea2539de7268 Mon Sep 17 00:00:00 2001 From: qtwrk Date: Thu, 20 Feb 2020 23:28:44 +0100 Subject: [PATCH 7/8] faq update and link fix --- cyberpanel.sh | 2 +- faq.sh | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cyberpanel.sh b/cyberpanel.sh index 95ced4872..9ebbf9f01 100644 --- a/cyberpanel.sh +++ b/cyberpanel.sh @@ -1373,7 +1373,7 @@ if [[ ! -f /usr/local/lsws/lsphp74/lib64/php/modules/zip.so ]] && [[ $SERVER_OS if [[ $? == "0" ]] ; then yum remove -y libzip-devel fi - yum install -y https://$DOWNLOAD_SERVER/libzip-0.11.2-6.el7.psychotic.x86_64.rpm + yum install -y https://$DOWNLOAD_SERVER/misc/libzip-0.11.2-6.el7.psychotic.x86_64.rpm yum install -y https://$DOWNLOAD_SERVER/misc/libzip-devel-0.11.2-6.el7.psychotic.x86_64.rpm /usr/local/lsws/lsphp74/bin/pecl install zip echo "extension=zip.so" > /usr/local/lsws/lsphp74/etc/php.d/20-zip.ini diff --git a/faq.sh b/faq.sh index 454101017..519e6389d 100644 --- a/faq.sh +++ b/faq.sh @@ -105,4 +105,10 @@ ${GREEN}[mysqld] max_allowed_packet=500M${NC} and then restart MariaDB by command ${RED}systemctl restart mariadb${NC} + +${BLUE}------------------------------------------------------------${NC} + +${PURPLE}13.${NC} How to enable PHP error log ? + +Please check this post ${GREEN}https://forums.cyberpanel.net/discussion/3977/tutorial-how-to-enable-php-error-log/p1${NC} " From f6b94c4ec137bb5b7a11d2ac592b5ab9ea988876 Mon Sep 17 00:00:00 2001 From: qtwrk Date: Fri, 21 Feb 2020 14:08:42 +0100 Subject: [PATCH 8/8] fix php.ini & issue --- cyberpanel.sh | 4 ++++ cyberpanel_upgrade.sh | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/cyberpanel.sh b/cyberpanel.sh index 9ebbf9f01..14afc9e2d 100644 --- a/cyberpanel.sh +++ b/cyberpanel.sh @@ -1381,6 +1381,10 @@ if [[ ! -f /usr/local/lsws/lsphp74/lib64/php/modules/zip.so ]] && [[ $SERVER_OS fi #fix the lsphp74-zip missing issue. + if [[ $SERVER_OS == "CentOS" ]] ; then + sed -i 's|error_reporting = E_ALL \& ~E_DEPRECATED \& ~E_STRICT|error_reporting = E_ALL \& ~E_DEPRECATED \& ~E_STRICT|g' /usr/local/lsws/{lsphp72,lsphp73}/etc/php.ini + fi +#fix php.ini & issue clear echo "###################################################################" diff --git a/cyberpanel_upgrade.sh b/cyberpanel_upgrade.sh index 4649929c2..b143bafa1 100644 --- a/cyberpanel_upgrade.sh +++ b/cyberpanel_upgrade.sh @@ -208,6 +208,10 @@ fi install_utility if [[ $SERVER_OS == "CentOS7" ]] ; then + +sed -i 's|error_reporting = E_ALL \& ~E_DEPRECATED \& ~E_STRICT|error_reporting = E_ALL \& ~E_DEPRECATED \& ~E_STRICT|g' /usr/local/lsws/{lsphp72,lsphp73}/etc/php.ini +#fix php.ini & issue + yum list installed lsphp74-devel if [[ $? != "0" ]] ; then yum install -y lsphp74-devel