Advertisement
jstacklin

Exim4-For-VestaCP-Problem

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