Merge branch 'v2.3.3-dev' of https://github.com/usmannasir/cyberpanel into v2.3.3-dev

This commit is contained in:
Hassan Hashmi
2022-06-27 12:15:13 +05:00
15 changed files with 213 additions and 92 deletions

View File

@@ -5,7 +5,7 @@ class CLMain():
self.path = '/usr/local/CyberCP/version.txt'
#versionInfo = json.loads(open(self.path, 'r').read())
self.version = '2.3'
self.build = '1'
self.build = '2'
ipFile = "/etc/cyberpanel/machineIP"
f = open(ipFile)

View File

@@ -76,7 +76,7 @@
<!-- HELPERS -->
{% with version="2.1.2" %}
{% with version="2.3.2" %}
<link rel="stylesheet" type="text/css" href="{% static 'baseTemplate/assets/finalBase/finalBase.css' %}">

View File

@@ -19,7 +19,7 @@ from plogical.httpProc import httpProc
# Create your views here.
VERSION = '2.3'
BUILD = 1
BUILD = 2
@ensure_csrf_cookie

View File

@@ -5,8 +5,8 @@
#set -u
#CyberPanel installer script for CentOS 7.X, CentOS 8.X, CloudLinux 7.X, RockyLinux 8.X, Ubuntu 18.04, Ubuntu 20.04 , Ubuntu 20.10 and AlmaLinux 8.X
#For whoever may edit this script, please follow :
#CyberPanel installer script for CentOS 7, CentOS 8, CloudLinux 7, AlmaLinux 8, RockyLinux 8, Ubuntu 18.04, Ubuntu 20.04, Ubuntu 20.10, openEuler 20.03 and openEuler 22.03
#For whoever may edit this script, please follow:
#Please use Pre_Install_xxx() and Post_Install_xxx() if you want to something respectively before or after the panel installation
#and update below accordingly
#Please use variable/functions name as MySomething or My_Something, and please try not to use too-short abbreviation :)
@@ -16,13 +16,13 @@
#Set_Default_Variables() ---> set some default variable for later use
#Check_Root() ---> check for root
#Check_Server_IP() ---> check for server IP and geolocation at country level
#Check_OS() ---> check system , support on centos7/8, rockylinux 8.x , almalinux 8.x ubutnu18/20 and cloudlinux 7 , 8 is untested.
#Check_OS() ---> check system , support on CentOS 7/8, RockyLinux 8, AlmaLinux 8, Ubuntu 18/20, openEuler 20.03/22.03 and CloudLinux 7, 8 is untested.
#Check_Virtualization() ---> check for virtualizaon , #LXC not supported# , some edit needed on OVZ
#Check_Panel() ---> check to make sure no other panel is installed
#Check_Process() ---> check no other process like Apache is running
#Check_Provider() ---> check the provider, certain provider like Alibaba or Tencent Yun may need some special change
#Check_Provider() ---> check the provider, certain provider like Alibaba or Tencent Cloud may need some special change
#Check_Argument() ---> parse argument and go to Argument_Mode() or Interactive_Mode() respectively
#Pre_Install_Setup_Repository() ---> setup/install repositories for centos system.
#Pre_Install_Setup_Repository() ---> setup/install repositories for CentOS and openEuler system.
#go to Pre_Install_Setup_CN_Repository() if server is within China.
#Pre_Install_Setup_Git_URL() ---> form up github URL , use Gitee for servers within China.
#Pre_Install_Required_Components() ---> install required softwares and git clone it
@@ -33,7 +33,7 @@
#Post_Install_Required_Components() ---> install some required softwares.
#Post_Install_PHP_Session_Setup() ---> set up PHP session
#Post_Install_PHP_TimezoneDB() ---> set up PHP timezoneDB
#Post_Install_Regenerate_Cert() ---> regenerate cert for :7080 and :8090 to avoid Chrome on MacOS blocking.
#Post_Install_Regenerate_Cert() ---> regenerate cert for :7080 and :8090 to avoid Chrome on macOS blocking.
#Post_Install_Regenerate_Webadmin_Console_Passwd() ---> regenerate the webadmin console password
#Post_Install_Setup_Watchdog() ---> set up watchdog script for webserver and MariaDB.
#Post_Install_Setup_Utility() ---> set up utility script for some handy features
@@ -252,7 +252,6 @@ else
exit
fi
if ! uname -m | grep -q x86_64 ; then
echo -e "x86_64 system is required...\n"
exit
@@ -268,22 +267,24 @@ elif grep -q -E "Rocky Linux" /etc/os-release ; then
Server_OS="RockyLinux"
elif grep -q -E "Ubuntu 18.04|Ubuntu 20.04|Ubuntu 20.10|Ubuntu 22.04" /etc/os-release ; then
Server_OS="Ubuntu"
elif grep -q -E "openEuler 20.03|openEuler 22.03" /etc/os-release ; then
Server_OS="openEuler"
else
echo -e "Unable to detect your system..."
echo -e "\nCyberPanel is supported on Ubuntu 18.04 x86_64, Ubuntu 20.04 x86_64, Ubuntu 20.10 x86_64, Ubuntu 22.04 x86_64, CentOS 7.x, CentOS 8.x, AlmaLinux 8.x, RockyLinux 8.x, CloudLinux 7.x, CloudLinux 8.x...\n"
Debug_Log2 "CyberPanel is supported on Ubuntu 18.04 x86_64, Ubuntu 20.04 x86_64, Ubuntu 20.10 x86_64, Ubuntu 22.04 x86_64, CentOS 7.x, CentOS 8.x, AlmaLinux 8.x, RockyLinux 8.x, CloudLinux 7.x, CloudLinux 8.x... [404]"
echo -e "\nCyberPanel is supported on x86_64 based Ubuntu 18.04, Ubuntu 20.04, Ubuntu 20.10, Ubuntu 22.04, CentOS 7, CentOS 8, AlmaLinux 8, RockyLinux 8, CloudLinux 7, CloudLinux 8, openEuler 20.03, openEuler 22.03...\n"
Debug_Log2 "CyberPanel is supported on x86_64 based Ubuntu 18.04, Ubuntu 20.04, Ubuntu 20.10, Ubuntu 22.04, CentOS 7, CentOS 8, AlmaLinux 8, RockyLinux 8, CloudLinux 7, CloudLinux 8, openEuler 20.03, openEuler 22.03... [404]"
exit
fi
Server_OS_Version=$(grep VERSION_ID /etc/os-release | awk -F[=,] '{print $2}' | tr -d \" | head -c2 | tr -d . )
#to make 20.04 display as 20
#to make 20.04 display as 20, etc.
echo -e "System: $Server_OS $Server_OS_Version detected...\n"
if [[ $Server_OS = "CloudLinux" ]] || [[ "$Server_OS" = "AlmaLinux" ]] || [[ "$Server_OS" = "RockyLinux" ]] ; then
Server_OS="CentOS"
#CloudLinux gives version id like 7.8 , 7.9 , so cut it to show first number only
#treat CL , Rocky and Alma as CentOS
#CloudLinux gives version id like 7.8, 7.9, so cut it to show first number only
#treat CloudLinux, Rocky and Alma as CentOS
fi
if [[ "$Debug" = "On" ]] ; then
@@ -830,12 +831,6 @@ if [[ $Server_OS = "CentOS" ]] ; then
rm -f /etc/yum.repos.d/epel.repo
rm -f /etc/yum.repos.d/epel.repo.rpmsave
yum install -y yum-plugin-copr
Check_Return "yum repo" "no_exit"
yum copr enable -y copart/restic
Check_Return "yum repo" "no_exit"
if [[ "$Server_OS_Version" = "8" ]]; then
rpm --import https://cyberpanel.sh/www.centos.org/keys/RPM-GPG-KEY-CentOS-Official
rpm --import https://cyberpanel.sh/dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-8
@@ -865,6 +860,10 @@ if [[ $Server_OS = "CentOS" ]] ; then
yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Check_Return "yum repo" "no_exit"
yum install -y yum-plugin-copr
Check_Return "yum repo" "no_exit"
yum copr enable -y copart/restic
Check_Return "yum repo" "no_exit"
yum install -y yum-plugin-priorities
Check_Return "yum repo" "no_exit"
curl -o /etc/yum.repos.d/powerdns-auth-43.repo https://cyberpanel.sh/repo.powerdns.com/repo-files/centos-auth-43.repo
@@ -890,6 +889,25 @@ EOF
Check_Return "yum repo" "no_exit"
fi
fi
if [[ $Server_OS = "openEuler" ]]; then
rpm --import https://cyberpanel.sh/rpms.litespeedtech.com/centos/RPM-GPG-KEY-litespeed
#import the LiteSpeed GPG key
yum clean all
sed -i "s|gpgcheck=1|gpgcheck=0|g" /etc/yum.repos.d/openEuler.repo
sed -i "s|repo.openeuler.org|mirror.efaith.com.hk/openeuler|g" /etc/yum.repos.d/openEuler.repo
if [[ "$Server_OS_Version" = "20" ]]; then
dnf install --nogpg -y https://repo.yaro.ee/yaro-release-20.03LTS-latest.oe1.noarch.rpm
Check_Return "yum repo" "no_exit"
fi
if [[ "$Server_OS_Version" = "22" ]]; then
dnf install --nogpg -y https://repo.yaro.ee/yaro-release-22.03LTS-latest.oe2203.noarch.rpm
Check_Return "yum repo" "no_exit"
fi
fi
Debug_Log2 "Setting up repositories...,1"
if [[ "$Server_Country" = "CN" ]] ; then
@@ -977,7 +995,7 @@ Pre_Install_Required_Components() {
Debug_Log2 "Installing necessary components..,3"
if [[ "$Server_OS" = "CentOS" ]] ; then
if [[ "$Server_OS" = "CentOS" ]] || [[ "$Server_OS" = "openEuler" ]] ; then
yum update -y
if [[ "$Server_OS_Version" = "7" ]] ; then
yum install -y wget strace net-tools curl which bc telnet htop libevent-devel gcc libattr-devel xz-devel gpgme-devel curl-devel git socat openssl-devel MariaDB-shared mariadb-devel yum-utils python36u python36u-pip python36u-devel zip unzip bind-utils
@@ -989,6 +1007,11 @@ if [[ "$Server_OS" = "CentOS" ]] ; then
Check_Return
dnf install -y gpgme-devel
Check_Return
elif [[ "$Server_OS_Version" = "20" ]] || [[ "$Server_OS_Version" = "22" ]] ; then
dnf install -y libnsl zip wget strace net-tools curl which bc telnet htop libevent-devel gcc libattr-devel xz-devel mariadb-devel curl-devel git python3-devel tar socat python3 zip unzip bind-utils
Check_Return
dnf install -y gpgme-devel
Check_Return
fi
ln -s /usr/bin/pip3 /usr/bin/pip
else
@@ -1124,7 +1147,7 @@ elif [[ "$Server_OS" = "Ubuntu" ]] ; then
fi
if ! grep -q "pid_max" /etc/rc.local 2>/dev/null ; then
if [[ $Server_OS = "CentOS" ]] ; then
if [[ $Server_OS = "CentOS" ]] || [[ $Server_OS = "openEuler" ]] ; then
echo "echo 1000000 > /proc/sys/kernel/pid_max
echo 1 > /sys/kernel/mm/ksm/run" >>/etc/rc.d/rc.local
chmod +x /etc/rc.d/rc.local
@@ -1425,7 +1448,7 @@ fi
}
Post_Install_Addon_Mecached_LSMCD() {
if [[ $Server_OS = "CentOS" ]]; then
if [[ $Server_OS = "CentOS" ]] || [[ $Server_OS = "openEuler" ]]; then
yum groupinstall "Development Tools" -y
yum install autoconf automake zlib-devel openssl-devel expat-devel pcre-devel libmemcached-devel cyrus-sasl* -y
wget -O lsmcd-master.zip https://cyberpanel.sh/codeload.github.com/litespeedtech/lsmcd/zip/master
@@ -1479,6 +1502,18 @@ if [[ $Server_OS = "Ubuntu" ]]; then
systemctl start memcached
fi
fi
if [[ $Server_OS = "openEuler" ]]; then
#yum install -y lsphp??-memcached lsphp??-pecl-memcached
if [[ $Total_RAM -eq "2048" ]] || [[ $Total_RAM -gt "2048" ]]; then
Post_Install_Addon_Mecached_LSMCD
else
yum install -y memcached
sed -i 's|OPTIONS=""|OPTIONS="-l 127.0.0.1 -U 0"|g' /etc/sysconfig/memcached
#turn off UDP and bind to 127.0.0.1 only
systemctl enable memcached
systemctl start memcached
fi
fi
if pgrep "lsmcd" ; then
echo -e "\n\nLiteSpeed Memcached installed and running..."
@@ -1522,6 +1557,10 @@ else
systemctl start redis
fi
if [[ "$Server_OS" = "openEuler" ]]; then
#yum install -y lsphp??-redis redis
fi
if pgrep "redis" ; then
echo -e "\n\nRedis installed and running..."
touch /home/cyberpanel/redis
@@ -1559,7 +1598,7 @@ for PHP_Version in /usr/local/lsws/lsphp?? ;
do
PHP_INI_Path=$(find "$PHP_Version" -name php.ini)
if [[ "$Server_OS" = "CentOS" ]]; then
if [[ "$Server_OS" = "CentOS" ]] || [[ "$Server_OS" = "openEuler" ]]; then
if [[ ! -d "${PHP_Version}/tmp" ]]; then
mkdir "${PHP_Version}/tmp"
fi
@@ -1627,7 +1666,7 @@ if [[ "$Watchdog" = "On" ]]; then
nohup watchdog mariadb >/dev/null 2>&1 &
fi
if [[ "$Server_OS" = "CentOS" ]]; then
if [[ "$Server_OS" = "CentOS" ]] || [[ "$Server_OS" = "openEuler" ]]; then
echo "nohup watchdog lsws > /dev/null 2>&1 &
nohup watchdog mariadb > /dev/null 2>&1 &" >>/etc/rc.d/rc.local
else
@@ -1832,7 +1871,7 @@ rm -f /usr/bin/php
ln -s /usr/local/lsws/lsphp74/bin/php /usr/bin/php
if [[ "$Server_OS" = "CentOS" ]] ; then
#all centos7/8 post change goes here
#all centos 7/8 post change goes here
sed -i 's|error_reporting = E_ALL \&amp; ~E_DEPRECATED \&amp; ~E_STRICT|error_reporting = E_ALL \& ~E_DEPRECATED \& ~E_STRICT|g' /usr/local/lsws/{lsphp72,lsphp73}/etc/php.ini
#fix php.ini &amp; issue
@@ -1871,10 +1910,8 @@ if [[ "$Server_OS" = "CentOS" ]] ; then
fi
elif [[ "$Server_OS" = "Ubuntu" ]] ; then
#all ubuntu18/20 post change goes here
#all ubuntu 18/20 post change goes here
sed -i 's|/usr/local/lsws/bin/lswsctrl restart|systemctl restart lsws|g' /var/spool/cron/crontabs/root
if [[ ! -f /usr/sbin/ipset ]] ; then
ln -s /sbin/ipset /usr/sbin/ipset
fi
@@ -1889,9 +1926,12 @@ elif [[ "$Server_OS" = "Ubuntu" ]] ; then
:
fi
elif [[ "$Server_OS" = "openEuler" ]] ; then
sed -i 's|error_reporting = E_ALL \&amp; ~E_DEPRECATED \&amp; ~E_STRICT|error_reporting = E_ALL \& ~E_DEPRECATED \& ~E_STRICT|g' /usr/local/lsws/{lsphp72,lsphp73}/etc/php.ini
#fix php.ini &amp; issue
sed -i 's|/usr/local/lsws/bin/lswsctrl restart|systemctl restart lsws|g' /var/spool/cron/root
fi
if [[ "$Server_Edition" = "OLS" ]]; then
Word="OpenLiteSpeed"
else

View File

@@ -4,8 +4,8 @@
#set -x
#set -u
#CyberPanel installer script for CentOS 7.X, CentOS 8.X, CloudLinux 7.X, Ubuntu 18.04 and Ubuntu 20.04
#For whoever may edit this script, please follow :
#CyberPanel installer script for CentOS 7, CentOS 8, CloudLinux 7, AlmaLinux 8, RockyLinux 8, Ubuntu 18.04, Ubuntu 20.04, Ubuntu 20.10, openEuler 20.03 and openEuler 22.03
#For whoever may edit this script, please follow:
#Please use Pre_Install_xxx() and Post_Install_xxx() if you want to something respectively before or after the panel installation
#and update below accordingly
#Please use variable/functions name as MySomething or My_Something, and please try not to use too-short abbreviation :)
@@ -121,22 +121,24 @@ elif grep -q "AlmaLinux-8" /etc/os-release ; then
Server_OS="AlmaLinux"
elif grep -q -E "Ubuntu 18.04|Ubuntu 20.04|Ubuntu 20.10" /etc/os-release ; then
Server_OS="Ubuntu"
elif grep -q -E "openEuler 20.03|openEuler 22.03" /etc/os-release ; then
Server_OS="openEuler"
else
echo -e "Unable to detect your system..."
echo -e "\nCyberPanel is supported on Ubuntu 18.04 x86_64, Ubuntu 20.04 x86_64, Ubuntu 20.10 x86_64, CentOS 7.x, CentOS 8.x, CloudLinux 7.x and AlmaLinux 8.x...\n"
Debug_Log2 "CyberPanel is supported on Ubuntu 18.04 x86_64, Ubuntu 20.04 x86_64, Ubuntu 20.10 x86_64, CentOS 7.x, CentOS 8.x, AlmaLinux 8.x... [404]"
echo -e "\nCyberPanel is supported on x86_64 based Ubuntu 18.04, Ubuntu 20.04, Ubuntu 20.10, Ubuntu 22.04, CentOS 7, CentOS 8, AlmaLinux 8, RockyLinux 8, CloudLinux 7, CloudLinux 8, openEuler 20.03, openEuler 22.03...\n"
Debug_Log2 "CyberPanel is supported on x86_64 based Ubuntu 18.04, Ubuntu 20.04, Ubuntu 20.10, Ubuntu 22.04, CentOS 7, CentOS 8, AlmaLinux 8, RockyLinux 8, CloudLinux 7, CloudLinux 8, openEuler 20.03, openEuler 22.03... [404]"
exit
fi
Server_OS_Version=$(grep VERSION_ID /etc/os-release | awk -F[=,] '{print $2}' | tr -d \" | head -c2 | tr -d . )
#to make 20.04 display as 20
#to make 20.04 display as 20, etc.
echo -e "System: $Server_OS $Server_OS_Version detected...\n"
if [[ $Server_OS = "CloudLinux" ]] || [[ "$Server_OS" = "AlmaLinux" ]] ; then
Server_OS="CentOS"
#CloudLinux gives version id like 7.8 , 7.9 , so cut it to show first number only
#treat CL and Alma as CentOS
#CloudLinux gives version id like 7.8, 7.9, so cut it to show first number only
#treat CloudLinux, Rocky and Alma as CentOS
fi
if [[ "$Debug" = "On" ]] ; then
@@ -446,6 +448,18 @@ elif [[ "$Server_OS" = "Ubuntu" ]] ; then
fi
#all pre-upgrade operation for Ubuntu 20
fi
if [[ "$Server_OS" = "openEuler" ]] ; then
rm -f /etc/yum.repos.d/CyberPanel.repo
rm -f /etc/yum.repos.d/litespeed.repo
yum clean all
yum update -y
dnf 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 python3-devel tar socat bind-utils
dnf install gpgme-devel -y
dnf install python3 -y
fi
#all pre-upgrade operation for openEuler
}
Download_Requirement() {
@@ -506,6 +520,11 @@ elif [[ "$Server_OS" = "Ubuntu" ]] ; then
Check_Return
pip3 install --default-timeout=3600 --ignore-installed -r /usr/local/requirments.txt
Check_Return
elif [[ "$Server_OS" = "openEuler" ]] ; then
pip3 install --default-timeout=3600 virtualenv==16.7.9
Check_Return
pip3 install --default-timeout=3600 --ignore-installed -r /usr/local/requirments.txt
Check_Return
fi
#virtualenv -p /usr/bin/python3 --system-site-packages /usr/local/CyberPanel

View File

@@ -23,10 +23,12 @@ check_OS() {
Server_OS="Ubuntu"
elif grep -q -E "Rocky Linux" /etc/os-release ; then
Server_OS="RockyLinux"
elif grep -q -E "openEuler 20.03|openEuler 22.03" /etc/os-release ; then
Server_OS="openEuler"
else
echo -e "Unable to detect your system..."
echo -e "\nCyberPanel is supported on Ubuntu 18.04 x86_64, Ubuntu 20.04 x86_64, Ubuntu 20.10 x86_64, CentOS 7.x, CentOS 8.x, AlmaLinux 8.x, RockyLinux 8.x, CloudLinux 7.x, CloudLinux 8.x...\n"
Debug_Log2 "CyberPanel is supported on Ubuntu 18.04 x86_64, Ubuntu 20.04 x86_64, Ubuntu 20.10 x86_64, CentOS 7.x, CentOS 8.x, AlmaLinux 8.x, RockyLinux 8.x, CloudLinux 7.x, CloudLinux 8.x... [404]"
echo -e "\nCyberPanel is supported on x86_64 based Ubuntu 18.04, Ubuntu 20.04, Ubuntu 20.10, Ubuntu 22.04, CentOS 7, CentOS 8, AlmaLinux 8, RockyLinux 8, CloudLinux 7, CloudLinux 8, openEuler 20.03, openEuler 22.03...\n"
Debug_Log2 "CyberPanel is supported on x86_64 based Ubuntu 18.04, Ubuntu 20.04, Ubuntu 20.10, Ubuntu 22.04, CentOS 7, CentOS 8, AlmaLinux 8, RockyLinux 8, CloudLinux 7, CloudLinux 8, openEuler 20.03, openEuler 22.03... [404]"
exit
fi
@@ -37,8 +39,8 @@ check_OS() {
if [[ $Server_OS = "CloudLinux" ]] || [[ "$Server_OS" = "AlmaLinux" ]] || [[ "$Server_OS" = "RockyLinux" ]] ; then
Server_OS="CentOS"
#CloudLinux gives version id like 7.8 , 7.9 , so cut it to show first number only
#treat CL , Rocky and Alma as CentOS
#CloudLinux gives version id like 7.8, 7.9, so cut it to show first number only
#treat CloudLinux, Rocky and Alma as CentOS
fi
}
@@ -212,7 +214,7 @@ phpmyadmin_limits() {
read TMP_YN
if [[ $TMP_YN == "Y" ]] || [[ $TMP_YN == "y" ]] ; then
if [[ "$SERVER_OS" == "CentOS" ]] ; then
if [[ "$SERVER_OS" == "CentOS" ]] || [[ "$SERVER_OS" == "openEuler" ]] ; then
php_ini_path="/usr/local/lsws/lsphp73/etc/php.ini"
fi
@@ -238,6 +240,9 @@ install_php_redis() {
if [[ $SERVER_OS == "Ubuntu" ]] ; then
DEBIAN_FRONTEND=noninteractive apt install -y lsphp74-redis lsphp73-redis lsphp72-redis lsphp71-redis lsphp70-redis
fi
if [[ $SERVER_OS == "openEuler" ]] ; then
#dnf install -y lsphp74-redis lsphp73-redis lsphp72-redis lsphp71-redis
fi
echo -e "\nRedis extension for PHP has been installed..."
exit
}
@@ -252,6 +257,9 @@ install_redis() {
if [[ ! -f /usr/bin/redis-cli ]] && [[ $SERVER_OS == "Ubuntu" ]] ; then
DEBIAN_FRONTEND=noninteractive apt install -y redis
fi
if [[ ! -f /usr/bin/redis-cli ]] && [[ $SERVER_OS == "openEuler" ]] ; then
yum install -y redis
fi
if ifconfig -a | grep inet6 ; then
echo -e "\n IPv6 detected..."
else
@@ -288,7 +296,7 @@ read TMP_YN
if [[ -f /usr/local/lsmcd/bin/lsmcd ]] ; then
echo -e "\nLiteSpeed Memcached is already installed..."
else
if [[ $SERVER_OS == "CentOS" ]] ; then
if [[ $SERVER_OS == "CentOS" ]] || [[ $SERVER_OS == "openEuler" ]] ; 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
@@ -329,6 +337,11 @@ read TMP_YN
if [[ ! -f /usr/bin/memcached ]] && [[ $SERVER_OS == "Ubuntu" ]] ; then
DEBIAN_FRONTEND=noninteractive apt install memcached -y
fi
if [[ ! -f /usr/bin/memcached ]] && [[ $SERVER_OS == "openEuler" ]] ; 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 systemctl is-active --quiet memcached ; then
systemctl status memcached
else
@@ -351,6 +364,9 @@ install_php_memcached() {
if [[ $SERVER_OS == "Ubuntu" ]] ; then
DEBIAN_FRONTEND=noninteractive apt install -y lsphp74-memcached lsphp73-memcached lsphp72-memcached lsphp71-memcached lsphp70-memcached
fi
if [[ $SERVER_OS == "openEuler" ]] ; then
#yum install -y lsphp74-memcached lsphp73-memcached lsphp72-memcached lsphp71-memcached
fi
echo -e "\nMemcached extension for PHP has been installed..."
exit
}

2
faq.sh
View File

@@ -52,7 +52,7 @@ ${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
edit file ${RED}/usr/local/lsws/lsphp73/etc/php.ini${NC} for CentOS or openEuler
${RED}/usr/local/lsws/lsphp73/etc/php/7.3/litespeed/php.ini${NC} for Ubbuntu

View File

@@ -22,6 +22,16 @@ apt install -y -qq wget curl
elif echo $OUTPUT | grep -q "Ubuntu 20.04" ; then
apt install -y -qq wget curl
SERVER_OS="Ubuntu"
elif echo $OUTPUT | grep -q "openEuler 20.03" ; then
echo -e "\nDetecting openEuler 20.03...\n"
SERVER_OS="openEuler"
yum install curl wget -y 1> /dev/null
yum update curl wget ca-certificates -y 1> /dev/null
elif echo $OUTPUT | grep -q "openEuler 22.03" ; then
echo -e "\nDetecting openEuler 22.03...\n"
SERVER_OS="openEuler"
yum install curl wget -y 1> /dev/null
yum update curl wget ca-certificates -y 1> /dev/null
else
echo -e "\nUnable to detect your OS...\n"

View File

@@ -15,7 +15,7 @@ from stat import *
import stat
VERSION = '2.3'
BUILD = 1
BUILD = 2
char_set = {'small': 'abcdefghijklmnopqrstuvwxyz', 'nums': '0123456789', 'big': 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'}
@@ -33,6 +33,7 @@ def generate_pass(length=14):
centos = 0
ubuntu = 1
cent8 = 2
openeuler = 3
def get_distro():
@@ -45,8 +46,8 @@ def get_distro():
if line == "DISTRIB_ID=Ubuntu\n":
distro = ubuntu
elif exists("/etc/os-release"):
distro_file = "/etc/os-release"
elif exists("/etc/redhat-release"):
distro_file = "/etc/redhat-release"
distro = centos
data = open('/etc/redhat-release', 'r').read()
@@ -57,6 +58,10 @@ def get_distro():
return cent8
if data.find('Rocky Linux release 8') > -1 or data.find('Rocky Linux 8') > -1 or data.find('rocky:8') > -1:
return cent8
elif exists("/etc/openEuler-release"):
distro_file = "/etc/openEuler-release"
distro = openeuler
else:
logging.InstallLog.writeToFile("Can't find linux release file - fatal error")
@@ -268,7 +273,7 @@ class preFlightsChecks:
def setup_account_cyberpanel(self):
try:
if self.distro == centos or self.distro == cent8:
if self.distro == centos or self.distro == cent8 or self.distro == openeuler:
command = "yum install sudo -y"
preFlightsChecks.call(command, self.distro, command,
command,
@@ -359,7 +364,7 @@ class preFlightsChecks:
def install_psmisc(self):
self.stdOut("Install psmisc")
if self.distro == centos or self.distro == cent8:
if self.distro == centos or self.distro == cent8 or self.distro == openeuler:
command = "yum -y install psmisc"
else:
command = "apt-get -y install psmisc"
@@ -642,7 +647,7 @@ password="%s"
command = "find /usr/local/CyberCP/ -name '*.pyc' -delete"
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
if self.distro == cent8 or self.distro == centos:
if self.distro == cent8 or self.distro == centos or self.distro == openeuler:
command = 'chown root:pdns /etc/pdns/pdns.conf'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
@@ -691,7 +696,7 @@ password="%s"
def install_unzip(self):
self.stdOut("Install unzip")
try:
if self.distro == centos or self.distro == cent8:
if self.distro == centos or self.distro == cent8 or self.distro == openeuler:
command = 'yum -y install unzip'
else:
command = 'apt-get -y install unzip'
@@ -703,7 +708,7 @@ password="%s"
def install_zip(self):
self.stdOut("Install zip")
try:
if self.distro == centos or self.distro == cent8:
if self.distro == centos or self.distro == cent8 or self.distro == openeuler:
command = 'yum -y install zip'
else:
command = 'apt-get -y install zip'
@@ -813,12 +818,14 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
command = 'yum install --enablerepo=gf-plus -y postfix3 postfix3-ldap postfix3-mysql postfix3-pcre'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
elif self.distro == cent8:
command = 'dnf --nogpg install -y https://mirror.ghettoforge.org/distributions/gf/gf-release-latest.gf.el8.noarch.rpm'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
command = 'dnf install --enablerepo=gf-plus postfix3 postfix3-mysql -y'
preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
elif self.distro == openeuler:
command = 'dnf install postfix -y'
preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
else:
command = 'apt-get -y install debconf-utils'
@@ -842,6 +849,8 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
command = 'yum --enablerepo=gf-plus -y install dovecot23 dovecot23-mysql'
elif self.distro == cent8:
command = 'dnf install --enablerepo=gf-plus dovecot23 dovecot23-mysql -y'
elif self.distro == openeuler:
command = 'dnf install dovecot -y'
else:
command = 'apt-get -y install dovecot-mysql dovecot-imapd dovecot-pop3d'
@@ -1464,14 +1473,14 @@ autocreate_system_folders = On
except:
pass
if self.distro == centos or self.distro == cent8:
if self.distro == centos or self.distro == cent8 or self.distro == openeuler:
command = 'adduser lscpd -M -d /usr/local/lscp'
else:
command = 'useradd lscpd -M -d /usr/local/lscp'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
if self.distro == centos or self.distro == cent8:
if self.distro == centos or self.distro == cent8 or self.distro == openeuler:
command = 'groupadd lscpd'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
# Added group in useradd for Ubuntu
@@ -1691,21 +1700,21 @@ autocreate_system_folders = On
try:
## first install crontab
if self.distro == centos or self.distro == cent8:
if self.distro == centos or self.distro == cent8 or self.distro == openeuler:
command = 'yum install cronie -y'
else:
command = 'apt-get -y install cron'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
if self.distro == centos or self.distro == cent8:
if self.distro == centos or self.distro == cent8 or self.distro == openeuler:
command = 'systemctl enable crond'
else:
command = 'systemctl enable cron'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
if self.distro == centos or self.distro == cent8:
if self.distro == centos or self.distro == cent8 or self.distro == openeuler:
command = 'systemctl start crond'
else:
command = 'systemctl start cron'
@@ -1715,8 +1724,9 @@ autocreate_system_folders = On
##
CentOSPath = '/etc/redhat-release'
openEulerPath = '/etc/openEuler-release'
if os.path.exists(CentOSPath):
if os.path.exists(CentOSPath) or os.path.exists(openEulerPath):
cronPath = '/var/spool/cron/root'
else:
cronPath = '/var/spool/cron/crontabs/root'
@@ -1754,11 +1764,11 @@ autocreate_system_folders = On
writeToFile.close()
if not os.path.exists(CentOSPath):
if not os.path.exists(CentOSPath) or not os.path.exists(openEulerPath):
command = 'chmod 600 %s' % (cronPath)
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
if self.distro == centos or self.distro == cent8:
if self.distro == centos or self.distro == cent8 or self.distro == openeuler:
command = 'systemctl restart crond.service'
else:
command = 'systemctl restart cron.service'
@@ -1785,7 +1795,7 @@ autocreate_system_folders = On
def install_rsync(self):
try:
if self.distro == centos or self.distro == cent8:
if self.distro == centos or self.distro == cent8 or self.distro == openeuler:
command = 'yum -y install rsync'
else:
command = 'apt-get -y install rsync'
@@ -1843,14 +1853,14 @@ autocreate_system_folders = On
try:
if self.distro == centos:
command = 'yum -y install opendkim'
elif self.distro == cent8:
elif self.distro == cent8 or self.distro == openeuler:
command = 'dnf install opendkim -y'
else:
command = 'apt-get -y install opendkim'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
if self.distro == cent8:
if self.distro == cent8 or self.distro == openeuler:
command = 'dnf install opendkim-tools -y'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
@@ -2086,12 +2096,15 @@ milter_default_action = accept
try:
CentOSPath = '/etc/redhat-release'
openEulerPath = '/etc/openEuler-release'
if os.path.exists(CentOSPath) or os.path.exists(openEulerPath):
if self.distro == centos:
command = 'yum install -y yum-plugin-copr'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
command = 'yum copr enable -y copart/restic'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
if os.path.exists(CentOSPath):
command = 'yum install -y yum-plugin-copr'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
command = 'yum copr enable -y copart/restic'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
command = 'yum install -y restic'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
command = 'restic self-update'
@@ -2114,8 +2127,9 @@ milter_default_action = accept
try:
CentOSPath = '/etc/redhat-release'
openEulerPath = '/etc/openEuler-release'
if os.path.exists(CentOSPath):
if os.path.exists(CentOSPath) or os.path.exists(openEulerPath):
command = 'mkdir -p /opt/cpvendor/etc/'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)

View File

@@ -14,6 +14,7 @@ import time
centos = 0
ubuntu = 1
cent8 = 2
openeuler = 3
def get_Ubuntu_release():
@@ -71,7 +72,7 @@ class InstallCyberPanel:
command = 'yum install -y openlitespeed'
install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
else:
command = 'yum install -y openlitespeed'
command = 'dnf install -y openlitespeed'
install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
else:
@@ -250,6 +251,10 @@ class InstallCyberPanel:
if self.distro == cent8:
command = 'dnf install lsphp71* lsphp72* lsphp73* lsphp74* lsphp80* --exclude lsphp73-pecl-zip --exclude *imagick* -y'
subprocess.call(command, shell=True)
if self.distro == openeuler:
command = 'dnf install lsphp71* lsphp72* lsphp73* lsphp74* lsphp80* -y'
subprocess.call(command, shell=True)
def installMySQL(self, mysql):
@@ -272,7 +277,7 @@ class InstallCyberPanel:
command = "apt-get -y install mariadb-server"
elif self.distro == centos:
command = 'yum --enablerepo=mariadb -y install MariaDB-server MariaDB-client'
elif self.distro == cent8:
elif self.distro == cent8 or self.distro == openeuler:
command = 'dnf -y install mariadb-server'
install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
@@ -369,7 +374,7 @@ class InstallCyberPanel:
elif self.distro == centos:
command = "yum install -y pure-ftpd"
install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
elif self.distro == cent8:
elif self.distro == cent8 or self.distro == openeuler:
command = 'dnf install pure-ftpd -y'
install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
@@ -405,7 +410,7 @@ class InstallCyberPanel:
except:
logging.InstallLog.writeToFile("[ERROR] Could not create directory for FTP SSL")
if (self.distro == centos or self.distro == cent8) or (
if (self.distro == centos or self.distro == cent8 or self.distro == openeuler) or (
self.distro == ubuntu and get_Ubuntu_release() == 18.14):
command = 'openssl req -newkey rsa:1024 -new -nodes -x509 -days 3650 -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" -keyout /etc/ssl/private/pure-ftpd.pem -out /etc/ssl/private/pure-ftpd.pem'
else:
@@ -502,7 +507,7 @@ class InstallCyberPanel:
def installPowerDNS(self):
try:
if self.distro == ubuntu or self.distro == cent8:
if self.distro == ubuntu or self.distro == cent8 or self.distro == openeuler:
command = 'systemctl stop systemd-resolved'
install.preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
command = 'systemctl disable systemd-resolved.service'
@@ -555,7 +560,7 @@ class InstallCyberPanel:
InstallCyberPanel.stdOut("Configuring PowerDNS..", 1)
os.chdir(self.cwd)
if self.distro == centos or self.distro == cent8:
if self.distro == centos or self.distro == cent8 or self.distro == openeuler:
dnsPath = "/etc/pdns/pdns.conf"
else:
dnsPath = "/etc/powerdns/pdns.conf"

View File

@@ -19,7 +19,7 @@ from django.utils import translation
# Create your views here.
VERSION = '2.3'
BUILD = 1
BUILD = 2
def verifyLogin(request):

View File

@@ -13,7 +13,7 @@ from packages.models import Package
from baseTemplate.models import version
VERSION = '2.3'
BUILD = 1
BUILD = 2
if not os.geteuid() == 0:
sys.exit("\nOnly root can run this script\n")

View File

@@ -49,7 +49,7 @@ except:
pass
VERSION = '2.3'
BUILD = 1
BUILD = 2
## I am not the monster that you think I am..

View File

@@ -17,7 +17,7 @@ import random
import string
VERSION = '2.3'
BUILD = 1
BUILD = 2
CENTOS7 = 0
CENTOS8 = 1
@@ -25,6 +25,8 @@ Ubuntu18 = 2
Ubuntu20 = 3
CloudLinux7 = 4
CloudLinux8 = 5
openEuler20 = 6
openEuler22 = 7
class Upgrade:
@@ -33,6 +35,7 @@ class Upgrade:
installedOutput = ''
CentOSPath = '/etc/redhat-release'
UbuntuPath = '/etc/lsb-release'
openEulerPath = '/etc/openEuler-release'
FromCloud = 0
SnappyVersion = '2.15.3'
@@ -81,6 +84,15 @@ class Upgrade:
return CENTOS8
else:
return CENTOS7
elif os.path.exists(Upgrade.openEulerPath):
result = open(Upgrade.openEulerPath, 'r').read()
if result.find('20.03') > -1:
return openEuler20
elif result.find('22.03') > -1:
return openEuler22
else:
result = open(Upgrade.UbuntuPath, 'r').read()
@@ -89,7 +101,6 @@ class Upgrade:
else:
return Ubuntu18
@staticmethod
def stdOut(message, do_exit=0):
print("\n\n")
@@ -2152,7 +2163,7 @@ echo $oConfig->Save() ? 'Done' : 'Error';
command = "find /usr/local/CyberCP/ -name '*.pyc' -delete"
Upgrade.executioner(command, 0)
if os.path.exists(Upgrade.CentOSPath):
if os.path.exists(Upgrade.CentOSPath) or os.path.exists(Upgrade.openEulerPath):
command = 'chown root:pdns /etc/pdns/pdns.conf'
Upgrade.executioner(command, 0)
@@ -2180,8 +2191,9 @@ echo $oConfig->Save() ? 'Done' : 'Error';
###
CentOSPath = '/etc/redhat-release'
openEulerPath = '/etc/openEuler-release'
if not os.path.exists(CentOSPath):
if not os.path.exists(CentOSPath) or not os.path.exists(openEulerPath):
group = 'nobody'
else:
group = 'nogroup'
@@ -2262,8 +2274,9 @@ echo $oConfig->Save() ? 'Done' : 'Error';
os.system(command)
CentOSPath = '/etc/redhat-release'
openEulerPath = '/etc/openEuler-release'
if not os.path.exists(CentOSPath):
if not os.path.exists(CentOSPath) or not os.path.exists(openEulerPath):
command = 'cp /usr/local/lsws/lsphp71/bin/php /usr/bin/'
Upgrade.executioner(command, 'Set default PHP 7.0, 0')
@@ -2280,6 +2293,7 @@ echo $oConfig->Save() ? 'Done' : 'Error';
try:
Upgrade.stdOut("Upgrading Dovecot..")
CentOSPath = '/etc/redhat-release'
openEulerPath = '/etc/openEuler-release'
dovecotConfPath = '/etc/dovecot/'
postfixConfPath = '/etc/postfix/'
@@ -2297,7 +2311,7 @@ echo $oConfig->Save() ? 'Done' : 'Error';
command = 'cp -pR %s %s' % (postfixConfPath, configbackups)
Upgrade.executioner(command, 0)
if Upgrade.FindOperatingSytem() == CENTOS8 or Upgrade.FindOperatingSytem() == CENTOS7:
if Upgrade.FindOperatingSytem() == CENTOS8 or Upgrade.FindOperatingSytem() == CENTOS7 or Upgrade.FindOperatingSytem() == openEuler22 or Upgrade.FindOperatingSytem() == openEuler20:
command = "yum makecache -y"
Upgrade.executioner(command, 0)
@@ -2419,8 +2433,9 @@ echo $oConfig->Save() ? 'Done' : 'Error';
@staticmethod
def installRestic():
CentOSPath = '/etc/redhat-release'
openEulerPath = '/etc/openEuler-release'
if os.path.exists(CentOSPath):
if os.path.exists(CentOSPath) or os.path.exists(openEulerPath):
if Upgrade.installedOutput.find('restic') == -1:
command = 'yum install restic -y'
Upgrade.executioner(command, 'Install Restic')
@@ -2451,8 +2466,9 @@ echo $oConfig->Save() ? 'Done' : 'Error';
try:
CentOSPath = '/etc/redhat-release'
openEulerPath = '/etc/openEuler-release'
if os.path.exists(CentOSPath):
if os.path.exists(CentOSPath) or os.path.exists(openEulerPath):
command = 'mkdir -p /opt/cpvendor/etc/'
Upgrade.executioner(command, 0)
@@ -2517,8 +2533,9 @@ vmail
# Install findBWUsage cron if missing
CentOSPath = '/etc/redhat-release'
openEulerPath = '/etc/openEuler-release'
if os.path.exists(CentOSPath):
if os.path.exists(CentOSPath) or os.path.exists(openEulerPath):
cronPath = '/var/spool/cron/root'
else:
cronPath = '/var/spool/cron/crontabs/root'
@@ -2581,7 +2598,7 @@ vmail
writeToFile.close()
if not os.path.exists(CentOSPath):
if not os.path.exists(CentOSPath) or not os.path.exists(openEulerPath):
command = 'chmod 600 %s' % (cronPath)
Upgrade.executioner(command, 0)
@@ -2615,7 +2632,7 @@ vmail
# Upgrade.stdOut("Upgrades are currently disabled")
# return 0
if os.path.exists(Upgrade.CentOSPath):
if os.path.exists(Upgrade.CentOSPath) or os.path.exists(Upgrade.openEulerPath):
command = 'yum list installed'
Upgrade.installedOutput = subprocess.check_output(shlex.split(command)).decode()
else:

View File

@@ -26,7 +26,7 @@ EXPIRE = 3
### Version
VERSION = '2.3'
BUILD = 1
BUILD = 2
def serverStatusHome(request):
proc = httpProc(request, 'serverStatus/index.html',