From abc901f1c82e8151d01dc0352a46a73755c581b7 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Fri, 6 Mar 2026 17:10:08 +0500 Subject: [PATCH] Fix fresh install crash: replace plogical imports in installCyberPanel.py installSieve() and setupWebmail() imported from plogical module which doesn't exist during fresh install (CyberPanel code not yet deployed). - Replace FirewallUtilities.addSieveFirewallRule() with direct firewall-cmd/ufw calls - Replace generate_pass() with inline secrets.choice() password generation --- install/installCyberPanel.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/install/installCyberPanel.py b/install/installCyberPanel.py index 9bde377ef..93f5f6cd2 100644 --- a/install/installCyberPanel.py +++ b/install/installCyberPanel.py @@ -717,8 +717,13 @@ protocol sieve { """) # Add Sieve port 4190 to firewall - from plogical.firewallUtilities import FirewallUtilities - FirewallUtilities.addSieveFirewallRule() + try: + import firewall.core.fw as fw + subprocess.call(['firewall-cmd', '--permanent', '--add-port=4190/tcp'], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) + subprocess.call(['firewall-cmd', '--reload'], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) + except Exception: + # firewalld may not be available, try ufw + subprocess.call(['ufw', 'allow', '4190/tcp'], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) InstallCyberPanel.stdOut("Sieve successfully installed and configured!", 1) return 1 @@ -743,9 +748,9 @@ protocol sieve { InstallCyberPanel.stdOut("Setting up webmail master user for SSO...", 1) - from plogical.randomPassword import generate_pass - - master_password = generate_pass(32) + import secrets, string + chars = string.ascii_letters + string.digits + master_password = ''.join(secrets.choice(chars) for _ in range(32)) # Hash the password using doveadm result = subprocess.run(