diff --git a/CPScripts/fixperms.sh b/CPScripts/fixperms.sh index 37c2f5da2..e1ceefdac 100644 --- a/CPScripts/fixperms.sh +++ b/CPScripts/fixperms.sh @@ -194,7 +194,7 @@ fixperms_cyberpanel () { echo "Fixing public_html...." tput sgr0 #Fix perms of public_html itself - chown "$verbose" "$account":"$account" "$HOMEDIR"/public_html + chown "$verbose" "$account":nobody "$HOMEDIR"/public_html chmod "$verbose" 755 "$HOMEDIR"/public_html tput bold diff --git a/CyberCP/secMiddleware.py b/CyberCP/secMiddleware.py index 90c890df7..46f683235 100755 --- a/CyberCP/secMiddleware.py +++ b/CyberCP/secMiddleware.py @@ -10,6 +10,12 @@ class secMiddleware: HIGH = 0 LOW = 1 + def get_client_ip(request): + ip = request.META.get('HTTP_CF_CONNECTING_IP') + if ip is None: + ip = request.META.get('REMOTE_ADDR') + return ip + def __init__(self, get_response): self.get_response = get_response @@ -17,7 +23,7 @@ class secMiddleware: try: uID = request.session['userID'] admin = Administrator.objects.get(pk=uID) - ipAddr = request.META.get('REMOTE_ADDR') + ipAddr = get_client_ip(request) if ipAddr.find('.') > -1: if request.session['ipAddr'] == ipAddr or admin.securityLevel == secMiddleware.LOW: @@ -25,20 +31,19 @@ class secMiddleware: else: del request.session['userID'] del request.session['ipAddr'] - logging.writeToFile(request.META.get('REMOTE_ADDR')) + logging.writeToFile(get_client_ip(request)) final_dic = {'error_message': "Session reuse detected, IPAddress logged.", "errorMessage": "Session reuse detected, IPAddress logged."} final_json = json.dumps(final_dic) return HttpResponse(final_json) else: - ipAddr = request.META.get('REMOTE_ADDR').split(':')[:3] - + ipAddr = get_client_ip(request).split(':')[:3] if request.session['ipAddr'] == ipAddr or admin.securityLevel == secMiddleware.LOW: pass else: del request.session['userID'] del request.session['ipAddr'] - logging.writeToFile(request.META.get('REMOTE_ADDR')) + logging.writeToFile(get_client_ip(request)) final_dic = {'error_message': "Session reuse detected, IPAddress logged.", "errorMessage": "Session reuse detected, IPAddress logged."} final_json = json.dumps(final_dic) @@ -117,4 +122,4 @@ class secMiddleware: response['X-Content-Type-Options'] = "nosniff" response['Referrer-Policy'] = "same-origin" - return response \ No newline at end of file + return response diff --git a/backup/backupManager.py b/backup/backupManager.py index 21314a4b2..c42b706d6 100755 --- a/backup/backupManager.py +++ b/backup/backupManager.py @@ -696,7 +696,7 @@ class BackupManager: finalDic['port'] = "22" try: - finalDic['user'] = data['user'] + finalDic['user'] = data['userName'] except: finalDic['user'] = "root" diff --git a/backup/templates/backup/backup.html b/backup/templates/backup/backup.html index 76dc4a5bc..86e35b2aa 100755 --- a/backup/templates/backup/backup.html +++ b/backup/templates/backup/backup.html @@ -22,7 +22,6 @@
-
diff --git a/baseTemplate/static/baseTemplate/assets/themes/admin/layout.css b/baseTemplate/static/baseTemplate/assets/themes/admin/layout.css index 5b602b8dc..704e7c221 100755 --- a/baseTemplate/static/baseTemplate/assets/themes/admin/layout.css +++ b/baseTemplate/static/baseTemplate/assets/themes/admin/layout.css @@ -528,9 +528,9 @@ body #nav-toggle.collapsed span { width: 100px; } .closed-sidebar #header-logo .logo-content-small { - width: 62px; + width: 50px; margin-left: 0; - left: 0px; + left: 15px; display: block; } .closed-sidebar #header-logo .logo-content-big { diff --git a/baseTemplate/templates/baseTemplate/index.html b/baseTemplate/templates/baseTemplate/index.html index 0ee2436eb..70a269a00 100755 --- a/baseTemplate/templates/baseTemplate/index.html +++ b/baseTemplate/templates/baseTemplate/index.html @@ -90,7 +90,8 @@ - + {% block styles %} {% endblock %} @@ -115,11 +116,6 @@ -
- - - -
@@ -174,7 +170,6 @@
-
@@ -203,60 +198,20 @@
-
- -
-
- {$ one $} - {$ two $} - {$ three $} @@ -324,20 +279,19 @@ -
+
+
@@ -740,7 +694,7 @@ {% endif %} -
+ {% if admin %} @@ -1047,10 +1001,8 @@ {% endif %} - -
@@ -1061,13 +1013,8 @@
- - - - - @@ -1084,7 +1031,6 @@ - diff --git a/baseTemplate/views.py b/baseTemplate/views.py index ce4631b23..b1ee88909 100755 --- a/baseTemplate/views.py +++ b/baseTemplate/views.py @@ -66,6 +66,8 @@ def getAdminStatus(request): def getSystemStatus(request): try: + val = request.session['userID'] + currentACL = ACLManager.loadedACL(val) HTTPData = SystemInformation.getSystemInformation() json_data = json.dumps(HTTPData) return HttpResponse(json_data) @@ -195,4 +197,4 @@ def upgradeVersion(request): return HttpResponse("Version upgrade OK.") except BaseException as msg: logging.CyberCPLogFileWriter.writeToFile(str(msg)) - return HttpResponse(str(msg)) \ No newline at end of file + return HttpResponse(str(msg)) diff --git a/cyberpanel.sh b/cyberpanel.sh index 5c672a5b6..38c8dd290 100644 --- a/cyberpanel.sh +++ b/cyberpanel.sh @@ -73,6 +73,15 @@ Panel_Version=${Temp_Value:12:3} Panel_Build=${Temp_Value:25:1} Branch_Name="v${Panel_Version}.${Panel_Build}" + +if [[ $Branch_Name = v*.*.* ]] ; then + echo -e "\nBranch name fetched...$Branch_Name" +else + echo -e "\nUnable to fetch Branch name..." + echo -e "\nPlease try again in few moments, if this error still happens, please contact support" + exit +fi + Base_Number="1.9.3" Total_RAM=$(free -m | awk '/Mem:/ { print $2 }') @@ -165,12 +174,7 @@ Retry_Command() { # shellcheck disable=SC2034 for i in {1..50}; do - 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 + $1 && break || echo -e "\n$1 has failed for $i times\nWait for 3 seconds and try again...\n"; sleep 3; done } @@ -234,6 +238,16 @@ if [[ ! -f /etc/os-release ]] ; then exit fi +# Reference: https://unix.stackexchange.com/questions/116539/how-to-detect-the-desktop-environment-in-a-bash-script +if [ -z "$XDG_CURRENT_DESKTOP" ]; then + echo "Desktop OS not detected. Proceeding" +else + echo "$XDG_CURRENT_DESKTOP defined appears to be a desktop OS. Bailing as CyberPanel is incompatible." + echo -e "\nCyberPanel is supported on server OS types only. Such as Ubuntu 18.04 x86_64, Ubuntu 20.04 x86_64, Ubuntu 20.10 x86_64, CentOS 7.x, CentOS 8.x, AlmaLinux 8.x and CloudLinux 7.x...\n" + exit +fi + + if ! uname -m | grep -q 64 ; then echo -e "x64 system is required...\n" exit @@ -462,7 +476,7 @@ else Admin_Pass="1234567" else if [[ ${#1} -lt 8 ]]; then - echo -e "\nPassword lenth less than 8 digital, please choose a more complicated password.\n" + echo -e "\nPassword length less than 8 digital, please choose a more complicated password.\n" exit fi Admin_Pass="${1}" @@ -720,7 +734,7 @@ elif [[ $Tmp_Input =~ ^(s|S) ]]; then exit fi if [[ ${#Tmp_Input} -lt 8 ]]; then - echo -e "\nPassword lenth less than 8 digital, please choose a more complicated password.\n" + echo -e "\nPassword length less than 8 digital, please choose a more complicated password.\n" exit fi Tmp_Input1=$Tmp_Input @@ -964,7 +978,7 @@ if [[ "$Server_OS" = "CentOS" ]] ; then yum -y groupinstall development Check_Return elif [[ "$Server_OS_Version" = "8" ]] ; then - dnf install -y zip wget strace net-tools curl which bc telnet htop libevent-devel gcc libattr-devel xz-devel mariadb-devel curl-devel git platform-python-devel tar socat python3 zip unzip bind-utils + 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 platform-python-devel tar socat python3 zip unzip bind-utils Check_Return dnf install -y gpgme-devel Check_Return @@ -995,7 +1009,7 @@ else update-locale LC_ALL="en_US.UTF-8" fi -Debug_Log2 "Installing required virtual enviroment,3" +Debug_Log2 "Installing required virtual environment,3" export LC_CTYPE=en_US.UTF-8 export LC_ALL=en_US.UTF-8 @@ -1042,7 +1056,7 @@ Debug_Log2 "Necessary components installed..,5" } Pre_Install_System_Tweak() { -Debug_Log2 "Setting up sytem tweak...,20" +Debug_Log2 "Setting up system tweak...,20" Line_Number=$(grep -n "127.0.0.1" /etc/hosts | cut -d: -f 1) My_Hostname=$(hostname) @@ -1100,12 +1114,6 @@ if ! grep -q "pid_max" /etc/rc.local 2>/dev/null ; then echo "echo 1000000 > /proc/sys/kernel/pid_max echo 1 > /sys/kernel/mm/ksm/run" >>/etc/rc.local chmod +x /etc/rc.local - fi - if grep -q "nf_conntrack_max" /etc/sysctl.conf ; then - sysctl -w net.netfilter.nf_conntrack_max=2097152 > /dev/null - sysctl -w net.nf_conntrack_max=2097152 > /dev/null - echo "net.netfilter.nf_conntrack_max=2097152" >> /etc/sysctl.conf - echo "net.nf_conntrack_max=2097152" >> /etc/sysctl.conf fi echo "fs.file-max = 65535" >>/etc/sysctl.conf sysctl -p >/dev/null @@ -1214,8 +1222,8 @@ else fi if ./lshttpd -V |& grep "ERROR" || ./lshttpd -V |& grep "expire in 0 days" ; then - echo -e "\n\nIt apeears to have some issue with license , please check above result..." - Debug_Log2 "It appears to have some issue with LiteSpeed License, make sure you are using correct serial key. [404]" + echo -e "\n\nThere appears to be an issue with license , please check above result..." + Debug_Log2 "There appears to be an issue with LiteSpeed License, make sure you are using correct serial key. [404]" exit fi @@ -1832,6 +1840,7 @@ fi # If valid hostname is set that resolves externally we can issue an ssl. This will create the hostname as a website so we can issue the SSL and do our first login without SSL warnings or exceptions needed. HostName=$(hostname --fqdn); [ -n "$(dig @1.1.1.1 +short "$HostName")" ] && echo "$HostName resolves to valid IP. Setting up hostname SSL" && cyberpanel createWebsite --package Default --owner admin --domainName $(hostname --fqdn) --email root@localhost --php 7.4 && cyberpanel hostNameSSL --domainName $(hostname --fqdn) + } Post_Install_CN_Replacement() { diff --git a/filemanager/templates/filemanager/index.html b/filemanager/templates/filemanager/index.html index 9d85987e4..00fba9a4f 100755 --- a/filemanager/templates/filemanager/index.html +++ b/filemanager/templates/filemanager/index.html @@ -41,7 +41,7 @@