Recent MailScanner Patch On Exim 4.100 Not Working
This is in regards to https://support.cpanel.net/hc/en-us/articles/43420413359639-Messages-stuck-in-Exim-queue-after-update-to-cpanel-exim-4-100-when-MailScanner-is-enabled
Thanks to https://support.cpanel.net/hc/en-us/profiles/1529108899102-Kyle-Klotz and whoever devised the MailScanner patch for providing the solution.
I'm used to MSFE and wanted to keep using it, so applied the 'tab 2' (Apply Manual Update to Mailscanner) patch.
On my system, though, it squwacked:
# perl -i.bak-exim4100 -pe 's/^(\s*)if ($ver >= 4.97) {/$1my ($vmaj, $vmin) = $ver =~ /^(\d+)\.(\d+)/;\n$1if (defined $vmaj && ($vmaj > 4 || ($vmaj == 4 && $vmin >= 97))) {/' /usr/mailscanner/usr/sbin/MailScanner
Backslash found where operator expected at -e line 1, near ")\"
(Missing operator before \?)
syntax error at -e line 1, near "+)"
syntax error at -e line 1, near ") {"
Search pattern not terminated at -e line 1.
Current versions of exim and MailScanner:
# /usr/sbin/exim --version
Exim version 4.100 #2 built 07-Sep-2026 00:00:00
# /usr/mailscanner/usr/sbin/MailScanner --version
This is AlmaLinux release 9.8 (Olive Jaguar)
This is Perl version 5.042000 (5.42.0)
This is MailScanner version 5.4.4
Tried restarting MailScanner and re-queueing anyway, but still saw 'spool file not found' errors in /var/log/exim_mainlog, and nothing was being delivered to the users mailboxes.
There was something not right about that sed search/replace string, but I didn't feel like fixing it. Really all it was doing was searching the MailScanner script for where Exim's current version was being determined, declaring two new variables holding the major and minor versions of Exim separately rather than as a single var, then changing the 'if' statement right after that to account for the new vars.
So, you can just manually munge MailScanner, allowing MSFE to still work:
Even though you're only changing a couple of lines, backup your existing copy of /usr/mailscanner/usr/sbin/MailScanner just to be safe.
SSH into your server and edit the file:
vim /usr/mailscanner/usr/sbin/MailScanner
(or nano, however you prefer to edit files)
Find (approx line 380):
$ver =~ /\d+\.\d+/;
if ($ver >= 4.97) {
Replace with:
my ($vmaj, $vmin) = $ver =~ /^(\d+)\.(\d+)/;
if (defined $vmaj && ($vmaj > 4 || $vmaj == 4 && $vmin >= 97)) {
Save and close, restart MailScanner and re-queue per the post.
You should start seeing the queued messages start to come in, with no more 'spool not found' errors in exim_mainlog.
If you'd first tried disabling via MSFE to temporarily get messages to come in, you may see some dups as the queue processes again.
As to why this happened in the first place, with Exim now up to version 4.100, the version check being compared to '4.97' was failing ('4.100' >= '4.97' would return as false), so the code in 'EximDiskStoreNew.pm' was never being implemented.
Please sign in to leave a comment.
Comments
0 comments