main.cf 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. # --------------------------------------------------------------------------
  2. # Please create a file "extra.cf" for persistent overrides to main.cf
  3. # --------------------------------------------------------------------------
  4. biff = no
  5. append_dot_mydomain = no
  6. smtpd_tls_cert_file = /etc/ssl/mail/cert.pem
  7. smtpd_tls_key_file = /etc/ssl/mail/key.pem
  8. tls_server_sni_maps = hash:/opt/postfix/conf/sni.map
  9. smtpd_use_tls=yes
  10. smtpd_tls_received_header = yes
  11. smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
  12. smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
  13. smtpd_relay_restrictions = permit_mynetworks,
  14. permit_sasl_authenticated,
  15. defer_unauth_destination
  16. # alias maps are auto-generated in postfix.sh on startup
  17. alias_maps = hash:/etc/aliases
  18. alias_database = hash:/etc/aliases
  19. relayhost =
  20. mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 [fe80::]/10 [fc00::]/7
  21. mailbox_size_limit = 0
  22. recipient_delimiter = +
  23. inet_interfaces = all
  24. inet_protocols = all
  25. bounce_queue_lifetime = 1d
  26. broken_sasl_auth_clients = yes
  27. disable_vrfy_command = yes
  28. maximal_backoff_time = 1800s
  29. maximal_queue_lifetime = 5d
  30. delay_warning_time = 4h
  31. message_size_limit = 104857600
  32. milter_default_action = accept
  33. milter_protocol = 6
  34. minimal_backoff_time = 300s
  35. plaintext_reject_code = 550
  36. postscreen_access_list = permit_mynetworks,
  37. cidr:/opt/postfix/conf/custom_postscreen_whitelist.cidr,
  38. cidr:/opt/postfix/conf/postscreen_access.cidr,
  39. tcp:127.0.0.1:10027
  40. postscreen_bare_newline_enable = no
  41. postscreen_blacklist_action = drop
  42. postscreen_cache_cleanup_interval = 24h
  43. postscreen_cache_map = proxy:btree:$data_directory/postscreen_cache
  44. postscreen_dnsbl_action = enforce
  45. postscreen_dnsbl_sites = wl.mailspike.net=127.0.0.[18;19;20]*-2
  46. hostkarma.junkemailfilter.com=127.0.0.1*-2
  47. list.dnswl.org=127.0.[0..255].0*-2
  48. list.dnswl.org=127.0.[0..255].1*-4
  49. list.dnswl.org=127.0.[0..255].2*-6
  50. list.dnswl.org=127.0.[0..255].3*-8
  51. ix.dnsbl.manitu.net*2
  52. bl.spamcop.net*2
  53. bl.suomispam.net*2
  54. hostkarma.junkemailfilter.com=127.0.0.2*3
  55. hostkarma.junkemailfilter.com=127.0.0.4*2
  56. hostkarma.junkemailfilter.com=127.0.1.2*1
  57. backscatter.spameatingmonkey.net*2
  58. bl.ipv6.spameatingmonkey.net*2
  59. bl.spameatingmonkey.net*2
  60. b.barracudacentral.org=127.0.0.2*7
  61. bl.mailspike.net=127.0.0.2*5
  62. bl.mailspike.net=127.0.0.[10;11;12]*4
  63. dnsbl.sorbs.net=127.0.0.10*8
  64. dnsbl.sorbs.net=127.0.0.5*6
  65. dnsbl.sorbs.net=127.0.0.7*3
  66. dnsbl.sorbs.net=127.0.0.8*2
  67. dnsbl.sorbs.net=127.0.0.6*2
  68. dnsbl.sorbs.net=127.0.0.9*2
  69. zen.spamhaus.org=127.0.0.[10;11]*8
  70. zen.spamhaus.org=127.0.0.[4..7]*6
  71. zen.spamhaus.org=127.0.0.3*4
  72. zen.spamhaus.org=127.0.0.2*3
  73. postscreen_dnsbl_threshold = 6
  74. postscreen_dnsbl_ttl = 5m
  75. postscreen_greet_action = enforce
  76. postscreen_greet_banner = $smtpd_banner
  77. postscreen_greet_ttl = 2d
  78. postscreen_greet_wait = 3s
  79. postscreen_non_smtp_command_enable = no
  80. postscreen_pipelining_enable = no
  81. proxy_read_maps = proxy:mysql:/opt/postfix/conf/sql/mysql_sasl_passwd_maps_transport_maps.cf,
  82. proxy:mysql:/opt/postfix/conf/sql/mysql_tls_enforce_in_policy.cf,
  83. $sender_dependent_default_transport_maps,
  84. $smtp_tls_policy_maps,
  85. $local_recipient_maps,
  86. $mydestination,
  87. $virtual_alias_maps,
  88. $virtual_alias_domains,
  89. $virtual_mailbox_maps,
  90. $virtual_mailbox_domains,
  91. $relay_recipient_maps,
  92. $relay_domains,
  93. $canonical_maps,
  94. $sender_canonical_maps,
  95. $sender_bcc_maps,
  96. $recipient_bcc_maps,
  97. $recipient_canonical_maps,
  98. $relocated_maps,
  99. $transport_maps,
  100. $mynetworks,
  101. $smtpd_sender_login_maps,
  102. $smtp_sasl_password_maps
  103. queue_run_delay = 300s
  104. relay_domains = proxy:mysql:/opt/postfix/conf/sql/mysql_virtual_relay_domain_maps.cf
  105. relay_recipient_maps = proxy:mysql:/opt/postfix/conf/sql/mysql_relay_recipient_maps.cf
  106. sender_dependent_default_transport_maps = proxy:mysql:/opt/postfix/conf/sql/mysql_sender_dependent_default_transport_maps.cf
  107. smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
  108. smtpd_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
  109. smtp_tls_cert_file = /etc/ssl/mail/cert.pem
  110. smtp_tls_key_file = /etc/ssl/mail/key.pem
  111. smtp_tls_loglevel = 1
  112. smtp_dns_support_level = dnssec
  113. smtp_tls_security_level = dane
  114. smtpd_data_restrictions = reject_unauth_pipelining, permit
  115. smtpd_delay_reject = yes
  116. smtpd_error_sleep_time = 10s
  117. smtpd_hard_error_limit = ${stress?1}${stress:5}
  118. smtpd_helo_required = yes
  119. smtpd_proxy_timeout = 600s
  120. smtpd_recipient_restrictions = permit_sasl_authenticated,
  121. permit_mynetworks,
  122. check_recipient_access proxy:mysql:/opt/postfix/conf/sql/mysql_tls_enforce_in_policy.cf,
  123. reject_invalid_helo_hostname,
  124. reject_unauth_destination
  125. smtpd_sasl_auth_enable = yes
  126. smtpd_sasl_authenticated_header = yes
  127. smtpd_sasl_path = inet:dovecot:10001
  128. smtpd_sasl_type = dovecot
  129. smtpd_sender_login_maps = proxy:mysql:/opt/postfix/conf/sql/mysql_virtual_sender_acl.cf
  130. smtpd_sender_restrictions = reject_authenticated_sender_login_mismatch,
  131. permit_mynetworks,
  132. permit_sasl_authenticated,
  133. reject_unlisted_sender,
  134. reject_unknown_sender_domain
  135. smtpd_soft_error_limit = 3
  136. smtpd_tls_auth_only = yes
  137. smtpd_tls_dh1024_param_file = /etc/ssl/mail/dhparams.pem
  138. smtpd_tls_eecdh_grade = auto
  139. smtpd_tls_exclude_ciphers = ECDHE-RSA-RC4-SHA, RC4, aNULL, DES-CBC3-SHA, ECDHE-RSA-DES-CBC3-SHA, EDH-RSA-DES-CBC3-SHA
  140. smtpd_tls_loglevel = 1
  141. # Mandatory protocols and ciphers are used when a connections is enforced to use TLS
  142. # Does _not_ apply to enforced incoming TLS settings per mailbox
  143. smtp_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1
  144. lmtp_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1
  145. smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1
  146. smtpd_tls_mandatory_ciphers = high
  147. smtp_tls_protocols = !SSLv2, !SSLv3
  148. lmtp_tls_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1
  149. smtpd_tls_protocols = !SSLv2, !SSLv3
  150. smtpd_tls_security_level = may
  151. tls_preempt_cipherlist = yes
  152. tls_ssl_options = NO_COMPRESSION, NO_RENEGOTIATION
  153. virtual_alias_maps = proxy:mysql:/opt/postfix/conf/sql/mysql_virtual_alias_maps.cf,
  154. proxy:mysql:/opt/postfix/conf/sql/mysql_virtual_resource_maps.cf,
  155. proxy:mysql:/opt/postfix/conf/sql/mysql_virtual_spamalias_maps.cf,
  156. proxy:mysql:/opt/postfix/conf/sql/mysql_virtual_alias_domain_maps.cf
  157. virtual_gid_maps = static:5000
  158. virtual_mailbox_base = /var/vmail/
  159. virtual_mailbox_domains = proxy:mysql:/opt/postfix/conf/sql/mysql_virtual_domains_maps.cf
  160. recipient_bcc_maps = proxy:mysql:/opt/postfix/conf/sql/mysql_recipient_bcc_maps.cf
  161. sender_bcc_maps = proxy:mysql:/opt/postfix/conf/sql/mysql_sender_bcc_maps.cf
  162. recipient_canonical_maps = proxy:mysql:/opt/postfix/conf/sql/mysql_recipient_canonical_maps.cf
  163. recipient_canonical_classes = envelope_recipient
  164. virtual_mailbox_maps = proxy:mysql:/opt/postfix/conf/sql/mysql_virtual_mailbox_maps.cf
  165. virtual_minimum_uid = 104
  166. virtual_transport = lmtp:inet:dovecot:24
  167. virtual_uid_maps = static:5000
  168. smtpd_milters = inet:rspamd:9900
  169. non_smtpd_milters = inet:rspamd:9900
  170. milter_mail_macros = i {mail_addr} {client_addr} {client_name} {auth_authen}
  171. mydestination = localhost.localdomain, localhost
  172. # Prefere IPv4, useful for v4-only envs
  173. smtp_address_preference = ipv4
  174. smtp_sender_dependent_authentication = yes
  175. smtp_sasl_auth_enable = yes
  176. smtp_sasl_password_maps = proxy:mysql:/opt/postfix/conf/sql/mysql_sasl_passwd_maps_sender_dependent.cf
  177. smtp_sasl_security_options =
  178. smtp_sasl_mechanism_filter = plain, login
  179. smtp_tls_policy_maps=proxy:mysql:/opt/postfix/conf/sql/mysql_tls_policy_override_maps.cf
  180. smtp_header_checks = pcre:/opt/postfix/conf/anonymize_headers.pcre
  181. mail_name = Postcow
  182. # local_transport map catches local destinations and prevents routing local dests when the next map would route "*"
  183. # Use custom_transport.pcre for custom transports
  184. transport_maps = pcre:/opt/postfix/conf/custom_transport.pcre,
  185. pcre:/opt/postfix/conf/local_transport,
  186. proxy:mysql:/opt/postfix/conf/sql/mysql_relay_ne.cf,
  187. proxy:mysql:/opt/postfix/conf/sql/mysql_transport_maps.cf
  188. smtp_sasl_auth_soft_bounce = no
  189. postscreen_discard_ehlo_keywords = silent-discard, dsn
  190. compatibility_level = 2
  191. smtputf8_enable = yes
  192. # Define protocols for SMTPS and submission service
  193. submission_smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1
  194. smtps_smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1
  195. # DO NOT EDIT ANYTHING BELOW #
  196. # User overrides #