Merge branch 'stable' into v2.1.1-usman

This commit is contained in:
Usman Nasir
2021-08-31 14:46:24 +05:00
3 changed files with 46 additions and 23 deletions

View File

@@ -95,8 +95,8 @@ Git_Content_URL=""
Git_Clone_URL=""
LSWS_Latest_URL="https://cyberpanel.sh/update.litespeedtech.com/ws/latest.php"
curl --silent --max-time 30 -4 -o /tmp/lsws_latest "$LSWS_Latest_URL" 2>/dev/null
LSWS_Stable_Line=$(grep "LSWS_STABLE" /tmp/lsws_latest)
LSWS_Tmp=$(curl --silent --max-time 30 -4 "$LSWS_Latest_URL")
LSWS_Stable_Line=$(echo "$LSWS_Tmp" | grep "LSWS_STABLE")
LSWS_Stable_Version=$(expr "$LSWS_Stable_Line" : '.*LSWS_STABLE=\(.*\) BUILD .*')
#grab the LSWS latest stable version.
@@ -107,7 +107,7 @@ Debug_Log2 "Starting installation..,1"
}
Debug_Log() {
echo -e "\n${1}=${2}\n" >> /tmp/cyberpanel_debug.log
echo -e "\n${1}=${2}\n" >> "/var/log/cyberpanel_debug_$(date +"%Y-%m-%d")_${Random_Log_Name}.log"
}
Debug_Log2() {
@@ -174,12 +174,12 @@ Retry_Command() {
# shellcheck disable=SC2034
for i in {1..50};
do
if [[ "$i" = "50" ]] ; then
if [[ "$i" = "50" ]] ; then
echo "command $1 failed for 50 times, exit..."
exit 2
else
$1 && break || echo -e "\n$1 has failed for $i times\nWait for 3 seconds and try again...\n"; sleep 3;
fi
fi
done
}
@@ -213,12 +213,12 @@ Server_IP=$(curl --silent --max-time 30 -4 https://cyberpanel.sh/?ip)
echo -e "\nChecking server location...\n"
if [[ "$Server_Country" != "CN" ]] ; then
if [[ "$Server_Country" != "CN" ]] ; then
Server_Country=$(curl --silent --max-time 10 -4 https://cyberpanel.sh/?country)
if [[ ${#Server_Country} != "2" ]] ; then
Server_Country="Unknow"
fi
fi
fi
#to avoid repeated check_ip called by debug_log2 to break force mirror for CN servers.
if [[ "$Debug" = "On" ]] ; then
@@ -829,7 +829,7 @@ if [[ $Server_OS = "CentOS" ]] ; then
yum autoremove -y epel-release
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
@@ -1213,7 +1213,7 @@ tar xzvf "lsws-$LSWS_Stable_Version-ent-x86_64-linux.tar.gz" >/dev/null
cd "/root/cyberpanel-tmp/lsws-$LSWS_Stable_Version/conf" || exit
if [[ "$License_Key" = "Trial" ]]; then
Retry_Command "wget -q https://cyberpanel.sh/license.litespeedtech.com/reseller/trial.key"
sed -i "s|writeSerial = open('lsws-5.4.2/serial.no', 'w')|command = 'wget -q --output-document=./lsws-$LSWS_Stable_Version/trial.key https://cyberpanel.sh/license.litespeedtech.com/reseller/trial.key'|g" "$Current_Dir/installCyberPanel.py"
sed -i "s|writeSerial = open('lsws-6.0/serial.no', 'w')|command = 'wget -q --output-document=./lsws-$LSWS_Stable_Version/trial.key https://cyberpanel.sh/license.litespeedtech.com/reseller/trial.key'|g" "$Current_Dir/installCyberPanel.py"
sed -i 's|writeSerial.writelines(self.serial)|subprocess.call(command, shell=True)|g' "$Current_Dir/installCyberPanel.py"
sed -i 's|writeSerial.close()||g' "$Current_Dir/installCyberPanel.py"
else
@@ -1253,10 +1253,10 @@ if [[ "$Server_OS" = "CentOS" ]] ; then
sed -i 's|https://mirror.ghettoforge.org/distributions|https://cyberpanel.sh/mirror.ghettoforge.org/distributions|g' install.py
if [[ "$Server_OS_Version" = "8" ]] ; then
sed -i 's|dnf --nogpg install -y https://mirror.ghettoforge.org/distributions/gf/el/8/gf/x86_64/gf-release-8-11.gf.el8.noarch.rpm|echo gf8|g' install.py
sed -i 's|dnf --nogpg install -y https://cyberpanel.sh/mirror.ghettoforge.org/distributions/gf/el/8/gf/x86_64/gf-release-8-11.gf.el8.noarch.rpm|echo gf8|g' install.py
sed -i 's|dnf --nogpg install -y https://mirror.ghettoforge.org/distributions/gf/gf-release-latest.gf.el8.noarch.rpm|echo gf8|g' install.py
sed -i 's|dnf --nogpg install -y https://cyberpanel.sh/mirror.ghettoforge.org/distributions/gf/gf-release-latest.gf.el8.noarch.rpm|echo gf8|g' install.py
Retry_Command "dnf --nogpg install -y https://cyberpanel.sh/mirror.ghettoforge.org/distributions/gf/el/8/gf/x86_64/gf-release-8-11.gf.el8.noarch.rpm"
Retry_Command "dnf --nogpg install -y https://cyberpanel.sh/mirror.ghettoforge.org/distributions/gf/gf-release-latest.gf.el8.noarch.rpm"
sed -i "s|mirrorlist=http://mirrorlist.ghettoforge.org/el/8/gf/\$basearch/mirrorlist|baseurl=https://cyberpanel.sh/mirror.ghettoforge.org/distributions/gf/el/8/gf/x86_64/|g" /etc/yum.repos.d/gf.repo
sed -i "s|mirrorlist=http://mirrorlist.ghettoforge.org/el/8/plus/\$basearch/mirrorlist|baseurl=https://cyberpanel.sh/mirror.ghettoforge.org/distributions/gf/el/8/plus/x86_64/|g" /etc/yum.repos.d/gf.repo
#get this set up beforehand.
@@ -1311,6 +1311,7 @@ if [[ $Server_Edition = "Enterprise" ]] ; then
sed -i "s|lsws-5.4.2|lsws-$LSWS_Stable_Version|g" installCyberPanel.py
sed -i "s|lsws-5.3.5|lsws-$LSWS_Stable_Version|g" installCyberPanel.py
sed -i "s|lsws-6.0|lsws-$LSWS_Stable_Version|g" installCyberPanel.py
#this sed must be done after license validation
Enterprise_Flag="--ent ent --serial "
@@ -1322,7 +1323,21 @@ sed -i 's|mirror.cyberpanel.net|cyberpanel.sh|g' install.py
if [[ $Server_Country = "CN" ]] ; then
Pre_Install_CN_Replacement
else
sed -i 's|wget -O - https://get.acme.sh \| sh|echo acme|g' install.py
sed -i 's|/root/.acme.sh/acme.sh --upgrade --auto-upgrade|echo acme2|g' install.py
Current_Dir=$(pwd)
Retry_Command "git clone https://github.com/acmesh-official/acme.sh.git"
cd acme.sh || exit
./acme.sh --install
cd "$Current_Dir" || exit
rm -rf acme.sh
Retry_Command "/root/.acme.sh/acme.sh --upgrade --auto-upgrade"
#install acme and upgrade it beforehand, to prevent gitee fail
fi
#install acme.sh before main installation for issues #705 #707 #708 #709
echo -e "Preparing...\n"
@@ -1545,7 +1560,9 @@ Webadmin_Pass=$(
Encrypt_string=$(/usr/local/lsws/admin/fcgi-bin/${PHP_Command} /usr/local/lsws/admin/misc/htpasswd.php "${Webadmin_Pass}")
echo "" >/usr/local/lsws/admin/conf/htpasswd
echo "admin:$Encrypt_string" >/usr/local/lsws/admin/conf/htpasswd
echo "admin:$Encrypt_string" > /usr/local/lsws/admin/conf/htpasswd
chown lsadm:lsadm /usr/local/lsws/admin/conf/htpasswd
chmod 600 /usr/local/lsws/admin/conf/htpasswd
echo "${Webadmin_Pass}" >/etc/cyberpanel/webadmin_passwd
chmod 600 /etc/cyberpanel/webadmin_passwd
}
@@ -1752,6 +1769,7 @@ rm -rf /etc/profile.d/cyberpanel*
curl --silent -o /etc/profile.d/cyberpanel.sh https://cyberpanel.sh/?banner 2>/dev/null
chmod 700 /etc/profile.d/cyberpanel.sh
echo "$Admin_Pass" > /etc/cyberpanel/adminPass
chmod 600 /etc/cyberpanel/adminPass
/usr/local/CyberPanel/bin/python /usr/local/CyberCP/plogical/adminPass.py --password "$Admin_Pass"
mkdir -p /etc/opendkim
@@ -1837,8 +1855,6 @@ systemctl start lsws >/dev/null 2>&1
echo -e "\nFinalizing...\n"
echo -e "Cleaning up...\n"
rm -rf /root/cyberpanel
rm -f /tmp/cyberpanel_debug.log
rm -f /tmp/lsws_latest
if [[ "$Server_Country" = "CN" ]] ; then
Post_Install_CN_Replacement
@@ -1863,8 +1879,10 @@ echo -e "\nInitializing...\n"
if [[ "$*" = *"--debug"* ]] ; then
Debug="On"
rm -f /tmp/cyberpanel_debug.log
echo -e "$(date)" > /tmp/cyberpanel_debug.log
find /var/log -name 'cyberpanel_debug_*' -exec rm {} +
Random_Log_Name=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 5)
echo -e "$(date)" > "/var/log/cyberpanel_debug_$(date +"%Y-%m-%d")_${Random_Log_Name}.log"
chmod 600 "/var/log/cyberpanel_debug_$(date +"%Y-%m-%d")_${Random_Log_Name}.log"
fi
Set_Default_Variables

View File

@@ -41,8 +41,8 @@ MySQL_Password=$(cat /etc/cyberpanel/mysqlPassword)
LSWS_Latest_URL="https://cyberpanel.sh/update.litespeedtech.com/ws/latest.php"
curl --silent --max-time 30 -4 -o /tmp/lsws_latest "$LSWS_Latest_URL" 2>/dev/null
LSWS_Stable_Line=$(grep "LSWS_STABLE" /tmp/lsws_latest)
LSWS_Tmp=$(curl --silent --max-time 30 -4 "$LSWS_Latest_URL")
LSWS_Stable_Line=$(echo "$LSWS_Tmp" | grep "LSWS_STABLE")
LSWS_Stable_Version=$(expr "$LSWS_Stable_Line" : '.*LSWS_STABLE=\(.*\) BUILD .*')
#grab the LSWS latest stable version.
@@ -54,7 +54,7 @@ cd /root/cyberpanel_upgrade_tmp || exit
}
Debug_Log() {
echo -e "\n${1}=${2}\n" >> /tmp/cyberpanel_debug_upgrade.log
echo -e "\n${1}=${2}\n" >> "/var/log/cyberpanel_debug_upgrade_$(date +"%Y-%m-%d")_${Random_Log_Name}.log"
}
Debug_Log2() {
@@ -676,6 +676,9 @@ if [[ -f /etc/cyberpanel/webadmin_passwd ]]; then
chmod 600 /etc/cyberpanel/webadmin_passwd
fi
chown lsadm:lsadm /usr/local/lsws/admin/conf/htpasswd
chmod 600 /usr/local/lsws/admin/conf/htpasswd
if [[ -f /etc/pure-ftpd/pure-ftpd.conf ]]; then
sed -i 's|NoAnonymous no|NoAnonymous yes|g' /etc/pure-ftpd/pure-ftpd.conf
fi
@@ -740,8 +743,10 @@ fi
if [[ "$*" = *"--debug"* ]] ; then
Debug="On"
rm -f /tmp/cyberpanel_debug_upgrade.log
echo -e "$(date)" > /tmp/cyberpanel_debug_upgrade.log
Random_Log_Name=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 5)
find /var/log -name 'cyberpanel_debug_upgrade_*' -exec rm {} +
echo -e "$(date)" > "/var/log/cyberpanel_debug_upgrade_$(date +"%Y-%m-%d")_${Random_Log_Name}.log"
chmod 600 "/var/log/cyberpanel_debug_upgrade_$(date +"%Y-%m-%d")_${Random_Log_Name}.log"
fi
Set_Default_Variables

View File

@@ -803,7 +803,7 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
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/el/8/gf/x86_64/gf-release-8-11.gf.el8.noarch.rpm'
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'