1 # Exim test configuration 2033
2 # TLS client: verify certificate from server - name-fails
8 host_lookup_order = bydns
9 primary_hostname = myhost.test.ex
10 spool_directory = DIR/spool
11 log_file_path = DIR/spool/log/SERVER%slog
13 gecos_name = CALLER_NAME
16 S1 = FX/exim-ca/example.com/server1.example.com
19 CERT1 = S1/server1.example.com.pem
20 KEY1 = S1/server1.example.com.unlocked.key
25 # ----- Main settings -----
29 acl_smtp_rcpt = accept
31 log_selector = +tls_peerdn+tls_certificate_verified
36 tls_advertise_hosts = *
38 # Set certificate only if server
40 tls_certificate = ${if eq {SERVER}{server}{CERT1}fail}
41 tls_privatekey = ${if eq {SERVER}{server}{KEY1}fail}
44 tls_verify_certificates = ${if eq {SERVER}{server}{CERT2}fail}
53 condition = ${if eq {SERVER}{server}{yes}{no}}
60 transport = send_to_server_failcert
67 transport = send_to_server_retry
73 transport = send_to_server_crypt
79 transport = send_to_server_req_fail
85 transport = send_to_server_req_failname
91 transport = send_to_server_req_passname
97 transport = send_to_server_req_failcarryon
99 # ----- Transports -----
103 # this will fail to verify the cert at HOSTIPV4 so fail the crypt requirement
104 send_to_server_failcert:
108 hosts_require_tls = HOSTIPV4
110 tls_certificate = CERT2
111 tls_privatekey = CERT2
113 tls_verify_certificates = CA2
115 # this will fail to verify the cert at HOSTIPV4 so fail the crypt, then retry on 127.1; ok
116 send_to_server_retry:
119 hosts = HOSTIPV4 : 127.0.0.1
120 hosts_require_tls = HOSTIPV4
122 tls_certificate = CERT2
123 tls_privatekey = CERT2
125 tls_verify_certificates = \
126 ${if eq{$host_address}{127.0.0.1}{CA1}{CA2}}
128 # this will fail to verify the cert but continue unverified though crypted
129 send_to_server_crypt:
133 hosts_require_tls = HOSTIPV4
135 tls_certificate = CERT2
136 tls_privatekey = CERT2
138 tls_verify_certificates = CA2
139 tls_try_verify_hosts = *
141 # this will fail to verify the cert at HOSTNAME and fallback to unencrypted
142 # Fail due to lack of correct CA
143 send_to_server_req_fail:
148 tls_certificate = CERT2
149 tls_privatekey = CERT2
151 tls_verify_certificates = CA2
154 # this will fail to verify the cert name and fallback to unencrypted
155 # fail because the cert is "server1.example.com" and the test system is something else
156 send_to_server_req_failname:
161 tls_certificate = CERT2
162 tls_privatekey = CERT2
164 tls_verify_certificates = CA1
165 tls_verify_cert_hostnames = *
168 # this will pass the cert verify including name check
169 # our stunt DNS has an A record for server1.example.com -> HOSTIPV4
170 send_to_server_req_passname:
173 hosts = server1.example.com
175 tls_certificate = CERT2
176 tls_privatekey = CERT2
178 tls_verify_certificates = CA1
179 tls_verify_cert_hostnames = *
182 # this will fail to verify the cert name but carry on (try-verify mode)
183 # fail because the cert is "server1.example.com" and the test system is something else
184 send_to_server_req_failcarryon:
189 tls_certificate = CERT2
190 tls_privatekey = CERT2
192 tls_verify_certificates = CA1
193 tls_verify_cert_hostnames = *
194 tls_try_verify_hosts = *