Commit | Line | Data |
---|---|---|
7f3555b3 | 1 | # Exim test configuration 2033 |
a320fabd | 2 | # TLS client: verify certificate from server - name-fails |
e51c7be2 JH |
3 | |
4 | SERVER= | |
5 | ||
d4dc049f JH |
6 | .include DIR/aux-var/tls_conf_prefix |
7 | ||
e51c7be2 | 8 | primary_hostname = myhost.test.ex |
e51c7be2 JH |
9 | |
10 | FX = DIR/aux-fixed | |
11 | S1 = FX/exim-ca/example.com/server1.example.com | |
12 | ||
13 | CA1 = S1/ca_chain.pem | |
14 | CERT1 = S1/server1.example.com.pem | |
15 | KEY1 = S1/server1.example.com.unlocked.key | |
16 | CA2 = FX/cert2 | |
17 | CERT2 = FX/cert2 | |
18 | KEY2 = FX/cert2 | |
19 | ||
20 | # ----- Main settings ----- | |
21 | ||
54dcc2cc JH |
22 | disable_ipv6 = true |
23 | ||
e51c7be2 JH |
24 | acl_smtp_rcpt = accept |
25 | ||
26 | log_selector = +tls_peerdn+tls_certificate_verified | |
27 | ||
28 | queue_only | |
29 | queue_run_in_order | |
30 | ||
31 | tls_advertise_hosts = * | |
32 | ||
33 | # Set certificate only if server | |
34 | ||
35 | tls_certificate = ${if eq {SERVER}{server}{CERT1}fail} | |
36 | tls_privatekey = ${if eq {SERVER}{server}{KEY1}fail} | |
37 | ||
38 | tls_verify_hosts = * | |
39 | tls_verify_certificates = ${if eq {SERVER}{server}{CERT2}fail} | |
40 | ||
41 | ||
42 | # ----- Routers ----- | |
43 | ||
44 | begin routers | |
45 | ||
46 | server_dump: | |
47 | driver = redirect | |
48 | condition = ${if eq {SERVER}{server}{yes}{no}} | |
49 | data = :blackhole: | |
50 | ||
51 | client_x: | |
52 | driver = accept | |
53 | local_parts = userx | |
54 | retry_use_local_part | |
55 | transport = send_to_server_failcert | |
56 | errors_to = "" | |
57 | ||
58 | client_y: | |
59 | driver = accept | |
60 | local_parts = usery | |
61 | retry_use_local_part | |
62 | transport = send_to_server_retry | |
63 | ||
64 | client_z: | |
65 | driver = accept | |
66 | local_parts = userz | |
67 | retry_use_local_part | |
68 | transport = send_to_server_crypt | |
69 | ||
70 | client_q: | |
71 | driver = accept | |
72 | local_parts = userq | |
73 | retry_use_local_part | |
74 | transport = send_to_server_req_fail | |
75 | ||
76 | client_r: | |
77 | driver = accept | |
78 | local_parts = userr | |
79 | retry_use_local_part | |
80 | transport = send_to_server_req_failname | |
81 | ||
82 | client_s: | |
83 | driver = accept | |
84 | local_parts = users | |
85 | retry_use_local_part | |
86 | transport = send_to_server_req_passname | |
87 | ||
aa2a70ba JH |
88 | client_t: |
89 | driver = accept | |
90 | local_parts = usert | |
91 | retry_use_local_part | |
92 | transport = send_to_server_req_failcarryon | |
e51c7be2 JH |
93 | |
94 | # ----- Transports ----- | |
95 | ||
96 | begin transports | |
97 | ||
98 | # this will fail to verify the cert at HOSTIPV4 so fail the crypt requirement | |
99 | send_to_server_failcert: | |
100 | driver = smtp | |
101 | allow_localhost | |
102 | hosts = HOSTIPV4 | |
e51c7be2 | 103 | port = PORT_D |
277b9979 JH |
104 | hosts_try_fastopen = : |
105 | hosts_require_tls = HOSTIPV4 | |
e51c7be2 JH |
106 | tls_certificate = CERT2 |
107 | tls_privatekey = CERT2 | |
108 | ||
109 | tls_verify_certificates = CA2 | |
110 | ||
111 | # this will fail to verify the cert at HOSTIPV4 so fail the crypt, then retry on 127.1; ok | |
112 | send_to_server_retry: | |
113 | driver = smtp | |
114 | allow_localhost | |
115 | hosts = HOSTIPV4 : 127.0.0.1 | |
e51c7be2 | 116 | port = PORT_D |
277b9979 JH |
117 | hosts_try_fastopen = : |
118 | hosts_require_tls = HOSTIPV4 | |
e51c7be2 JH |
119 | tls_certificate = CERT2 |
120 | tls_privatekey = CERT2 | |
121 | ||
122 | tls_verify_certificates = \ | |
123 | ${if eq{$host_address}{127.0.0.1}{CA1}{CA2}} | |
124 | ||
125 | # this will fail to verify the cert but continue unverified though crypted | |
126 | send_to_server_crypt: | |
127 | driver = smtp | |
128 | allow_localhost | |
129 | hosts = HOSTIPV4 | |
e51c7be2 | 130 | port = PORT_D |
277b9979 JH |
131 | hosts_try_fastopen = : |
132 | hosts_require_tls = HOSTIPV4 | |
e51c7be2 JH |
133 | tls_certificate = CERT2 |
134 | tls_privatekey = CERT2 | |
135 | ||
136 | tls_verify_certificates = CA2 | |
137 | tls_try_verify_hosts = * | |
138 | ||
a320fabd JH |
139 | # this will fail to verify the cert at HOSTNAME and fallback to unencrypted |
140 | # Fail due to lack of correct CA | |
e51c7be2 JH |
141 | send_to_server_req_fail: |
142 | driver = smtp | |
143 | allow_localhost | |
a320fabd | 144 | hosts = HOSTNAME |
e51c7be2 | 145 | port = PORT_D |
277b9979 | 146 | hosts_try_fastopen = : |
e51c7be2 JH |
147 | tls_certificate = CERT2 |
148 | tls_privatekey = CERT2 | |
149 | ||
150 | tls_verify_certificates = CA2 | |
151 | tls_verify_hosts = * | |
152 | ||
153 | # this will fail to verify the cert name and fallback to unencrypted | |
a320fabd | 154 | # fail because the cert is "server1.example.com" and the test system is something else |
e51c7be2 JH |
155 | send_to_server_req_failname: |
156 | driver = smtp | |
157 | allow_localhost | |
a320fabd | 158 | hosts = HOSTNAME |
e51c7be2 | 159 | port = PORT_D |
277b9979 | 160 | hosts_try_fastopen = : |
e51c7be2 JH |
161 | tls_certificate = CERT2 |
162 | tls_privatekey = CERT2 | |
163 | ||
164 | tls_verify_certificates = CA1 | |
a320fabd | 165 | tls_verify_cert_hostnames = * |
e51c7be2 JH |
166 | tls_verify_hosts = * |
167 | ||
168 | # this will pass the cert verify including name check | |
a320fabd | 169 | # our stunt DNS has an A record for server1.example.com -> HOSTIPV4 |
e51c7be2 JH |
170 | send_to_server_req_passname: |
171 | driver = smtp | |
172 | allow_localhost | |
a320fabd | 173 | hosts = server1.example.com |
e51c7be2 | 174 | port = PORT_D |
277b9979 | 175 | hosts_try_fastopen = : |
e51c7be2 JH |
176 | tls_certificate = CERT2 |
177 | tls_privatekey = CERT2 | |
178 | ||
179 | tls_verify_certificates = CA1 | |
a320fabd | 180 | tls_verify_cert_hostnames = * |
e51c7be2 JH |
181 | tls_verify_hosts = * |
182 | ||
aa2a70ba JH |
183 | # this will fail to verify the cert name but carry on (try-verify mode) |
184 | # fail because the cert is "server1.example.com" and the test system is something else | |
185 | send_to_server_req_failcarryon: | |
186 | driver = smtp | |
187 | allow_localhost | |
188 | hosts = HOSTNAME | |
189 | port = PORT_D | |
277b9979 | 190 | hosts_try_fastopen = : |
aa2a70ba JH |
191 | tls_certificate = CERT2 |
192 | tls_privatekey = CERT2 | |
193 | ||
194 | tls_verify_certificates = CA1 | |
195 | tls_verify_cert_hostnames = * | |
196 | tls_try_verify_hosts = * | |
197 | ||
e51c7be2 | 198 | # End |