Exim Filter To block Outgoing Email

Osama Tariq

Well-Known Member
Nov 27, 2014
206
2
18
Lahore, Pakistan
cPanel Access Level
Root Administrator
Twitter
The thing i want is to block outgoing-email(means outside from domainone.com) of specific user and send the copy of outgoing email to [email protected].
I have tried alot and manupuliate below acl, but all my efforts were in vein.

Code:
if $sender_address is "[email protected]"
and ("$h_to:" does not matches "domainone.com")
or ("$h_cc:" does not matches "domainone.com")
or ("$h_bcc:" does not matches "domainone.com")
then
  unseen deliver [email protected]
  fail text "This message has been rejected"
seen finish
endif
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,903
2,237
463

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,903
2,237
463
Hello,

What's the output from /var/log/exim_mainlog when you send a test message designed to trigger that filter rule? Also, could you outline the specific steps you have taken thus far to implement that custom filter rule?

Thank you.
 

Osama Tariq

Well-Known Member
Nov 27, 2014
206
2
18
Lahore, Pakistan
cPanel Access Level
Root Administrator
Twitter
When i sent email other that domainone.com:

Code:
2017-03-24 22:33:40 SMTP connection from [::1]:47267 (TCP/IP connection count = 1)
2017-03-24 22:33:41 1crT5o-00027x-NT <= [email protected] H=([IP]) [::1]:47267 P=esmtpa A=dovecot_login:
[email protected]
S=704 [email protected] T="check email" for [email protected]
2017-03-24 22:33:41 SMTP connection from ([IP) [::1]:47267 closed by QUIT
2017-03-24 22:33:41 cwd=/var/spool/exim 3 args: /usr/sbin/exim -Mc 1crT5o-00027x-NT
2017-03-24 22:33:41 1crT5o-00027x-NT SMTP connection outbound 1490376821 1crT5o-00027x-NT domainone [email protected]
2017-03-24 22:33:43 1crT5o-00027x-NT => [email protected] R=dkim_lookuphost T=dkim_remote_smtp H=aspmx.l.google.com [74.125.133.27] X=TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128 CV=yes C="250 2.0.0 OK 1490376753 i21si3476307wrc.136 - gsmtp"
2017-03-24 22:33:43 1crT5o-00027x-NT Completed
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,903
2,237
463
Hello,

Could you also outline the specific steps you have taken thus far to implement that custom filter rule?

Thank you.
 

Osama Tariq

Well-Known Member
Nov 27, 2014
206
2
18
Lahore, Pakistan
cPanel Access Level
Root Administrator
Twitter
Right now this filter is not working properly. Any email id with Domainone is unable to sent email outside that domain, just block and sent email to unseen address.
Actually instead of any email id it should only block [email protected] email id to sent email outside that Domainone and if cc and bbc matches to Domainone that it allows only cc/bcc.

Code:
if $sender_address is "[email protected]"
and ("$h_to:" does not matches "Domainone")
or ("$h_cc:" does not matches "Domainone")
or ("$h_bcc:" does not matches "Domainone")
then
  unseen deliver [email protected]
  fail text "This message has been rejected"
seen finish
endif

TO:
x[email protected]
This message has been rejected
CC:
c[email protected]
This message has been rejected

CC email should be deliver because it's same domain address.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,903
2,237
463
Hello,

Could you open a support ticket using the link in my signature so we can review the affected system and take a closer look at what's happening? You can post the ticket number here so we can update this thread with the outcome.

Thank you.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,903
2,237
463