1 # Exim test configuration 2133
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
100 # ----- Transports -----
104 # this will fail to verify the cert at HOSTIPV4 so fail the crypt requirement
105 send_to_server_failcert:
109 hosts_require_tls = HOSTIPV4
111 tls_certificate = CERT2
112 tls_privatekey = CERT2
114 tls_verify_certificates = CA2
116 # this will fail to verify the cert at HOSTIPV4 so fail the crypt, then retry on 127.1; ok
117 send_to_server_retry:
120 hosts = HOSTIPV4 : 127.0.0.1
121 hosts_require_tls = HOSTIPV4
123 tls_certificate = CERT2
124 tls_privatekey = CERT2
126 tls_verify_certificates = \
127 ${if eq{$host_address}{127.0.0.1}{CA1}{CA2}}
129 # this will fail to verify the cert but continue unverified though crypted
130 send_to_server_crypt:
134 hosts_require_tls = HOSTIPV4
136 tls_certificate = CERT2
137 tls_privatekey = CERT2
139 tls_verify_certificates = CA2
140 tls_try_verify_hosts = *
142 # this will fail to verify the cert at HOSTNAME and fallback to unencrypted
143 # Fail due to lack of correct CA
144 send_to_server_req_fail:
149 tls_certificate = CERT2
150 tls_privatekey = CERT2
152 tls_verify_certificates = CA2
155 # this will fail to verify the cert name and fallback to unencrypted
156 # fail because the cert is "server1.example.com" and the test system is something else
157 send_to_server_req_failname:
162 tls_certificate = CERT2
163 tls_privatekey = CERT2
165 tls_verify_certificates = CA1
166 tls_verify_cert_hostnames = *
169 # this will pass the cert verify including name check
170 # our stunt DNS has an A record for server1.example.com -> HOSTIPV4
171 send_to_server_req_passname:
174 hosts = server1.example.com
176 tls_certificate = CERT2
177 tls_privatekey = CERT2
179 tls_verify_certificates = CA1
180 tls_verify_cert_hostnames = *
183 send_to_server_req_failcarryon:
188 tls_certificate = CERT2
189 tls_privatekey = CERT2
191 tls_verify_certificates = CA1
192 tls_verify_cert_hostnames = *
193 tls_try_verify_hosts = *