@@ -95,8 +95,8 @@ Git_Content_URL=""
9595Git_Clone_URL=" "
9696
9797LSWS_Latest_URL=" https://cyberpanel.sh/update.litespeedtech.com/ws/latest.php"
98- curl --silent --max-time 30 -4 -o /tmp/lsws_latest " $LSWS_Latest_URL " 2> /dev/null
99- LSWS_Stable_Line=$( grep " LSWS_STABLE" /tmp/lsws_latest )
98+ LSWS_Tmp= $( curl --silent --max-time 30 -4 " $LSWS_Latest_URL " )
99+ LSWS_Stable_Line=$( echo " $LSWS_Tmp " | grep " LSWS_STABLE" )
100100LSWS_Stable_Version=$( expr " $LSWS_Stable_Line " : ' .*LSWS_STABLE=\(.*\) BUILD .*' )
101101# grab the LSWS latest stable version.
102102
@@ -107,7 +107,7 @@ Debug_Log2 "Starting installation..,1"
107107}
108108
109109Debug_Log () {
110- echo -e " \n${1} =${2} \n" >> /tmp/cyberpanel_debug .log
110+ echo -e " \n${1} =${2} \n" >> " /var/log/cyberpanel_debug_ $( date + " %Y-%m-%d " ) _ ${Random_Log_Name} .log"
111111}
112112
113113Debug_Log2 () {
@@ -174,12 +174,12 @@ Retry_Command() {
174174# shellcheck disable=SC2034
175175for i in {1..50};
176176do
177- if [[ " $i " = " 50" ]] ; then
177+ if [[ " $i " = " 50" ]] ; then
178178 echo " command $1 failed for 50 times, exit..."
179179 exit 2
180180 else
181181 $1 && break || echo -e " \n$1 has failed for $i times\nWait for 3 seconds and try again...\n" ; sleep 3;
182- fi
182+ fi
183183done
184184}
185185
@@ -213,12 +213,12 @@ Server_IP=$(curl --silent --max-time 30 -4 https://cyberpanel.sh/?ip)
213213
214214echo -e " \nChecking server location...\n"
215215
216- if [[ " $Server_Country " != " CN" ]] ; then
216+ if [[ " $Server_Country " != " CN" ]] ; then
217217 Server_Country=$( curl --silent --max-time 10 -4 https://cyberpanel.sh/? country)
218218 if [[ ${# Server_Country} != " 2" ]] ; then
219219 Server_Country=" Unknow"
220220 fi
221- fi
221+ fi
222222# to avoid repeated check_ip called by debug_log2 to break force mirror for CN servers.
223223
224224if [[ " $Debug " = " On" ]] ; then
@@ -829,7 +829,7 @@ if [[ $Server_OS = "CentOS" ]] ; then
829829 yum autoremove -y epel-release
830830 rm -f /etc/yum.repos.d/epel.repo
831831 rm -f /etc/yum.repos.d/epel.repo.rpmsave
832-
832+
833833 yum install -y yum-plugin-copr
834834 Check_Return " yum repo" " no_exit"
835835 yum copr enable -y copart/restic
@@ -1335,7 +1335,7 @@ else
13351335
13361336 Retry_Command " /root/.acme.sh/acme.sh --upgrade --auto-upgrade"
13371337 # install acme and upgrade it beforehand, to prevent gitee fail
1338- fi
1338+ fi
13391339 # install acme.sh before main installation for issues #705 #707 #708 #709
13401340
13411341echo -e " Preparing...\n"
@@ -1559,7 +1559,9 @@ Webadmin_Pass=$(
15591559
15601560Encrypt_string=$( /usr/local/lsws/admin/fcgi-bin/${PHP_Command} /usr/local/lsws/admin/misc/htpasswd.php " ${Webadmin_Pass} " )
15611561echo " " > /usr/local/lsws/admin/conf/htpasswd
1562- echo " admin:$Encrypt_string " > /usr/local/lsws/admin/conf/htpasswd
1562+ echo " admin:$Encrypt_string " > /usr/local/lsws/admin/conf/htpasswd
1563+ chown lsadm:lsadm /usr/local/lsws/admin/conf/htpasswd
1564+ chmod 600 /usr/local/lsws/admin/conf/htpasswd
15631565echo " ${Webadmin_Pass} " > /etc/cyberpanel/webadmin_passwd
15641566chmod 600 /etc/cyberpanel/webadmin_passwd
15651567}
@@ -1766,6 +1768,7 @@ rm -rf /etc/profile.d/cyberpanel*
17661768curl --silent -o /etc/profile.d/cyberpanel.sh https://cyberpanel.sh/? banner 2> /dev/null
17671769chmod 700 /etc/profile.d/cyberpanel.sh
17681770echo " $Admin_Pass " > /etc/cyberpanel/adminPass
1771+ chmod 600 /etc/cyberpanel/adminPass
17691772/usr/local/CyberPanel/bin/python /usr/local/CyberCP/plogical/adminPass.py --password " $Admin_Pass "
17701773mkdir -p /etc/opendkim
17711774
@@ -1851,8 +1854,6 @@ systemctl start lsws >/dev/null 2>&1
18511854echo -e " \nFinalizing...\n"
18521855echo -e " Cleaning up...\n"
18531856rm -rf /root/cyberpanel
1854- rm -f /tmp/cyberpanel_debug.log
1855- rm -f /tmp/lsws_latest
18561857
18571858if [[ " $Server_Country " = " CN" ]] ; then
18581859Post_Install_CN_Replacement
@@ -1877,8 +1878,10 @@ echo -e "\nInitializing...\n"
18771878
18781879if [[ " $* " = * " --debug" * ]] ; then
18791880 Debug=" On"
1880- rm -f /tmp/cyberpanel_debug.log
1881- echo -e " $( date) " > /tmp/cyberpanel_debug.log
1881+ find /var/log -name ' cyberpanel_debug_*' -exec rm {} +
1882+ Random_Log_Name=$( head /dev/urandom | tr -dc A-Za-z0-9 | head -c 5)
1883+ echo -e " $( date) " > " /var/log/cyberpanel_debug_$( date +" %Y-%m-%d" ) _${Random_Log_Name} .log"
1884+ chmod 600 " /var/log/cyberpanel_debug_$( date +" %Y-%m-%d" ) _${Random_Log_Name} .log"
18821885fi
18831886
18841887Set_Default_Variables
0 commit comments