exim-smarthost.conf 11 KB

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