From 9517ee2ddc30d7328698d316ca1b592044ec0d54 Mon Sep 17 00:00:00 2001 From: Jason Gunthorpe Date: Fri, 17 Jul 2020 14:13:39 -0300 Subject: doc: Update example-exim4.conf This simplfies the config to use address_data and adds an extra stanza to handle <> envelope from addresses, generated by cron or internally by exim. This works OK on gmail now. Signed-off-by: Jason Gunthorpe --- doc/example-exim4.conf | 44 ++++++++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/doc/example-exim4.conf b/doc/example-exim4.conf index 2f2c906..72df975 100644 --- a/doc/example-exim4.conf +++ b/doc/example-exim4.conf @@ -1,5 +1,8 @@ -# Specify local domains HERE, these are names that might appear in email +# Specify local domains, this is usually hostname -f and hostname - ie bad +# mail names the local machine might create. They get rewritten to a cloud +# name below domainlist local_domains = + domainlist relay_to_domains = hostlist relay_from_hosts = localhost # Create this file HERE @@ -16,7 +19,6 @@ disable_ipv6=true local_interfaces = <; [127.0.0.1]:25 acl_smtp_rcpt = acl_check_rcpt -acl_smtp_data = acl_check_data tls_advertise_hosts = @@ -83,11 +85,25 @@ begin routers # exim -f 'user@domain.com' -bt user@otherdomain.com # To quick test smarthost: - debug_print = "R: smarthost for $local_part@$domain" + debug_print = "R: smarthost to $local_part@$domain for $sender_address" + driver = manualroute + domains = ! +local_domains + transport = remote_smtp_smarthost + address_data = ${lookup{$sender_address_domain}lsearch{SMARTFN}} + route_data = ${extract{host}{$address_data}} + +# There are several cases in exim, particularly internally generated bounces, +# that have an empty envelope from. In this case route based on the +# destination address the cloud relay will insert the account user as the +# envelope from. +empty_envelope: + debug_print = "R: empty_envelope to $local_part@$domain for '$sender_address'" driver = manualroute domains = ! +local_domains transport = remote_smtp_smarthost - route_data = ${extract{host}{${lookup{$sender_address_domain}lsearch{SMARTFN}}}} + condition = ${if eq{$sender_address_domain}{}{true}{}} + address_data = ${lookup{$domain}lsearch{SMARTFN}} + route_data = ${extract{host}{$address_data}} no_more begin transports @@ -95,8 +111,8 @@ begin transports remote_smtp_smarthost: debug_print = "T: remote_smtp_smarthost for $local_part@$domain" driver = smtp - helo_data = ${extract{helo}{${lookup{$sender_address_domain}lsearch{SMARTFN}}}{$value}{wakko.ziepe.ca}} - hosts_require_auth = ${extract{user}{${lookup{$sender_address_domain}lsearch{SMARTFN}}}{*}{}} + helo_data = ${extract{helo}{$address_data}{$value}{example.com}} + hosts_require_auth = ${extract{user}{$address_data}{*}{}} hosts_require_tls = * tls_tempfail_tryclear = false tls_verify_certificates = system @@ -108,27 +124,27 @@ begin retry begin rewrite # Replace user and domain HERE -root@+local_domains user@domain.com Ffrs -user@+local_domains user@domain.com Ffrs +root@+local_domains user@domain.com Eh +user@+local_domains user@domain.com Eh begin authenticators xoauth2_smart: driver = plaintext - client_condition = ${if and {{!eq{$tls_out_cipher}{}} {eq{${extract{oauth}{${lookup{$sender_address_domain}lsearch{SMARTFN}}}{}fail}}{}}} } + client_condition = ${if and {{!eq{$tls_out_cipher}{}} {eq{${extract{oauth}{$address_data}{}fail}}{}}} } public_name = XOAUTH2 client_ignore_invalid_base64 = true - client_send = : ${readsocket{${extract{oauth}{${lookup{$sender_address_domain}lsearch{SMARTFN}}}{$value}fail}}{SMTP ${extract{user}{${lookup{$sender_address_domain}lsearch{SMARTFN}}}{$value}fail}}} + client_send = : ${readsocket{${extract{oauth}{$address_data}{$value}fail}}{SMTP ${extract{user}{$address_data}{$value}fail}}} # Plain has fewer round trips, so prefer to use it plain_smart: driver = plaintext - client_condition = ${if and {{!eq{$tls_out_cipher}{}} {eq{${extract{password}{${lookup{$sender_address_domain}lsearch{SMARTFN}}}{}fail}}{}}} } + client_condition = ${if and {{!eq{$tls_out_cipher}{}} {eq{${extract{password}{$address_data}{}fail}}{}}} } public_name = PLAIN - client_send = ^${extract{user}{${lookup{$sender_address_domain}lsearch{SMARTFN}}}{$value}fail}^${extract{password}{${lookup{$sender_address_domain}lsearch{SMARTFN}}}} + client_send = ^${extract{user}{$address_data}{$value}fail}^${extract{password}{$address_data}} login_smart: driver = plaintext - client_condition = ${if and {{!eq{$tls_out_cipher}{}} {eq{${extract{password}{${lookup{$sender_address_domain}lsearch{SMARTFN}}}{}fail}}{}}} } + client_condition = ${if and {{!eq{$tls_out_cipher}{}} {eq{${extract{password}{$address_data}{}fail}}{}}} } public_name = LOGIN - client_send = : ${extract{user}{${lookup{$sender_address_domain}lsearch{SMARTFN}}}{$value}fail} : ${extract{password}{${lookup{$sender_address_domain}lsearch{SMARTFN}}}} + client_send = : ${extract{user}{$address_data}{$value}fail} : ${extract{password}{$address_data}} -- cgit v1.2.3