exim4.conf.template 11 KB

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