From 3847f1ea577c8645b583b0c81fdd9863084499c4 Mon Sep 17 00:00:00 2001 From: qtwrk Date: Fri, 17 Jan 2020 15:54:43 +0100 Subject: [PATCH 1/7] fix permission --- cyberpanel.sh | 4 +- preUpgrade.sh | 110 ++------------------------------------------------ 2 files changed, 6 insertions(+), 108 deletions(-) diff --git a/cyberpanel.sh b/cyberpanel.sh index 8ad5ef0cb..ae557d56d 100644 --- a/cyberpanel.sh +++ b/cyberpanel.sh @@ -41,7 +41,7 @@ fi install_utility() { if [[ ! -f /usr/bin/cyberpanel_utility ]] ; then wget -q -O /usr/bin/cyberpanel_utility https://cyberpanel.sh/misc/cyberpanel_utility.sh -chmod +x 700 /usr/bin/cyberpanel_utility +chmod 700 /usr/bin/cyberpanel_utility fi if ! cat /root/.bashrc | grep -q cyberpanel_utility ; then @@ -59,7 +59,7 @@ fi watchdog_setup() { if [[ $WATCHDOG == "ON" ]] ; then wget -O /etc/cyberpanel/watchdog.sh https://$DOWNLOAD_SERVER/misc/watchdog.sh -chmod +x /etc/cyberpanel/watchdog.sh +chmod 700 /etc/cyberpanel/watchdog.sh ln -s /etc/cyberpanel/watchdog.sh /usr/local/bin/watchdog pid=$(ps aux | grep "watchdog lsws" | grep -v grep | awk '{print $2}') if [[ "$pid" == "" ]] ; then diff --git a/preUpgrade.sh b/preUpgrade.sh index d6e9a8dd7..f5eaf3fba 100644 --- a/preUpgrade.sh +++ b/preUpgrade.sh @@ -1,108 +1,6 @@ #!/bin/sh -SERVER_OS='Undefined' -OUTPUT=$(cat /etc/*release) - -echo -e "\nChecking OS..." -OUTPUT=$(cat /etc/*release) -if echo $OUTPUT | grep -q "CentOS Linux 7" ; then - echo -e "\nDetecting CentOS 7.X...\n" - SERVER_OS="CentOS7" - yum clean all - yum update -y -elif echo $OUTPUT | grep -q "CloudLinux 7" ; then - echo -e "\nDetecting CloudLinux 7.X...\n" - SERVER_OS="CentOS7" - yum clean all - yum update -y -elif echo $OUTPUT | grep -q "CentOS Linux 8" ; then - echo -e "\nDetecting CentOS 8.X...\n" - SERVER_OS="CentOS8" - yum clean all - yum update -y -elif echo $OUTPUT | grep -q "Ubuntu 18.04" ; then - echo -e "\nDetecting Ubuntu 18.04...\n" - SERVER_OS="Ubuntu" -else - cat /etc/*release - echo -e "\nUnable to detect your OS...\n" - echo -e "\nCyberPanel is supported on Ubuntu 18.04, CentOS 7.x, CentOS 8.x and CloudLinux 7.x...\n" - exit 1 -fi - -if [ $SERVER_OS = "CentOS7" ] ; then - yum -y install yum-utils - yum -y groupinstall development - yum -y install https://centos7.iuscommunity.org/ius-release.rpm - yum -y install python36u python36u-pip python36u-devel -elif [ $SERVER_OS = "CentOS8" ] ; then - yum install -y wget strace htop net-tools telnet curl which bc telnet htop libevent-devel gcc libattr-devel xz-devel mariadb-devel curl-devel git platform-python-devel tar - dnf --enablerepo=PowerTools install gpgme-devel -y - dnf install python3 -y -else - apt update -y - DEBIAN_FRONTEND=noninteractive apt upgrade -y - DEBIAN_FRONTEND=noninteracitve apt install -y htop telnet python-mysqldb python-dev libcurl4-gnutls-dev libgnutls28-dev libgcrypt20-dev libattr1 libattr1-dev liblzma-dev libgpgme-dev libmariadbclient-dev libcurl4-gnutls-dev libssl-dev nghttp2 libnghttp2-dev idn2 libidn2-dev libidn2-0-dev librtmp-dev libpsl-dev nettle-dev libgnutls28-dev libldap2-dev libgssapi-krb5-2 libk5crypto3 libkrb5-dev libcomerr2 libldap2-dev python-gpg python python-minimal python-setuptools virtualenv python-dev python-pip git - DEBIAN_FRONTEND=noninteractive apt install -y python3-pip - DEBIAN_FRONTEND=noninteractive apt install -y build-essential libssl-dev libffi-dev python3-dev - DEBIAN_FRONTEND=noninteractive apt install -y python3-venv -fi - -if [ $SERVER_OS = "Ubuntu" ] ; then - pip3 install virtualenv -else - pip3.6 install virtualenv -fi - -rm -rf /usr/local/CyberPanel -virtualenv -p /usr/bin/python3 --system-site-packages /usr/local/CyberPanel -rm -rf requirments.txt -wget https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/requirments.txt -. /usr/local/CyberPanel/bin/activate - -if [ $SERVER_OS = "Ubuntu" ] ; then - . /usr/local/CyberPanel/bin/activate - pip3 install --ignore-installed -r requirments.txt -else - source /usr/local/CyberPanel/bin/activate - pip3.6 install --ignore-installed -r requirments.txt -fi - -virtualenv -p /usr/bin/python3 --system-site-packages /usr/local/CyberPanel -rm -rf upgrade.py -wget https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/plogical/upgrade.py -/usr/local/CyberPanel/bin/python upgrade.py stable - -## - -virtualenv -p /usr/bin/python3 /usr/local/CyberCP -wget -O requirements.txt https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/requirments.txt - -if [ $SERVER_OS = "Ubuntu" ] ; then - . /usr/local/CyberCP/bin/activate - pip3 install --ignore-installed -r requirments.txt -else - source /usr/local/CyberCP/bin/activate - pip3.6 install --ignore-installed -r requirments.txt -fi - - -## - -rm -f wsgi-lsapi-1.4.tgz -rm -rf wsgi-lsapi-1.4 -wget http://www.litespeedtech.com/packages/lsapi/wsgi-lsapi-1.4.tgz -tar xf wsgi-lsapi-1.4.tgz -cd wsgi-lsapi-1.4 -/usr/local/CyberPanel/bin/python ./configure.py -make -cp lswsgi /usr/local/CyberCP/bin/ - -chmod 700 /usr/bin/adminPass - -## -systemctl restart lscpd - -echo "###################################################################" -echo " CyberPanel Upgraded " -echo "###################################################################" +rm -f /usr/local/cyberpanel_upgrade.sh +wget -O /usr/local/cyberpanel_upgrade.sh https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/cyberpanel_upgrade.sh 2>/dev/null +chmod 700 /usr/local/cyberpanel_upgrade.sh +/usr/local/cyberpanel_upgrade.sh From 1532590e791cfb10b6b6019ac879a626e7d79b00 Mon Sep 17 00:00:00 2001 From: qtwrk Date: Fri, 17 Jan 2020 16:01:24 +0100 Subject: [PATCH 2/7] user check --- cyberpanel_upgrade.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/cyberpanel_upgrade.sh b/cyberpanel_upgrade.sh index 42207ec38..976d63b25 100644 --- a/cyberpanel_upgrade.sh +++ b/cyberpanel_upgrade.sh @@ -1,8 +1,28 @@ #!/bin/bash +#CyberPanel Upgrade script +export LC_CTYPE=en_US.UTF-8 +SUDO_TEST=$(set) SERVER_OS='Undefined' OUTPUT=$(cat /etc/*release) +check_root() { +echo -e "\nChecking root privileges...\n" +if echo $SUDO_TEST | grep SUDO > /dev/null ; then + echo -e "\nYou are using SUDO , please run as root user...\n" + echo -e "If you don't have direct access to root user, please run \e[31msudo su -\e[39m command and then run upgrade command again." + exit +fi + +if [[ $(id -u) != 0 ]] > /dev/null; then + echo -e "\nYou must use root user to upgrade CyberPanel...\n" + exit +else + echo -e "\nYou are runing as root...\n" +fi +} + + check_return() { #check previous command result , 0 = ok , non-0 = something wrong. if [[ $? -eq "0" ]] ; then @@ -13,6 +33,8 @@ else fi } +check_root + echo -e "\nChecking OS..." OUTPUT=$(cat /etc/*release) if echo $OUTPUT | grep -q "CentOS Linux 7" ; then From 0e7321644b1a8029d16977bd68d9a363d5f4fd94 Mon Sep 17 00:00:00 2001 From: qtwrk Date: Sat, 18 Jan 2020 00:11:07 +0100 Subject: [PATCH 3/7] utility 2 --- cyberpanel.sh | 10 +++++++--- cyberpanel_upgrade.sh | 26 ++++++++++++++++++++++++++ cyberpanel_utility.sh | 12 +++--------- 3 files changed, 36 insertions(+), 12 deletions(-) diff --git a/cyberpanel.sh b/cyberpanel.sh index ae557d56d..38550d5d4 100644 --- a/cyberpanel.sh +++ b/cyberpanel.sh @@ -44,15 +44,19 @@ wget -q -O /usr/bin/cyberpanel_utility https://cyberpanel.sh/misc/cyberpanel_uti chmod 700 /usr/bin/cyberpanel_utility fi -if ! cat /root/.bashrc | grep -q cyberpanel_utility ; then +if ! cat /etc/bash.bashrc | grep -q cyberpanel_utility ; then echo -e "\n\ncyberpanel() { if [[ $1 == "utility" ]] ; then /usr/bin/cyberpanel_utility ${@:2:99} +elif [[ $1 == "help" ]] ; then +/usr/bin/cyberpanel_utility --help +elif [[ $1 == "upgrade" ]] || [[ $1 == "update" ]] ; then +/usr/bin/cyberpanel_utility --upgrade else /usr/bin/cyberpanel "$@" fi -}" >> /root/.bashrc -source /root/.bashrc +}" >> /etc/bash.bashrc +source /etc/bash.bashrc fi } diff --git a/cyberpanel_upgrade.sh b/cyberpanel_upgrade.sh index 976d63b25..a9c0eb124 100644 --- a/cyberpanel_upgrade.sh +++ b/cyberpanel_upgrade.sh @@ -6,6 +6,28 @@ SUDO_TEST=$(set) SERVER_OS='Undefined' OUTPUT=$(cat /etc/*release) +install_utility() { +if [[ ! -f /usr/bin/cyberpanel_utility ]] ; then +wget -q -O /usr/bin/cyberpanel_utility https://cyberpanel.sh/misc/cyberpanel_utility.sh +chmod 700 /usr/bin/cyberpanel_utility +fi + +if ! cat /etc/bash.bashrc | grep -q cyberpanel_utility ; then +echo -e "\n\ncyberpanel() { +if [[ $1 == "utility" ]] ; then +/usr/bin/cyberpanel_utility ${@:2:99} +elif [[ $1 == "help" ]] ; then +/usr/bin/cyberpanel_utility --help +elif [[ $1 == "upgrade" ]] || [[ $1 == "update" ]] ; then +/usr/bin/cyberpanel_utility --upgrade +else +/usr/bin/cyberpanel "$@" +fi +}" >> /etc/bash.bashrc +source /etc/bash.bashrc +fi +} + check_root() { echo -e "\nChecking root privileges...\n" if echo $SUDO_TEST | grep SUDO > /dev/null ; then @@ -147,6 +169,10 @@ cp lswsgi /usr/local/CyberCP/bin/ chmod 700 /usr/bin/adminPass +install_utility + + + ## systemctl restart lscpd diff --git a/cyberpanel_utility.sh b/cyberpanel_utility.sh index dcdcb6c6e..91758476f 100644 --- a/cyberpanel_utility.sh +++ b/cyberpanel_utility.sh @@ -20,7 +20,7 @@ if [[ $TMP_YN == "1" ]] ; then if [[ ! -f /etc/cyberpanel/watchdog.sh ]] ; then echo -e "\nWatchDog no found..." wget -O /etc/cyberpanel/watchdog.sh https://cyberpanel.sh/misc/watchdog.sh - chmod +x /etc/cyberpanel/watchdog.sh + chmod 700 /etc/cyberpanel/watchdog.sh ln -s /etc/cyberpanel/watchdog.sh /usr/local/bin/watchdog echo -e "\nWatchDos has been installed..." set_watchdog @@ -105,13 +105,13 @@ cyberpanel_upgrade() { echo -e "CyberPanel upgrading..." rm -f /usr/local/cyberpanel_upgrade.sh wget -O /usr/local/cyberpanel_upgrade.sh -q https://raw.githubusercontent.com/usmannasir/cyberpanel/$BRANCH_NAME/cyberpanel_upgrade.sh -chmod +x /usr/local/cyberpanel_upgrade.sh +chmod 700 /usr/local/cyberpanel_upgrade.sh /usr/local/cyberpanel_upgrade.sh rm -f /usr/local/cyberpanel_upgrade.sh exit } -get_faq() { +show_help() { echo -e "\nFetching information...\n" curl https://cyberpanel.sh/misc/faq.txt exit @@ -184,12 +184,6 @@ sudo_check() { fi } -show_help() { -echo -e "\nCyberPanel Utility Script" -echo -e "\nYou can use argument --upgrade to run CyberPanel upgrade without interaction for automated job." -echo -e "\nExample: cyberpanel utility --upgrade" -exit -} panel_check From 2757fe770f079d310ca2e88166c9a196b645f536 Mon Sep 17 00:00:00 2001 From: qtwrk Date: Sat, 18 Jan 2020 00:12:03 +0100 Subject: [PATCH 4/7] utility 3 --- cyberpanel_upgrade.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cyberpanel_upgrade.sh b/cyberpanel_upgrade.sh index a9c0eb124..8fc2c6cc5 100644 --- a/cyberpanel_upgrade.sh +++ b/cyberpanel_upgrade.sh @@ -169,7 +169,7 @@ cp lswsgi /usr/local/CyberCP/bin/ chmod 700 /usr/bin/adminPass -install_utility +#install_utility From 032637f4b071ee56305bcd3b516b2bfbc3dfd073 Mon Sep 17 00:00:00 2001 From: qtwrk Date: Mon, 20 Jan 2020 15:55:47 +0100 Subject: [PATCH 5/7] more preparation for utility --- .DS_Store | Bin 10244 -> 10244 bytes cyberpanel.sh | 21 ++--- cyberpanel_upgrade.sh | 20 +++-- cyberpanel_utility.sh | 180 +++++++++++++++++++++++++++++++++++++++++- faq.sh | 77 ++++++++++++++++++ 5 files changed, 278 insertions(+), 20 deletions(-) create mode 100644 faq.sh diff --git a/.DS_Store b/.DS_Store index 7aa1d3f5dd59f9ec714b993c91ec60ed40781603..76aef38aac911b3f08c17609d171d2d8f07aa6bb 100644 GIT binary patch delta 374 zcmZXO!Art$9L3*H7ZnJtkx+-wi$RCU(y>jDU`qu-aA0%|^-?fc+Jr))i_kULe_$}J-iBJ@g-wKEDAUgUQxv}9(F605BX4Sz75_qnK*dc#q6CEGyGdH zO}U_CS!j^gBG2a6zGI!sqeok3jX~R>@>uOL(V5i> /etc/bash.bashrc -source /etc/bash.bashrc +}" >> $BASH_PATH fi +#--COMMENTOUT-- + } watchdog_setup() { @@ -1251,7 +1254,7 @@ webadmin_passwd watchdog_setup -#install_utility +install_utility clear echo "###################################################################" diff --git a/cyberpanel_upgrade.sh b/cyberpanel_upgrade.sh index 8fc2c6cc5..f3f2990fd 100644 --- a/cyberpanel_upgrade.sh +++ b/cyberpanel_upgrade.sh @@ -12,19 +12,23 @@ wget -q -O /usr/bin/cyberpanel_utility https://cyberpanel.sh/misc/cyberpanel_uti chmod 700 /usr/bin/cyberpanel_utility fi -if ! cat /etc/bash.bashrc | grep -q cyberpanel_utility ; then +BASH_PATH="/root/.bashrc" + +if ! cat $BASH_PATH | grep -q cyberpanel_utility ; then echo -e "\n\ncyberpanel() { -if [[ $1 == "utility" ]] ; then -/usr/bin/cyberpanel_utility ${@:2:99} -elif [[ $1 == "help" ]] ; then +if [[ \$1 == \"utility\" ]] ; then +/usr/bin/cyberpanel_utility \${@:2:99} +elif [[ \$1 == \"help\" ]] ; then /usr/bin/cyberpanel_utility --help -elif [[ $1 == "upgrade" ]] || [[ $1 == "update" ]] ; then +elif [[ \$1 == \"upgrade\" ]] || [[ \$1 == \"update\" ]] ; then /usr/bin/cyberpanel_utility --upgrade else -/usr/bin/cyberpanel "$@" +/usr/bin/cyberpanel \"\$@\" fi -}" >> /etc/bash.bashrc -source /etc/bash.bashrc +}" >> $BASH_PATH + + +source $BASH_PATH fi } diff --git a/cyberpanel_utility.sh b/cyberpanel_utility.sh index 91758476f..c9e0e98bf 100644 --- a/cyberpanel_utility.sh +++ b/cyberpanel_utility.sh @@ -5,6 +5,29 @@ export LC_CTYPE=en_US.UTF-8 SUDO_TEST=$(set) BRANCH_NAME="stable" +check_OS() { +echo -e "\nChecking OS..." +OUTPUT=$(cat /etc/*release) +if echo $OUTPUT | grep -q "CentOS Linux 7" ; then + echo -e "\nDetecting CentOS 7.X...\n" + SERVER_OS="CentOS" +elif echo $OUTPUT | grep -q "CloudLinux 7" ; then + echo -e "\nDetecting CloudLinux 7.X...\n" + SERVER_OS="CentOS" +elif echo $OUTPUT | grep -q "CentOS Linux 8" ; then + echo -e "\nDetecting CentOS 8.X...\n" + SERVER_OS="CentOS" + CENTOS_8="True" +elif echo $OUTPUT | grep -q "Ubuntu 18.04" ; then + echo -e "\nDetecting Ubuntu 18.04...\n" + SERVER_OS="Ubuntu" +else + cat /etc/*release + echo -e "\nUnable to detect your OS...\n" + echo -e "\nCyberPanel is supported on Ubuntu 18.04, CentOS 7.x, CentOS 8.x and CloudLinux 7.x...\n" + exit 1 +fi +} set_watchdog() { echo -e "\nPlease choose:" @@ -102,6 +125,9 @@ rm -f /tmp/cyberpanel_utility.sh } cyberpanel_upgrade() { +echo -e "CyberPanel Upgrade will start in 10 seconds" +echo -e "If you want to cancel, please press CTRL + C to cancel it" +sleep 10 echo -e "CyberPanel upgrading..." rm -f /usr/local/cyberpanel_upgrade.sh wget -O /usr/local/cyberpanel_upgrade.sh -q https://raw.githubusercontent.com/usmannasir/cyberpanel/$BRANCH_NAME/cyberpanel_upgrade.sh @@ -113,12 +139,158 @@ exit show_help() { echo -e "\nFetching information...\n" -curl https://cyberpanel.sh/misc/faq.txt +curl --silent https://cyberpanel.sh/misc/faq.sh | sudo -u nobody bash exit } addons() { -echo -e "place holder" + echo -e "\nPlease choose:" + echo -e "\n1. Install Memcached extension for PHP." + echo -e "\n2. Install Memcached server." + echo -e "\n3. Install Redis extension for PHP." + echo -e "\n4. Install Redis server." + echo -e "\n5. Back to Main Menu.\n" + printf "%s" "Please enter number [1-5]: " + read TMP_YN + + if [[ $TMP_YN == "1" ]] ; then + install_php_memcached + elif [[ $TMP_YN == "2" ]] ; then + install_memcached + elif [[ $TMP_YN == "3" ]]; then + install_php_redis + elif [[ $TMP_YN == "4" ]] ; then + install_redis + elif [[ $TMP_YN == "5" ]] ; then + main_page + else + echo -e " Please enter the right number [1-5]\n" + exit + fi +} + +install_php_redis() { + if [[ $SERVER_OS == "CentOS" ]] ; then + yum install -y lsphp74-redis lsphp73-redis lsphp72-redis lsphp71-redis lsphp70-redis lsphp56-redis lsphp55-redis lsphp54-redis + fi + if [[ $SERVER_OS == "Ubuntu" ]] ; then + DEBIAN_FRONTEND=noninteractive apt install -y lsphp74-redis lsphp73-redis lsphp72-redis lsphp71-redis lsphp70-redis + fi + echo -e "\nRedis extension for PHP has been installed..." + exit +} + +install_redis() { + if [[ -f /usr/bin/redis-cli ]] ; then + echo -e "\nRedis is already installed..." + fi + if [[ ! -f /usr/bin/redis-cli ]] && [[ $SERVER_OS == "CentOS" ]] ; then + yum install -y redis + fi + if [[ ! -f /usr/bin/redis-cli ]] && [[ $SERVER_OS == "Ubuntu" ]] ; then + DEBIAN_FRONTEND=noninteractive apt install -y redis + fi + if ifconfig -a | grep inet6 ; then + echo -e "\n IPv6 detected..." + else + if [[ $SERVER_OS == "Ubuntu" ]] ; then + sed -i 's|bind 127.0.0.1 ::1|bind 127.0.0.1|g' /etc/redis/redis.conf + #remove ipv6 binding to prevent Redis fail to start. + fi + echo -e "\n no IPv6 detected..." + fi + + if systemctl is-active --quiet redis ; then + systemctl status redis + else + systemctl enable redis + systemctl start redis + systemctl status redis + fi +} + +install_memcached() { +echo -e "\n Would you like to install Memcached or LiteSpeed Mmecached ?" +echo -e "\n 1. LiteSpeed Memcached" +echo -e "\n 2. Memcached" +echo -e "\n 3. Back to Main Menu\n" +printf "%s" "Please enter number [1-3]: " +read TMP_YN + + if [[ $TMP_YN == "1" ]] ; then + if systemctl is-active --quiet memcached ; then + echo -e "\nIt seems Memcached server is already running..." + systemctl status memcached + exit + fi + if [[ -f /usr/local/lsmcd/bin/lsmcd ]] ; then + echo -e "\nLiteSpeed Memcached is already installed..." + else + if [[ $SERVER_OS == "CentOS" ]] ; then + yum groupinstall "Development Tools" -y + yum install autoconf automake zlib-devel openssl-devel expat-devel pcre-devel libmemcached-devel cyrus-sasl* -y + elif [[ $SERVER_OS == "Ubuntu" ]] ; then + DEBIAN_FRONTEND=noninteractive apt install build-essential zlib1g-dev libexpat1-dev openssl libssl-dev libsasl2-dev libpcre3-dev git -y + fi + wget https://cdn.cyberpanel.sh/litespeed/lsmcd.tar.gz + tar xzvf lsmcd.tar.gz + DIR=$(pwd) + cd $DIR/lsmcd + ./fixtimestamp.sh + ./configure CFLAGS=" -O3" CXXFLAGS=" -O3" + make + make install + cd $DIR + fi + if systemctl is-active --quiet lsmcd ; then + systemctl status lsmcd + else + systemctl enable lsmcd + systemctl start lsmcd + systemctl status lsmcd + fi + + elif [[ $TMP_YN == "2" ]] ; then + if systemctl is-active --quiet lsmcd ; then + echo -e "\nIt seems LiteSpeed Memcached server is already running..." + systemctl status lsmcd + exit + fi + if [[ -f /usr/bin/memcached ]] ; then + echo -e "\nMemcached is already installed..." + fi + if [[ ! -f /usr/bin/memcached ]] && [[ $SERVER_OS == "CentOS" ]] ; then + yum install memcached -y + sed -i 's|OPTIONS=""|OPTIONS="-l 127.0.0.1 -U 0"|g' /etc/sysconfig/memcached + #this will disbale UDP and bind to 127.0.0.1 to prevent UDP amplification attack + fi + if [[ ! -f /usr/bin/memcached ]] && [[ $SERVER_OS == "Ubuntu" ]] ; then + DEBIAN_FRONTEND=noninteractive apt install memcached -y + fi + if systemctl is-active --quiet memcached ; then + systemctl status memcached + else + systemctl enable memcached + systemctl start memcached + systemctl status memcached + fi + elif [[ $TMP_YN == "3" ]] ; then + main_page + else + echo -e " Please enter the right number [1-3]\n" + exit + fi +} + +install_php_memcached() { + if [[ $SERVER_OS == "CentOS" ]] ; then + yum install -y lsphp74-memcached lsphp73-memcached lsphp72-memcached lsphp71-memcached lsphp70-memcached lsphp56-pecl-memcached lsphp55-pecl-memcached lsphp54-pecl-memcached + fi + if [[ $SERVER_OS == "Ubuntu" ]] ; then + DEBIAN_FRONTEND=noninteractive apt install -y lsphp74-memcached lsphp73-memcached lsphp72-memcached lsphp71-memcached lsphp70-memcached + fi + echo -e "\nMemcached extension for PHP has been installed..." + exit } main_page() { @@ -148,7 +320,7 @@ case "$num" in set_watchdog ;; 4) - get_faq + show_help ;; 5) exit @@ -189,6 +361,8 @@ panel_check sudo_check +check_OS + self_check diff --git a/faq.sh b/faq.sh new file mode 100644 index 000000000..414ea980d --- /dev/null +++ b/faq.sh @@ -0,0 +1,77 @@ +#!/bin/bash + + +RED='\033[0;31m' +GREEN='\033[0;32m' +BLUE='\033[0;34m' +PURPLE='\033[0;35m' +NC='\033[0m' # No Color + +#${RED}text${NC} +#${GREEN} ${BLUE} + + +echo -e "Frequently Asked Question + +${PURPLE}1.${NC} How to reset CyberPanel admin password? + +execute command ${RED}adminPass YOUR_NEW_PASSWORD${NC} + +${BLUE}------------------------------------------------------------${NC} + +${PURPLE}2.${NC} How to reset LiteSpeed WebAdmin Console user/password ? + +execute command ${RED}/usr/local/lsws/admin/misc/admpass.sh${NC} + +${BLUE}------------------------------------------------------------${NC} + +${PURPLE}3.${NC} How to access LiteSpeed webadmin console ? + +Please check this post: ${GREEN}https://forums.cyberpanel.net/discussion/87/tutorial-how-to-setup-and-login-to-openlitespeed-webadmin-console/p1${NC} + +${BLUE}------------------------------------------------------------${NC} + +${PURPLE}4.${NC} What is MariaDB root password ? + +execute command ${RED}cat /etc/cyberpanel/mysqlPassword${NC} will show you the root password + +${BLUE}------------------------------------------------------------${NC} + +${PURPLE}5.${NC} Can I change MariaDB root passwod ? + +Yes , but after you changed , please make sure you have updated the password in following 2 files as well + +${RED}/etc/cyberpanel/mysqlPassword${NC} + +${RED}/usr/local/CyberCP/CyberCP/settings.py${NC} + +otherwise CyberPanel will not have access to database. + +${BLUE}------------------------------------------------------------${NC} + +${PURPLE}6.${NC} How to raise upload limit for cyberpanel's phpMyAdmin and File Manager? + +edit file ${RED}/usr/local/lsws/lsphp73/etc/php.ini${NC} for CentOS + +${RED}/usr/local/lsws/lsphp73/etc/php/7.3/litespeed/php.ini${NC} for Ubbuntu + +find 2 configurations: + +${RED}post_max_size${NC} and ${RED}upload_max_filesize${NC} , change from to higher number, e.g. ${RED}100M${NC} (don't miss the M) + +and then run ${RED}pkill lsphp${NC} to kill all current php process for new configuration to take effect. + +${BLUE}------------------------------------------------------------${NC} + +${PURPLE}7.${NC} How to add more IPs to my website(s) ? + +For OpenLiteSpeed, please check this post: ${GREEN}https://forums.cyberpanel.net/discussion/126/tutorial-how-to-add-2nd-ip-for-websites/p1${NC} + +For LiteSpeed Enterprise, please check this post: ${GREEN}https://forums.cyberpanel.net/discussion/3745/tutorial-how-to-add-2nd-ip-for-litespeed-enterprise/p1${NC} + +${BLUE}------------------------------------------------------------${NC} + +${PURPLE}8.${NC} How to remove 8090 port in CyberPanel URL ? + +Please check this post ${GREEN}https://blog.cyberpanel.net/2018/12/25/how-to-remove-port-8090-from-cyberpanel/${NC} +" From 1a530f3e6359247b394f84205400adb97ee79563 Mon Sep 17 00:00:00 2001 From: qtwrk Date: Mon, 20 Jan 2020 17:25:55 +0100 Subject: [PATCH 6/7] fix sudo: unable to resolve host warning --- cyberpanel.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cyberpanel.sh b/cyberpanel.sh index e5a8c855c..83f2f0c21 100644 --- a/cyberpanel.sh +++ b/cyberpanel.sh @@ -394,6 +394,13 @@ fi system_tweak() { + +server_name=$(hostname) + +echo "127.0.0.1 $server_name +$(cat /etc/hosts)" > /etc/hosts +#this should address on "sudo: unable to resolve host ..." on Ubuntu , it's not issue but annoying. + if [[ $SERVER_OS == "CentOS" ]] ; then setenforce 0 sed -i 's/SELINUX=enforcing/SELINUX=permissive/g' /etc/selinux/config From 69c60db3e79181483e4dbef9df1cf55e3d71f9b4 Mon Sep 17 00:00:00 2001 From: qtwrk Date: Mon, 20 Jan 2020 21:34:25 +0100 Subject: [PATCH 7/7] ftp bug fix --- cyberpanel_upgrade.sh | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/cyberpanel_upgrade.sh b/cyberpanel_upgrade.sh index f3f2990fd..af932faf1 100644 --- a/cyberpanel_upgrade.sh +++ b/cyberpanel_upgrade.sh @@ -11,25 +11,6 @@ if [[ ! -f /usr/bin/cyberpanel_utility ]] ; then wget -q -O /usr/bin/cyberpanel_utility https://cyberpanel.sh/misc/cyberpanel_utility.sh chmod 700 /usr/bin/cyberpanel_utility fi - -BASH_PATH="/root/.bashrc" - -if ! cat $BASH_PATH | grep -q cyberpanel_utility ; then -echo -e "\n\ncyberpanel() { -if [[ \$1 == \"utility\" ]] ; then -/usr/bin/cyberpanel_utility \${@:2:99} -elif [[ \$1 == \"help\" ]] ; then -/usr/bin/cyberpanel_utility --help -elif [[ \$1 == \"upgrade\" ]] || [[ \$1 == \"update\" ]] ; then -/usr/bin/cyberpanel_utility --upgrade -else -/usr/bin/cyberpanel \"\$@\" -fi -}" >> $BASH_PATH - - -source $BASH_PATH -fi } check_root() { @@ -173,6 +154,11 @@ cp lswsgi /usr/local/CyberCP/bin/ chmod 700 /usr/bin/adminPass +if [[ -f /etc/pure-ftpd/pure-ftpd.conf ]] ; then +sed -i 's|NoAnonymous no|NoAnonymous yes|g' /etc/pure-ftpd/pure-ftpd.conf +fi + + #install_utility