The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Exim Filter To block Outgoing Email

Discussion in 'E-mail Discussions' started by Osama Tariq, Mar 16, 2017.

Tags:
  1. Osama Tariq

    Osama Tariq Well-Known Member

    Joined:
    Nov 27, 2014
    Messages:
    205
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    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 monitoring@domainone.com.
    I have tried alot and manupuliate below acl, but all my efforts were in vein.

    Code:
    if $sender_address is "block@domainone.com"
    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 monitoring@domainone.com
      fail text "This message has been rejected"
    seen finish
    endif
    
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,037
    Likes Received:
    1,278
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
  3. Osama Tariq

    Osama Tariq Well-Known Member

    Joined:
    Nov 27, 2014
    Messages:
    205
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    Lahore, Pakistan
    cPanel Access Level:
    Root Administrator
    Twitter:
    The link you have mentioned is not related to my question. I want to send internal domain email for specific address and if he sent out of domain than the mail is rejected and sent copy to monitoring@domainone.com.
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,037
    Likes Received:
    1,278
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
  5. Osama Tariq

    Osama Tariq Well-Known Member

    Joined:
    Nov 27, 2014
    Messages:
    205
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    Lahore, Pakistan
    cPanel Access Level:
    Root Administrator
    Twitter:
    Yes i want to add a custom filter rule. I tried the above mentioned filter but its not working properly.
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,037
    Likes Received:
    1,278
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    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.
     
  7. Osama Tariq

    Osama Tariq Well-Known Member

    Joined:
    Nov 27, 2014
    Messages:
    205
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    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 <= block@domainone.com H=([IP]) [::1]:47267 P=esmtpa A=dovecot_login:
    block@domainone.com
    S=704 id=5969b4f1e76c324a2f99f982b9a8f01a.squirrel@IP T="check email" for xyz@gmail.com
    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 xyz@gmail.com
    2017-03-24 22:33:43 1crT5o-00027x-NT => xyz@gmail.com 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
     
  8. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,037
    Likes Received:
    1,278
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

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

    Thank you.
     
  9. Osama Tariq

    Osama Tariq Well-Known Member

    Joined:
    Nov 27, 2014
    Messages:
    205
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    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 block@Domainone 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 "block@Domainone"
    and ("$h_to:" does not matches "Domainone")
    or ("$h_cc:" does not matches "Domainone")
    or ("$h_bcc:" does not matches "Domainone")
    then
      unseen deliver monitoring@Domainone
      fail text "This message has been rejected"
    seen finish
    endif
    

    TO:
    xyz@gmail.com
    This message has been rejected
    CC:
    check@Domainone
    This message has been rejected

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

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,037
    Likes Received:
    1,278
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    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.
     
  11. Osama Tariq

    Osama Tariq Well-Known Member

    Joined:
    Nov 27, 2014
    Messages:
    205
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    Lahore, Pakistan
    cPanel Access Level:
    Root Administrator
    Twitter:
    That is not the affected system, its just to implement filter.
     
  12. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,037
    Likes Received:
    1,278
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page