Exim configuration rebuild fails when Mailscanner is installed
Subject: Exim configuration rebuild fails — erroneous .include_if_exists insertion in routers section (MailScanner integration)
Environment:
- cPanel & WHM version: 136.0.37
- Exim version: 4.99.5 (#2, built 24-Jul-2026)
- OS: AlmaLinux 8
- Third-party mail filtering: ConfigServer MailScanner Front-End (MSFE), installed under /usr/msfe and /usr/mscpanel
Summary:
Any attempt to save changes through WHM > Service Configuration > Exim Configuration Manager > Advanced Editor fails the dry run with a syntax error, even when the only change being saved is a single, syntactically valid line added to the custom_begin_recipient hook. The error is unrelated to the change being made and instead points to /usr/msfe/mailscannerq.conf.
Exact error returned by the dry run:
"Exim configuration error in line 2 of /usr/msfe/mailscannerq.conf:
option \"accept\" unknown"
Root cause identified:
The file /usr/msfe/mailscannerq.conf contains valid Exim ACL syntax (an "accept" verb with remove_header/queue/control modifiers), intended to be included only inside an ACL context. It is correctly included once, inside acl_smtp_mail, via the legitimate custom_begin_mail_pre hook (stored at /usr/local/cpanel/etc/exim/acls/ACL_MAIL_PRE_BLOCK/custom_begin_mail_pre).
However, when cPanel rebuilds/validates the full Exim configuration (via the Advanced Editor dry run, or via buildeximconf during an update), a SECOND .include_if_exists /usr/msfe/mailscannerq.conf line is being inserted into the "begin routers" section of the generated config — immediately after the comment "# cPanel Mail Archiving is disabled" and before the check_mail_permissions router. Since the included file's content is only valid ACL syntax, this second inclusion is invalid in a routers context and breaks the entire configuration build.
Evidence gathered:
1. grep -n "mailscannerq" /etc/exim.conf (the current live, running configuration) shows only ONE occurrence, inside acl_smtp_mail — the valid one. This confirms the live config predates whatever change introduced the second, erroneous inclusion.
2. /var/cpanel/updatelogs/ contains logs from 2026-08-06 showing this exact same syntax error ("option \"accept\" unknown" at line 2 of /usr/msfe/mailscannerq.conf) occurring during a routine, automatic cPanel update process — i.e., this is not something we introduced; the Exim config has been failing to rebuild since at least that date.
3. grep -rl "mailscannerq" /usr/local/cpanel/ only returns the legitimate hook files under /usr/local/cpanel/etc/exim/acls/ACL_MAIL_PRE_BLOCK/ (custom_begin_mail_pre and its .dry_run copy). No hook file corresponds to the erroneous router-section inclusion, indicating it is generated by internal cPanel Exim-config-building logic rather than by any user-editable Advanced Editor field.
Impact:
- We cannot save any new Advanced Editor / ACL customizations, since every dry run fails regardless of the change being made.
- More critically, any future cPanel update or manual buildeximconf run that regenerates /etc/exim.conf from scratch would fail, potentially leaving the mail server without a valid Exim configuration and without a way to receive/send mail.
Do any of you know which internal cPanel component/logic is responsible for inserting .include_if_exists /usr/msfe/mailscannerq.conf into the routers section, and advise on a supported fix or workaround that does not disrupt our working MailScanner (ConfigServer MSFE) integration in acl_smtp_mail?
Thank you.
Please sign in to leave a comment.
Comments
0 comments