X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/900be9a12bfe74cfb4c96e00b892d350a18eb635..19ca76c7c5e79cbb4e497b937376bffcb42d85fc:/cookbooks/exim/templates/default/exim4.conf.erb diff --git a/cookbooks/exim/templates/default/exim4.conf.erb b/cookbooks/exim/templates/default/exim4.conf.erb index 81639bce4..ab832999d 100644 --- a/cookbooks/exim/templates/default/exim4.conf.erb +++ b/cookbooks/exim/templates/default/exim4.conf.erb @@ -1,4 +1,4 @@ -# $Cambridge: exim/exim-src/src/configure.default,v 1.14 2009/10/16 07:46:13 tom Exp $ +# DO NOT EDIT - This file is being maintained by Chef ###################################################################### # Runtime configuration file for Exim # @@ -42,6 +42,7 @@ ###################################################################### # MAIN CONFIGURATION SETTINGS # ###################################################################### +# # Specify your host's canonical name here. This should normally be the fully # qualified "official" name of your host. If this option is not set, the @@ -93,12 +94,13 @@ hostlist relay_from_hosts = <; <%= @relay_from_hosts.join(" ; ") %> # to any other host on the Internet. Such a setting commonly refers to a # complete local network as well as the localhost. For example: # -# hostlist relay_from_hosts = 127.0.0.1 : 192.168.0.0/16 +# hostlist relay_from_hosts = <; 127.0.0.1 ; ::1 ; 192.168.0.0/16 # # The "/16" is a bit mask (CIDR notation), not a number of hosts. Note that you # have to include 127.0.0.1 if you want to allow processes on your host to send # SMTP mail by using the loopback address. A number of MUAs use this method of -# sending mail. +# sending mail. Often, connections are made to "localhost", which might be ::1 +# on IPv6-enabled hosts. Do not forget CIDR for your IPv6 networks. # All three of these lists may contain many different kinds of item, including # wildcarded names, regular expressions, and file lookups. See the reference @@ -144,7 +146,7 @@ spamd_address = 127.0.0.1 783 # Allow any client to use TLS. -tls_advertise_hosts = <; !127.0.0.1 ; !::1 +tls_advertise_hosts = * # Specify the location of the Exim server's TLS certificate and private key. # The private key must not be encrypted (password protected). You can put @@ -152,8 +154,17 @@ tls_advertise_hosts = <; !127.0.0.1 ; !::1 # need the first setting, or in separate files, in which case you need both # options. +<% if node[:exim][:certificate_names] -%> +tls_certificate = /etc/ssl/certs/<%= node[:exim][:certificate_names].first %>.pem +tls_privatekey = /etc/ssl/private/<%= node[:exim][:certificate_names].first %>.key +<% else -%> tls_certificate = /etc/ssl/certs/exim.pem tls_privatekey = /etc/ssl/private/exim.key +<% end -%> + +# Configure TLS cipher selection. + +tls_require_ciphers = <%= node[:ssl][:gnutls_ciphers] %>:%SERVER_PRECEDENCE # In order to support roaming users who wish to send email from anywhere, # you may want to make Exim listen on other ports as well as port 25, in @@ -224,18 +235,26 @@ never_users = root host_lookup = * -# The settings below, which are actually the same as the defaults in the -# code, cause Exim to make RFC 1413 (ident) callbacks for all incoming SMTP -# calls. You can limit the hosts to which these calls are made, and/or change -# the timeout that is used. If you set the timeout to zero, all RFC 1413 calls -# are disabled. RFC 1413 calls are cheap and can provide useful information -# for tracing problem messages, but some hosts and firewalls have problems -# with them. This can result in a timeout instead of an immediate refused -# connection, leading to delays on starting up SMTP sessions. (The default was -# reduced from 30s to 5s for release 4.61.) +# The settings below cause Exim to make RFC 1413 (ident) callbacks +# for all incoming SMTP calls. You can limit the hosts to which these +# calls are made, and/or change the timeout that is used. If you set +# the timeout to zero, all RFC 1413 calls are disabled. RFC 1413 calls +# are cheap and can provide useful information for tracing problem +# messages, but some hosts and firewalls have problems with them. +# This can result in a timeout instead of an immediate refused +# connection, leading to delays on starting up SMTP sessions. +# (The default was reduced from 30s to 5s for release 4.61. and to +# disabled for release 4.86) +# +#rfc1413_hosts = * +#rfc1413_query_timeout = 5s -rfc1413_hosts = * -rfc1413_query_timeout = 5s + +# Enable an efficiency feature. We advertise the feature; clients +# may request to use it. For multi-recipient mails we then can +# reject or accept per-user after the message is received. +# +prdr_enable = true # By default, Exim expects all envelope addresses to be fully qualified, that @@ -251,6 +270,12 @@ rfc1413_query_timeout = 5s # and/or qualify_recipient (see above). +# Unless you run a high-volume site you probably want more logging +# detail than the default. Adjust to suit. + +log_selector = +all -skip_delivery + + # If you want Exim to support the "percent hack" for certain domains, # uncomment the following line and provide a list of domains. The "percent # hack" is the feature by which mail addressed to x%y@z (where z is one of @@ -295,10 +320,37 @@ timeout_frozen_after = 7d # split_spool_directory = true -# Log just about everything we can log so that we have the best -# possible chance of knowing what's going on. +# If you're in a part of the world where ASCII is not sufficient for most +# text, then you're probably familiar with RFC2047 message header extensions. +# By default, Exim adheres to the specification, including a limit of 76 +# characters to a line, with encoded words fitting within a line. +# If you wish to use decoded headers in message filters in such a way +# that successful decoding of malformed messages matters, you may wish to +# configure Exim to be more lenient. +# +# check_rfc2047_length = false +# +# In particular, the Exim maintainers have had multiple reports of problems +# from Russian administrators of issues until they disable this check, +# because of some popular, yet buggy, mail composition software. -log_selector = +all -skip_delivery + +# If you wish to be strictly RFC compliant, or if you know you'll be +# exchanging email with systems that are not 8-bit clean, then you may +# wish to disable advertising 8BITMIME. Uncomment this option to do so. + +# accept_8bitmime = false + + +# Exim does not make use of environment variables itself. However, +# libraries that Exim uses (e.g. LDAP) depend on specific environment settings. +# There are two lists: keep_environment for the variables we trust, and +# add_environment for variables we want to set to a specific value. +# Note that TZ is handled separately by the timezone runtime option +# and TIMEZONE_DEFAULT buildtime option. + +# keep_environment = ^LDAP +# add_environment = PATH=/usr/bin::/bin # Define trusted users. @@ -324,9 +376,7 @@ acl_check_rcpt: # testing for an empty sending host field. accept hosts = : -<% if node[:lsb][:release].to_i >= 10.04 -%> control = dkim_disable_verify -<% end -%> ############################################################################# # The following section of the ACL is concerned with local parts that contain @@ -374,6 +424,17 @@ acl_check_rcpt: local_parts = ^[./|] : ^.*[@%!] : ^.*/\\.\\./ ############################################################################# + # Block bounces to selected addresses + + deny local_parts = root:postmaster:webmaster:abuse:support + senders = : + + # Block blacklisted senders + + deny senders = lsearch*@;/etc/exim4/blocked-senders + message = Rejected because $sender_address is blacklisted\nQueries to postmaster@$qualify_domain + !hosts = +relay_from_hosts + # Accept mail to postmaster in any local domain, regardless of the source, # and without verifying the sender. @@ -383,7 +444,7 @@ acl_check_rcpt: # Deny incoming mail unless the sender address can be verified. deny !hosts = +relay_from_hosts - !verify = sender/callout/defer_ok + !verify = sender # Accept if the message comes from one of the hosts for which we are an # outgoing relay. It is assumed that such hosts are most likely to be MUAs, @@ -406,9 +467,7 @@ acl_check_rcpt: accept hosts = +relay_from_hosts control = submission -<% if node[:lsb][:release].to_i >= 10.04 -%> control = dkim_disable_verify -<% end -%> # Accept if the message arrived over an authenticated connection, from # any host. Again, these messages are usually from MUAs, so recipient @@ -417,9 +476,7 @@ acl_check_rcpt: accept authenticated = * control = submission -<% if node[:lsb][:release].to_i >= 10.04 -%> control = dkim_disable_verify -<% end -%> # Insist that any other recipient address that we accept is either in one of # our local domains, or is in a domain for which we explicitly allow @@ -474,9 +531,8 @@ acl_check_data: # Deny if the message contains a virus. Before enabling this check, you # must install a virus scanner and set the av_scanner option above. # - deny demime = * - malware = * - message = This message contains a virus ($malware_name). + deny malware = * + message = This message was detected as possible malware ($malware_name). <% end -%> <% if File.exist?("/var/run/spamd.pid") -%> @@ -487,6 +543,13 @@ acl_check_data: message = This message scored $spam_score SpamAssassin points. <% end -%> + # Deny spammy messages with headers of the form: + # X-PHP-Originating-Script: :.php + # X-PHP-Originating-Script: :.class.php + deny condition = ${if match {$h_X-PHP-Originating-Script:}{^[0-9]+:[A-Za-z]+(\\.class)?\\.php\$}} + !hosts = +relay_from_hosts + message = This message failed local spam checks. + # Accept the message. accept @@ -525,7 +588,7 @@ begin routers system_aliases: driver = redirect - domains = +local_domains + domains = !noreply.openstreetmap.org : +local_domains allow_fail allow_defer data = ${lookup{$local_part}lsearch{/etc/aliases}} @@ -571,6 +634,8 @@ noreply: <% end -%> <% if details[:local_parts] -%> local_parts = <%= details[:local_parts].join(" : ") %> + local_part_suffix = +* + local_part_suffix_optional <% end -%> <% if details[:host] -%> <% if details[:host].kind_of?(Array) -%> @@ -613,7 +678,7 @@ smarthost: dnslookup: driver = dnslookup domains = ! +local_domains - transport = remote_smtp + transport = signed_smtp same_domain_copy_routing = yes ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8 no_more @@ -637,6 +702,21 @@ begin transports remote_smtp: driver = smtp + multi_domain = false + tls_require_ciphers = <%= node[:ssl][:gnutls_ciphers] %>:%LATEST_RECORD_VERSION + + +# This transport is used for delivering DKIM signed messages over SMTP connections. + +signed_smtp: + driver = smtp + dkim_domain = ${lc:${domain:$h_from:}} + dkim_selector = ${lookup{$dkim_domain}lsearch{/etc/exim4/dkim-selectors}{$value}} + dkim_private_key = /etc/exim4/dkim-keys/${dkim_domain} + dkim_identity = ${lc:${address:$h_from:}} + # dkim_timestamps = 1209600 + multi_domain = false + tls_require_ciphers = <%= node[:ssl][:gnutls_ciphers] %>:%LATEST_RECORD_VERSION # This transport is used for handling pipe deliveries generated by alias or @@ -693,19 +773,35 @@ noreply: group = Debian-exim <% node[:exim][:routes].each do |name,details| -%> -<% if details[:command] -%> +<% if details[:command] or details[:file] or details[:maildir] -%> # This transport handles mail for <%= details[:comment] -%>. <%= name -%>: +<% if details[:command] -%> driver = pipe command = <%= details[:command] %> + home_directory = <%= details[:home_directory] %> + path = <%= details[:path] || "/bin:/usr/bin" %> +<% if details[:environment] -%> + environment = <%= details[:environment].map { |k,v| "#{k}=#{v}" }.join(":") %> +<% end -%> + return_fail_output +<% else -%> + driver = appendfile +<% if details[:file] -%> + file = <%= details[:file] %> +<% elsif details[:maildir] -%> + directory = <%= details[:maildir] %> + maildir_format +<% end -%> + envelope_to_add + return_path_add + mode = 0660 +<% end -%> user = <%= details[:user] %> <% if details[:group] -%> group = <%= details[:group] %> <% end -%> - home_directory = <%= details[:home_directory] %> - return_output - <% end -%> <% end -%> @@ -742,6 +838,10 @@ begin retry # There are no rewriting specifications in this default configuration file. begin rewrite +*@<%= node[:fqdn] %> "${if !match {${lookup{$1}lsearch{/etc/aliases}{$value}}}{@} {$1@openstreetmap.org}fail}" Eh +<% node[:exim][:rewrites].each do |rewrite| -%> +<%= rewrite[:pattern] %> <%= rewrite[:replacement] %> <%= rewrite[:flags] %> +<% end -%>