Guest User

Untitled

a guest
Jan 4th, 2025
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.92 KB | None | 0 0
  1. acl_check_rcpt:
  2.  
  3. # only allow local domains to send
  4. accept condition = ${if match_local_part{$sender_address_domain}{lsearch;/etc/exim/domains} {yes}{no}}
  5. message = "Sender domain allowed for sending"
  6. deny message = "Sender domain NOT allowed for sending"
  7.  
  8. .ifdef VIRUS_SCAN
  9. warn
  10. set acl_m3 = no
  11. warn
  12. condition = ${lookup{$domain}lsearch{/etc/clamav.whitelist} {yes}{no}}
  13. set acl_m3 = ok
  14. .endif
  15.  
  16. accept hosts = +relay_from_hosts
  17. !authenticated = *
  18. set acl_m6 = whitelisted
  19.  
  20. accept domains = +local_domains : +relay_to_domains
  21. condition = ${lookup{$sender_address}wildlsearch{/etc/exim/whitelist}{yes}{no}}
  22. set acl_m6 = whitelisted
  23. logwrite = Accepted from $sender_address to $local_part@$domain by whitelist.
  24.  
  25. accept domains = +local_domains : +relay_to_domains
  26. hosts = net-lsearch;/etc/exim/whitelist
  27. set acl_m6 = whitelisted
  28. logwrite = Accepted from $sender_address to $local_part@$domain by whitelist.
  29.  
  30. deny condition = ${lookup{$sender_address}wildlsearch{/etc/exim/blacklist}{yes}{no}}
  31. set acl_m6 = blacklisted
  32. logwrite = Rejected from $sender_address to $local_part@$domain by blacklist.
  33.  
  34. deny hosts = net-lsearch;/etc/exim/blacklist
  35. set acl_m6 = blacklisted
  36. logwrite = Rejected from $sender_address to $local_part@$domain by blacklist.
  37.  
  38. deny message = Restricted characters in address
  39. domains = +local_domains
  40. local_parts = ^[.] : ^.*[@%!/|]
  41.  
  42. deny message = Restricted characters in address
  43. domains = !+local_domains
  44. local_parts = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
  45.  
  46. accept local_parts = postmaster
  47. verify = recipient
  48. domains = +local_domains
  49.  
  50. require verify = sender
  51.  
  52. # check ratelimits by emails
  53. warn authenticated = *
  54. set acl_c0 = group${extract{2}{:}{${lookup{$authenticated_id}lsearch{/etc/exim/passwd}}}}
  55. set acl_c1 = ${lookup{$authenticated_id}lsearch*{/etc/exim/ratelimits}}
  56. ratelimit = ${lookup{$acl_c0}lsearch*{/etc/exim/ratelimits}} / 1h / strict / $acl_c0
  57. ratelimit = $acl_c1 / 1h / strict / $authenticated_id
  58. log_message = Sender rate overlimit - $sender_rate / $sender_rate_period / $authenticated_id
  59. condition = ${if match_local_part{$authenticated_id}{lsearch;/etc/exim/ratelimits} {yes}{no}}
  60. deny authenticated = *
  61. set acl_c1 = ${lookup{$authenticated_id}lsearch*{/etc/exim/ratelimits}}
  62. ratelimit = $acl_c1 / 1h / leaky / $authenticated_id
  63. message = Sender rate overlimit - $sender_rate / $sender_rate_period / $authenticated_id
  64. condition = ${if match_local_part{$authenticated_id}{lsearch;/etc/exim/ratelimits} {yes}{no}}
  65. # check ratelimits by group
  66. warn authenticated = *
  67. set acl_c0 = group${extract{2}{:}{${lookup{$authenticated_id}lsearch{/etc/exim/passwd}}}}
  68. ratelimit = ${lookup{$acl_c0}lsearch*{/etc/exim/ratelimits}} / 1h / strict / $acl_c0
  69. log_message = Sender rate overlimit - $sender_rate / $sender_rate_period / $acl_c0
  70. condition = ${if match_local_part{$acl_c0}{lsearch;/etc/exim/ratelimits} {yes}{no}}
  71. deny authenticated = *
  72. set acl_c0 = group${extract{2}{:}{${lookup{$authenticated_id}lsearch{/etc/exim/passwd}}}}
  73. ratelimit = ${lookup{$acl_c0}lsearch*{/etc/exim/ratelimits}} / 1h / leaky / $acl_c0
  74. message = Sender rate overlimit - $sender_rate / $sender_rate_period / $acl_c0
  75. condition = ${if match_local_part{$acl_c0}{lsearch;/etc/exim/ratelimits} {yes}{no}}
  76. .ifdef DEFAULT_RATELIMIT
  77. # check ratelimits by default
  78. deny authenticated = *
  79. ratelimit = DEFAULT_RATELIMIT / 1h / strict / $authenticated_id
  80. message = Sender rate overlimit - $sender_rate / $sender_rate_period / $authenticated_id
  81. condition = ${if or{{eq{$acl_c1}{}}{eq{$acl_c0}{}}}{yes}{no}}
  82. .endif
  83.  
  84. accept hosts = +relay_from_hosts
  85. !authenticated = *
  86. control = submission/sender_retain
  87.  
  88.  
  89. accept authenticated = *
  90. condition = ${if eq{${extract{5}{:}{${lookup{$authenticated_id}lsearch{/etc/exim/passwd}}}}}{no} {yes}{no}}
  91. condition = ${if eq{${extract{3}{:}{${lookup{${domain:$authenticated_id}}lsearch{/etc/exim/domains}}}}}{no} {yes}{no}}
  92. control = submission/domain=
  93.  
  94. deny message = rejected because $sender_host_address is in a black list at $dnslist_domain\\n$dnslist_text
  95. dnslists = ${readfile {/etc/exim/dnsbllist}{:}}
  96.  
  97. require message = relay not permitted
  98. domains = +local_domains : +relay_to_domains
  99.  
  100. require verify = recipient
  101.  
  102. .ifdef POSTGREY_SOCKET
  103. defer log_message = greylisted host $sender_host_address
  104. set acl_m0 = request=smtpd_access_policy\nprotocol_state=RCPT\nprotocol_name=${uc:$received_protocol}\nhelo_name=$sender_helo_name\nclient_address=$sender_hos>
  105. set acl_m0 = ${sg{${readsocket{POSTGREY_SOCKET}{$acl_m0}{5s}{}{action=DUNNO}}}{action=}{}}
  106. message = ${sg{$acl_m0}{^\\w+\\s*}{}}
  107. condition = ${if eq{${uc:${substr{0}{5}{$acl_m0}}}}{DEFER}{true}{false}}
  108. .endif
  109.  
  110. accept
Advertisement
Add Comment
Please, Sign In to add comment