From 49e3149622dd7bfcdc34da60d81cef88252c4f63 Mon Sep 17 00:00:00 2001 From: Master3395 Date: Wed, 24 Sep 2025 00:36:38 +0200 Subject: [PATCH] Update MariaDB repository URLs to use HTTPS and enhance setup logic for RHEL 9/10 in cyberpanel.sh; modify permission commands in install.py to use raw string literals for better compatibility. --- cyberpanel.sh | 57 ++++++++++++++++++++++++++++++---------------- install/install.py | 28 +++++++++++------------ 2 files changed, 52 insertions(+), 33 deletions(-) diff --git a/cyberpanel.sh b/cyberpanel.sh index 00bd65724..d48b7944e 100644 --- a/cyberpanel.sh +++ b/cyberpanel.sh @@ -451,7 +451,7 @@ setup_mariadb_repo() { # http://downloads.mariadb.org/mariadb/repositories/ [mariadb] name = MariaDB -baseurl = http://yum.mariadb.org/10.4/centos7-amd64 +baseurl = https://yum.mariadb.org/10.4/centos7-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1 EOF @@ -461,34 +461,45 @@ EOF # http://downloads.mariadb.org/mariadb/repositories/ [mariadb] name = MariaDB -baseurl = http://yum.mariadb.org/10.11/rhel8-amd64 +baseurl = https://yum.mariadb.org/10.11/rhel8-amd64 module_hotfixes=1 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1 EOF elif [[ "$Server_OS_Version" = "9" ]] && uname -m | grep -q 'x86_64'; then - cat </etc/yum.repos.d/MariaDB.repo -# MariaDB 10.11 CentOS repository list - created 2021-08-06 02:01 UTC + # Use official MariaDB repository setup script for RHEL 9+ systems + curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | bash -s -- --mariadb-server-version='10.11' --skip-maxscale --skip-tools + if [ $? -ne 0 ]; then + # Fallback to manual setup + cat </etc/yum.repos.d/MariaDB.repo +# MariaDB 10.11 RHEL9+ repository list # http://downloads.mariadb.org/mariadb/repositories/ [mariadb] name = MariaDB -baseurl = http://yum.mariadb.org/10.11/rhel9-amd64/ +baseurl = https://yum.mariadb.org/10.11/rhel9-amd64/ gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB enabled=1 gpgcheck=1 -EOF - elif [[ "$Server_OS_Version" = "10" ]] && uname -m | grep -q 'x86_64'; then - cat </etc/yum.repos.d/MariaDB.repo -# MariaDB 10.11 RHEL10 repository list - AlmaLinux 10 compatible -# http://downloads.mariadb.org/mariadb/repositories/ -[mariadb] -name = MariaDB -baseurl = http://yum.mariadb.org/10.11/rhel10-amd64/ module_hotfixes=1 +EOF + fi + elif [[ "$Server_OS_Version" = "10" ]] && uname -m | grep -q 'x86_64'; then + # Use official MariaDB repository setup script for RHEL 10+ systems + curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | bash -s -- --mariadb-server-version='10.11' --skip-maxscale --skip-tools + if [ $? -ne 0 ]; then + # Fallback to manual setup + cat </etc/yum.repos.d/MariaDB.repo +# MariaDB 10.11 RHEL10+ repository list +# http://downloads.mariadb.org/mariadb/repositories/ +[mariadb] +name = MariaDB +baseurl = https://yum.mariadb.org/10.11/rhel9-amd64/ gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB enabled=1 gpgcheck=1 +module_hotfixes=1 EOF + fi fi } @@ -1567,19 +1578,27 @@ if [[ "$Server_OS" =~ ^(CentOS|RHEL|AlmaLinux|RockyLinux|CloudLinux|openEuler) ] dnf install -y epel-release Check_Return "EPEL repository" "no_exit" - # Setup MariaDB repository for AlmaLinux 9/10 - using the working method from 2.4.3 - if [[ "$Server_OS" =~ ^(AlmaLinux9|AlmaLinux10) ]] ; then - cat </etc/yum.repos.d/MariaDB.repo -# MariaDB 10.11 CentOS repository list - created 2021-08-06 02:01 UTC + # Setup MariaDB repository for RHEL 9+ based systems (AlmaLinux 9/10, RockyLinux 9, RHEL 9) + if [[ "$Server_OS" =~ ^(AlmaLinux9|AlmaLinux10|RockyLinux9|RHEL9) ]] ; then + # Use the official MariaDB repository setup script for better compatibility + curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | bash -s -- --mariadb-server-version='10.11' --skip-maxscale --skip-tools + Check_Return "MariaDB repository setup" "no_exit" + + # Fallback manual repository setup if the script fails + if [ ! -f /etc/yum.repos.d/mariadb.repo ]; then + cat </etc/yum.repos.d/MariaDB.repo +# MariaDB 10.11 RHEL9+ repository list # http://downloads.mariadb.org/mariadb/repositories/ [mariadb] name = MariaDB -baseurl = http://yum.mariadb.org/10.11/rhel9-amd64/ +baseurl = https://yum.mariadb.org/10.11/rhel9-amd64/ gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB enabled=1 gpgcheck=1 +module_hotfixes=1 EOF - Check_Return "MariaDB repository setup" "no_exit" + Check_Return "MariaDB repository fallback setup" "no_exit" + fi fi dnf install -y libnsl zip wget strace net-tools curl which bc telnet htop libevent-devel gcc libattr-devel xz-devel MariaDB-server MariaDB-client MariaDB-devel curl-devel git platform-python-devel tar socat python3 zip unzip bind-utils openssl-devel boost-devel boost-program-options diff --git a/install/install.py b/install/install.py index 8af131d41..1ad5b0db3 100644 --- a/install/install.py +++ b/install/install.py @@ -889,10 +889,10 @@ class Migration(migrations.Migration): command = "usermod -G lscpd,lsadm,nogroup lscpd" preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) - command = "find /usr/local/CyberCP -type d -exec chmod 0755 {} \;" + command = r"find /usr/local/CyberCP -type d -exec chmod 0755 {} \;" preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) - command = "find /usr/local/CyberCP -type f -exec chmod 0644 {} \;" + command = r"find /usr/local/CyberCP -type f -exec chmod 0644 {} \;" preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) command = "chmod -R 755 /usr/local/CyberCP/bin" @@ -905,10 +905,10 @@ class Migration(migrations.Migration): ########### Fix LSCPD - command = "find /usr/local/lscp -type d -exec chmod 0755 {} \;" + command = r"find /usr/local/lscp -type d -exec chmod 0755 {} \;" preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) - command = "find /usr/local/lscp -type f -exec chmod 0644 {} \;" + command = r"find /usr/local/lscp -type f -exec chmod 0644 {} \;" preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) command = "chmod -R 755 /usr/local/lscp/bin" @@ -1663,12 +1663,12 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout'; os.chdir("/usr/local/CyberCP/public/snappymail") - command = 'find . -type d -exec chmod 755 {} \;' + command = r'find . -type d -exec chmod 755 {} \;' preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) ############# - command = 'find . -type f -exec chmod 644 {} \;' + command = r'find . -type f -exec chmod 644 {} \;' preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) ###### @@ -3234,11 +3234,11 @@ vmail time.sleep(3) # Check if service is actually running - command = f'systemctl is-active {pdns_service}' - try: + command = f'systemctl is-active {pdns_service}' + try: result = subprocess.run(command, shell=True, capture_output=True, text=True, timeout=10) output = result.stdout.strip() - if output == 'active': + if output == 'active': preFlightsChecks.stdOut("PowerDNS service started successfully!", 1) # Double-check with systemctl status for more details status_command = f'systemctl status {pdns_service} --no-pager -l' @@ -3246,9 +3246,9 @@ vmail status_result = subprocess.run(status_command, shell=True, capture_output=True, text=True, timeout=10) if status_result.returncode == 0: preFlightsChecks.stdOut("PowerDNS service status verified", 1) - else: + else: preFlightsChecks.stdOut("PowerDNS service running but status check failed", 0) - except: + except: preFlightsChecks.stdOut("PowerDNS service running but status verification failed", 0) break else: @@ -3308,10 +3308,10 @@ vmail release = install_utils.get_Ubuntu_release(use_print=False, exit_on_error=False) if release and release >= 24.04: preFlightsChecks.stdOut("Configuring Pure-FTPd for Ubuntu 24.04...") - command = f"sed -i 's/MYSQLCrypt md5/MYSQLCrypt crypt/g' {config_file}" + command = f"sed -i 's/MYSQLCrypt md5/MYSQLCrypt crypt/g' {config_file}" preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) except: - pass + pass # Start Pure-FTPd service with retry mechanism max_retries = 3 @@ -3651,7 +3651,7 @@ admin_password = "12345" """) writeToFile.close() - content = """