Advertisement
Twissel

Untitled

Sep 23rd, 2017
589
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.49 KB | None | 0 0
  1. SPAMASSASSIN = yes
  2. SPAM_SCORE = 50
  3. #CLAMD = yes
  4. smtp_enforce_sync = false
  5. add_environment = <; PATH=/bin:/usr/bin
  6. keep_environment =
  7. disable_ipv6 = true
  8.  
  9. domainlist local_domains = dsearch;/etc/exim4/domains/
  10. domainlist relay_to_domains = dsearch;/etc/exim4/domains/
  11. hostlist relay_from_hosts = 127.0.0.1
  12. hostlist whitelist = net-iplsearch;/etc/exim4/white-blocks.conf
  13. hostlist spammers = net-iplsearch;/etc/exim4/spam-blocks.conf
  14. no_local_from_check
  15. untrusted_set_sender = *
  16. acl_smtp_connect = acl_check_spammers
  17. acl_smtp_mail = acl_check_mail
  18. acl_smtp_rcpt = acl_check_rcpt
  19. acl_smtp_data = acl_check_data
  20. acl_smtp_mime = acl_check_mime
  21.  
  22. .ifdef SPAMASSASSIN
  23. spamd_address = 127.0.0.1 783
  24. .endif
  25.  
  26. .ifdef CLAMD
  27. av_scanner = clamd: /var/run/clamav/clamd.ctl
  28. .endif
  29. auth_advertise_hosts = *
  30. tls_advertise_hosts = *
  31. tls_certificate = /etc/exim4/exim.crt
  32. tls_privatekey = /etc/exim4/exim.key
  33. daemon_smtp_ports = 25 : 465 : 2525
  34. tls_on_connect_ports = 25 : 465
  35.  
  36. never_users = root
  37. host_lookup = *
  38. rfc1413_hosts = *
  39. rfc1413_query_timeout = 5s
  40. ignore_bounce_errors_after = 2d
  41. timeout_frozen_after = 7d
  42.  
  43. DKIM_DOMAIN = ${lc:${domain:$h_from:}}
  44. DKIM_FILE = /etc/exim4/domains/${lc:${domain:$h_from:}}/dkim.pem
  45. DKIM_PRIVATE_KEY = ${if exists{DKIM_FILE}{DKIM_FILE}{0}}
  46.  
  47.  
  48.  
  49. ######################################################################
  50. # ACL CONFIGURATION #
  51. # Specifies access control lists for incoming SMTP mail #
  52. ######################################################################
  53. begin acl
  54.  
  55. acl_check_spammers:
  56. accept
  57. accept hosts = +whitelist
  58.  
  59. drop message = Your host in blacklist on this server.
  60. log_message = Host in blacklist
  61. hosts = +spammers
  62.  
  63. accept
  64.  
  65.  
  66. acl_check_mail:
  67. deny condition = ${if eq{$sender_helo_name}{}}
  68. message = HELO required before MAIL
  69.  
  70. drop message = Helo name contains a ip address (HELO was $sender_helo_name) and not is valid
  71. condition = ${if match{$sender_helo_name}{\N((\d{1,3}[.-]\d{1,3}[.-]\d{1,3}[.-]\d{1,3})|([0-9a-f]{8})|([0-9A-F]{8}))\N}{yes}{no}}
  72. condition = ${if match {${lookup dnsdb{>: defer_never,ptr=$sender_host_address}}\}{$sender_helo_name}{no}{yes}}
  73. delay = 45s
  74.  
  75. drop condition = ${if isip{$sender_helo_name}}
  76. message = Access denied - Invalid HELO name (See RFC2821 4.1.3)
  77.  
  78. drop condition = ${if eq{[$interface_address]}{$sender_helo_name}}
  79. message = $interface_address is _my_ address
  80.  
  81. accept
  82.  
  83.  
  84. acl_check_rcpt:
  85. accept hosts = :
  86.  
  87. deny message = Restricted characters in address
  88. domains = +local_domains
  89. local_parts = ^[.] : ^.*[@%!/|]
  90.  
  91. deny message = Restricted characters in address
  92. domains = !+local_domains
  93. local_parts = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
  94.  
  95. require verify = sender
  96.  
  97. accept hosts = +relay_from_hosts
  98. control = submission
  99.  
  100. accept authenticated = *
  101. control = submission/domain=
  102.  
  103. deny message = Rejected because $sender_host_address is in a black list at $dnslist_domain\n$dnslist_text
  104. hosts = !+whitelist
  105. dnslists = ${readfile {/etc/exim4/dnsbl.conf}{:}}
  106.  
  107. require message = relay not permitted
  108. domains = +local_domains : +relay_to_domains
  109.  
  110. deny message = smtp auth requried
  111. sender_domains = +local_domains
  112. !authenticated = *
  113.  
  114. require verify = recipient
  115.  
  116. .ifdef CLAMD
  117. warn set acl_m0 = no
  118.  
  119. warn condition = ${if exists {/etc/exim4/domains/$domain/antivirus}{yes}{no}}
  120. set acl_m0 = yes
  121. .endif
  122.  
  123. .ifdef SPAMASSASSIN
  124. warn set acl_m1 = no
  125.  
  126. warn condition = ${if exists {/etc/exim4/domains/$domain/antispam}{yes}{no}}
  127. set acl_m1 = yes
  128. .endif
  129.  
  130. accept
  131.  
  132.  
  133. acl_check_data:
  134. .ifdef CLAMD
  135. deny message = Message contains a virus ($malware_name) and has been rejected
  136. malware = *
  137. condition = ${if eq{$acl_m0}{yes}{yes}{no}}
  138. .endif
  139.  
  140. .ifdef SPAMASSASSIN
  141. warn !authenticated = *
  142. hosts = !+relay_from_hosts
  143. condition = ${if < {$message_size}{100K}}
  144. condition = ${if eq{$acl_m1}{yes}{yes}{no}}
  145. spam = nobody:true/defer_ok
  146. add_header = X-Spam-Score: $spam_score_int
  147. add_header = X-Spam-Bar: $spam_bar
  148. add_header = X-Spam-Report: $spam_report
  149. set acl_m2 = $spam_score_int
  150.  
  151. warn condition = ${if !eq{$acl_m2}{} {yes}{no}}
  152. condition = ${if >{$acl_m2}{SPAM_SCORE} {yes}{no}}
  153. add_header = X-Spam-Status: Yes
  154. message = SpamAssassin detected spam (from $sender_address to $recipients).
  155. .endif
  156.  
  157. accept
  158.  
  159.  
  160. acl_check_mime:
  161. deny message = Blacklisted file extension detected
  162. condition = ${if match {${lc:$mime_filename}}{\N(\.ade|\.adp|\.bat|\.chm|\.cmd|\.com|\.cpl|\.exe|\.hta|\.ins|\.isp|\.jse|\.lib|\.lnk|\.mde|\.msc|\.msp|\.mst|\.pif|\.scr|\.sct|\.shb|\.sys|\.vb|\.vbe|\.vbs|\.vxd|\.wsc|\.wsf|\.wsh)$\N}{1}{0}}
  163.  
  164. accept
  165.  
  166.  
  167.  
  168. ######################################################################
  169. # AUTHENTICATION CONFIGURATION #
  170. ######################################################################
  171. begin authenticators
  172.  
  173. dovecot_plain:
  174. driver = dovecot
  175. public_name = PLAIN
  176. server_socket = /var/run/dovecot/auth-client
  177. server_set_id = $auth1
  178.  
  179. dovecot_login:
  180. driver = dovecot
  181. public_name = LOGIN
  182. server_socket = /var/run/dovecot/auth-client
  183. server_set_id = $auth1
  184.  
  185.  
  186.  
  187. ######################################################################
  188. # ROUTERS CONFIGURATION #
  189. # Specifies how addresses are handled #
  190. ######################################################################
  191. begin routers
  192.  
  193. #smarthost:
  194. # driver = manualroute
  195. # domains = ! +local_domains
  196. # transport = remote_smtp
  197. # route_list = * smartrelay.vestacp.com
  198. # no_more
  199. # no_verify
  200.  
  201. dnslookup:
  202. driver = dnslookup
  203. domains = !+local_domains
  204. transport = remote_smtp
  205. no_more
  206.  
  207. userforward:
  208. driver = redirect
  209. check_local_user
  210. file = $home/.forward
  211. allow_filter
  212. no_verify
  213. no_expn
  214. check_ancestor
  215. file_transport = address_file
  216. pipe_transport = address_pipe
  217. reply_transport = address_reply
  218.  
  219. procmail:
  220. driver = accept
  221. check_local_user
  222. require_files = ${local_part}:+${home}/.procmailrc:/usr/bin/procmail
  223. transport = procmail
  224. no_verify
  225.  
  226. autoreplay:
  227. driver = accept
  228. require_files = /etc/exim4/domains/$domain/autoreply.${local_part}.msg
  229. condition = ${if exists{/etc/exim4/domains/$domain/autoreply.${local_part}.msg}{yes}{no}}
  230. retry_use_local_part
  231. transport = userautoreply
  232. unseen
  233.  
  234. aliases:
  235. driver = redirect
  236. headers_add = X-redirected: yes
  237. data = ${extract{1}{:}{${lookup{$local_part@$domain}lsearch{/etc/exim4/domains/$domain/aliases}}}}
  238. require_files = /etc/exim4/domains/$domain/aliases
  239. redirect_router = dnslookup
  240. pipe_transport = address_pipe
  241. unseen
  242.  
  243. localuser_fwd_only:
  244. driver = accept
  245. transport = devnull
  246. condition = ${if exists{/etc/exim4/domains/$domain/fwd_only}{${lookup{$local_part}lsearch{/etc/exim4/domains/$domain/fwd_only}{true}{false}}}}
  247.  
  248. localuser_spam:
  249. driver = accept
  250. transport = local_spam_delivery
  251. condition = ${if eq {${if match{$h_X-Spam-Status:}{\N^Yes\N}{yes}{no}}} {${lookup{$local_part}lsearch{/etc/exim4/domains/$domain/passwd}{yes}{no_such_user}}}}
  252.  
  253. localuser:
  254. driver = accept
  255. transport = local_delivery
  256. condition = ${lookup{$local_part}lsearch{/etc/exim4/domains/$domain/passwd}{true}{false}}
  257.  
  258. catchall:
  259. driver = redirect
  260. headers_add = X-redirected: yes
  261. require_files = /etc/exim4/domains/$domain/aliases
  262. data = ${extract{1}{:}{${lookup{*@$domain}lsearch{/etc/exim4/domains/$domain/aliases}}}}
  263. file_transport = local_delivery
  264. redirect_router = dnslookup
  265.  
  266. terminate_alias:
  267. driver = accept
  268. transport = devnull
  269. condition = ${lookup{$local_part@$domain}lsearch{/etc/exim4/domains/$domain/aliases}{true}{false}}
  270.  
  271.  
  272.  
  273. ######################################################################
  274. # TRANSPORTS CONFIGURATION #
  275. ######################################################################
  276. begin transports
  277.  
  278. remote_smtp:
  279. driver = smtp
  280. #helo_data = $sender_address_domain
  281. dkim_domain = DKIM_DOMAIN
  282. dkim_selector = mail
  283. dkim_private_key = DKIM_PRIVATE_KEY
  284. dkim_canon = relaxed
  285. dkim_strict = 0
  286.  
  287. procmail:
  288. driver = pipe
  289. command = "/usr/bin/procmail -d $local_part"
  290. return_path_add
  291. delivery_date_add
  292. envelope_to_add
  293. user = $local_part
  294. initgroups
  295. return_output
  296.  
  297. local_delivery:
  298. driver = appendfile
  299. maildir_format
  300. maildir_use_size_file
  301. user = ${extract{2}{:}{${lookup{$local_part}lsearch{/etc/exim4/domains/$domain/passwd}}}}
  302. group = mail
  303. create_directory
  304. directory_mode = 770
  305. mode = 660
  306. use_lockfile = no
  307. delivery_date_add
  308. envelope_to_add
  309. return_path_add
  310. directory = "${extract{5}{:}{${lookup{$local_part}lsearch{/etc/exim4/domains/$domain/passwd}}}}/mail/$domain/$local_part"
  311. quota = ${extract{6}{:}{${lookup{$local_part}lsearch{/etc/exim4/domains/$domain/passwd}}}}M
  312. quota_warn_threshold = 75%
  313.  
  314. local_spam_delivery:
  315. driver = appendfile
  316. maildir_format
  317. maildir_use_size_file
  318. user = ${extract{2}{:}{${lookup{$local_part}lsearch{/etc/exim4/domains/$domain/passwd}}}}
  319. group = mail
  320. create_directory
  321. directory_mode = 770
  322. mode = 660
  323. use_lockfile = no
  324. delivery_date_add
  325. envelope_to_add
  326. return_path_add
  327. directory = "${extract{5}{:}{${lookup{$local_part}lsearch{/etc/exim4/domains/$domain/passwd}}}}/mail/$domain/$local_part/.Spam"
  328. quota = ${extract{6}{:}{${lookup{$local_part}lsearch{/etc/exim4/domains/$domain/passwd}}}}M
  329. quota_directory = "${extract{5}{:}{${lookup{$local_part}lsearch{/etc/exim4/domains/$domain/passwd}}}}/mail/$domain/$local_part"
  330. quota_warn_threshold = 75%
  331.  
  332. address_pipe:
  333. driver = pipe
  334. return_output
  335.  
  336. address_file:
  337. driver = appendfile
  338. delivery_date_add
  339. envelope_to_add
  340. return_path_add
  341.  
  342. address_reply:
  343. driver = autoreply
  344.  
  345. userautoreply:
  346. driver = autoreply
  347. file = /etc/exim4/domains/$domain/autoreply.${local_part}.msg
  348. from = "${local_part}@${domain}"
  349. headers = Content-Type: text/plain; charset=utf-8;\nContent-Transfer-Encoding: 8bit
  350. subject = "${if def:h_Subject: {Autoreply: \"${rfc2047:$h_Subject:}\"} {Autoreply Message}}"
  351. to = "${sender_address}"
  352.  
  353. devnull:
  354. driver = appendfile
  355. file = /dev/null
  356.  
  357.  
  358. ######################################################################
  359. # RETRY CONFIGURATION #
  360. ######################################################################
  361. begin retry
  362.  
  363. # Address or Domain Error Retries
  364. # ----------------- ----- -------
  365. * * F,2h,15m; G,16h,1h,1.5; F,4d,6h
  366.  
  367.  
  368.  
  369. ######################################################################
  370. # REWRITE CONFIGURATION #
  371. ######################################################################
  372. begin rewrite
  373.  
  374.  
  375.  
  376. ######################################################################
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement