1 # Exim test configuration 2033
2 # TLS client: verify certificate from server - name-fails
7 host_lookup_order = bydns
8 primary_hostname = myhost.test.ex
9 spool_directory = DIR/spool
10 log_file_path = DIR/spool/log/SERVER%slog
12 gecos_name = CALLER_NAME
15 S1 = FX/exim-ca/example.com/server1.example.com
18 CERT1 = S1/server1.example.com.pem
19 KEY1 = S1/server1.example.com.unlocked.key
24 # ----- Main settings -----
28 acl_smtp_rcpt = accept
30 log_selector = +tls_peerdn+tls_certificate_verified
35 tls_advertise_hosts = *
37 # Set certificate only if server
39 tls_certificate = ${if eq {SERVER}{server}{CERT1}fail}
40 tls_privatekey = ${if eq {SERVER}{server}{KEY1}fail}
43 tls_verify_certificates = ${if eq {SERVER}{server}{CERT2}fail}
52 condition = ${if eq {SERVER}{server}{yes}{no}}
59 transport = send_to_server_failcert
66 transport = send_to_server_retry
72 transport = send_to_server_crypt
78 transport = send_to_server_req_fail
84 transport = send_to_server_req_failname
90 transport = send_to_server_req_passname
96 transport = send_to_server_req_failcarryon
98 # ----- Transports -----
102 # this will fail to verify the cert at HOSTIPV4 so fail the crypt requirement
103 send_to_server_failcert:
107 hosts_require_tls = HOSTIPV4
109 tls_certificate = CERT2
110 tls_privatekey = CERT2
112 tls_verify_certificates = CA2
114 # this will fail to verify the cert at HOSTIPV4 so fail the crypt, then retry on 127.1; ok
115 send_to_server_retry:
118 hosts = HOSTIPV4 : 127.0.0.1
119 hosts_require_tls = HOSTIPV4
121 tls_certificate = CERT2
122 tls_privatekey = CERT2
124 tls_verify_certificates = \
125 ${if eq{$host_address}{127.0.0.1}{CA1}{CA2}}
127 # this will fail to verify the cert but continue unverified though crypted
128 send_to_server_crypt:
132 hosts_require_tls = HOSTIPV4
134 tls_certificate = CERT2
135 tls_privatekey = CERT2
137 tls_verify_certificates = CA2
138 tls_try_verify_hosts = *
140 # this will fail to verify the cert at HOSTNAME and fallback to unencrypted
141 # Fail due to lack of correct CA
142 send_to_server_req_fail:
147 tls_certificate = CERT2
148 tls_privatekey = CERT2
150 tls_verify_certificates = CA2
153 # this will fail to verify the cert name and fallback to unencrypted
154 # fail because the cert is "server1.example.com" and the test system is something else
155 send_to_server_req_failname:
160 tls_certificate = CERT2
161 tls_privatekey = CERT2
163 tls_verify_certificates = CA1
164 tls_verify_cert_hostnames = *
167 # this will pass the cert verify including name check
168 # our stunt DNS has an A record for server1.example.com -> HOSTIPV4
169 send_to_server_req_passname:
172 hosts = server1.example.com
174 tls_certificate = CERT2
175 tls_privatekey = CERT2
177 tls_verify_certificates = CA1
178 tls_verify_cert_hostnames = *
181 # this will fail to verify the cert name but carry on (try-verify mode)
182 # fail because the cert is "server1.example.com" and the test system is something else
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 = *