From cc9d830507595196978887b4dbb3bde9fadd9d80 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Fri, 6 Mar 2026 18:36:41 +0500 Subject: [PATCH] Fix SMTP relay on AlmaLinux/RHEL: install cyrus-sasl-plain package Postfix SASL PLAIN auth fails with "No worthy mechs found" on RHEL/AlmaLinux because cyrus-sasl-plain is not installed by default. - Add cyrus-sasl-plain to postfix install in install.py - Auto-install in configureRelayHost() for existing servers - Add to upgrade.py setupSieve() for existing installations --- install/install.py | 4 ++-- plogical/mailUtilities.py | 6 ++++++ plogical/upgrade.py | 5 +++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/install/install.py b/install/install.py index 02e893aca..d4e285490 100644 --- a/install/install.py +++ b/install/install.py @@ -1018,10 +1018,10 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout'; command = 'dnf --nogpg install -y https://mirror.ghettoforge.net/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' + command = 'dnf install --enablerepo=gf-plus postfix3 postfix3-mysql cyrus-sasl-plain -y' preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) elif self.distro == openeuler: - command = 'dnf install postfix -y' + command = 'dnf install postfix cyrus-sasl-plain -y' preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) else: diff --git a/plogical/mailUtilities.py b/plogical/mailUtilities.py index 261ff314a..878ca4521 100644 --- a/plogical/mailUtilities.py +++ b/plogical/mailUtilities.py @@ -1707,6 +1707,12 @@ LogFile /var/log/clamav/clamav.log @staticmethod def configureRelayHost(smtpHost, smtpPort, smtpUser, smtpPassword): try: + ## Ensure cyrus-sasl-plain is installed (required for SASL PLAIN auth on RHEL/Alma/CentOS) + if os.path.exists('/etc/redhat-release'): + ProcessUtilities.executioner('dnf install -y cyrus-sasl-plain') + elif os.path.exists('/usr/bin/apt-get'): + ProcessUtilities.executioner('apt-get install -y libsasl2-modules') + postfixPath = '/etc/postfix/main.cf' with open(postfixPath, 'r') as f: diff --git a/plogical/upgrade.py b/plogical/upgrade.py index ce1f01f23..c62dae39e 100644 --- a/plogical/upgrade.py +++ b/plogical/upgrade.py @@ -2857,6 +2857,11 @@ CREATE TABLE `websiteFunctions_backupsv2` (`id` integer AUTO_INCREMENT NOT NULL Upgrade.stdOut("Dovecot not installed, skipping Sieve setup.", 0) return + ## Ensure cyrus-sasl-plain is installed (needed for SMTP relay on RHEL/Alma/CentOS) + if os.path.exists('/etc/redhat-release'): + command = 'dnf install -y cyrus-sasl-plain' + ProcessUtilities.executioner(command) + import re dovecot_conf = '/etc/dovecot/dovecot.conf'