Sysfilter with /etc/localdomains

stephancasas

Registered
Jan 1, 2019
4
1
3
San Antonio, Texas
cPanel Access Level
Root Administrator
For diagnostics, I've written a very simple filter for inclusion in `/usr/local/cpanel/etc/exim/sysfilter/options`:
Code:
if
"${if match_domain{${domain:$h_from:}}{+local_domains} {yes} {no}}" contains "yes"
then
freeze
endif
The intention is to use this to suspend outbound message delivery while testing our relay server. However, once the filter is applied and engaged, EXIM is yielding a permissions error on `/etc/localdomains`. I can override the error by doing a `chmod` operation on the file but this is, of course, undone once the EXIM configuration is rebuilt in cPanel.

For context, I've also tried writing the filter by accessing the file directly:
Code:
if
"${lookup {${domain:$h_from:}} lsearch {/etc/localdomains} {yes} {no}}" contains "yes"
then
freeze
endif
The same permissions error still occurs. My understanding was that EXIM operated from the `root` user, so I'm not really sure why this error is showing up given that the localdomains file is owned by root. Is there a better or alternate way to test for a local domain?

Any insight on this matter is greatly appreciated!

Cheers,
Stephan
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
15,307
2,440
363
cPanel Access Level
Root Administrator
Hey there! That's definitely the best file to check the mail delivery. On my personal server I see the following permissions and ownership:

Code:
-rw-r----- 1 root mail 350 Dec 16 12:15 /etc/localdomains
Is your file getting reset to something different?
 

stephancasas

Registered
Jan 1, 2019
4
1
3
San Antonio, Texas
cPanel Access Level
Root Administrator
Hey there! That's definitely the best file to check the mail delivery. On my personal server I see the following permissions and ownership:

Code:
-rw-r----- 1 root mail 350 Dec 16 12:15 /etc/localdomains
Is your file getting reset to something different?

So sorry that I didn't see this response sooner. It doesn't look like I got a notification when it posted. :(

I've just reloaded the EXIM configuration in WHM and checked the permissions. My output matches yours exactly, but I still get a permissions error on my custom filter. Very strange. Any ideas?
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
15,307
2,440
363
cPanel Access Level
Root Administrator
All the standard files in /usr/local/cpanel/etc/exim/sysfilter/options are owned by root as well, but none of them include other files either as the defaults are all performing filtering within the files themselves.

Did you just create a file inside /usr/local/cpanel/etc/exim/sysfilter/options? I'd like to reproduce this on a test machine so knowing the steps you took would be helpful.