| 1 | # Exim test configuration 2033 |
| 2 | # TLS client: verify certificate from server - name-fails |
| 3 | |
| 4 | SERVER= |
| 5 | |
| 6 | .include DIR/aux-var/tls_conf_prefix |
| 7 | |
| 8 | primary_hostname = myhost.test.ex |
| 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 | |
| 22 | disable_ipv6 = true |
| 23 | |
| 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 | |
| 88 | client_t: |
| 89 | driver = accept |
| 90 | local_parts = usert |
| 91 | retry_use_local_part |
| 92 | transport = send_to_server_req_failcarryon |
| 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 |
| 103 | hosts_require_tls = HOSTIPV4 |
| 104 | port = PORT_D |
| 105 | tls_certificate = CERT2 |
| 106 | tls_privatekey = CERT2 |
| 107 | |
| 108 | tls_verify_certificates = CA2 |
| 109 | |
| 110 | # this will fail to verify the cert at HOSTIPV4 so fail the crypt, then retry on 127.1; ok |
| 111 | send_to_server_retry: |
| 112 | driver = smtp |
| 113 | allow_localhost |
| 114 | hosts = HOSTIPV4 : 127.0.0.1 |
| 115 | hosts_require_tls = HOSTIPV4 |
| 116 | port = PORT_D |
| 117 | tls_certificate = CERT2 |
| 118 | tls_privatekey = CERT2 |
| 119 | |
| 120 | tls_verify_certificates = \ |
| 121 | ${if eq{$host_address}{127.0.0.1}{CA1}{CA2}} |
| 122 | |
| 123 | # this will fail to verify the cert but continue unverified though crypted |
| 124 | send_to_server_crypt: |
| 125 | driver = smtp |
| 126 | allow_localhost |
| 127 | hosts = HOSTIPV4 |
| 128 | hosts_require_tls = HOSTIPV4 |
| 129 | port = PORT_D |
| 130 | tls_certificate = CERT2 |
| 131 | tls_privatekey = CERT2 |
| 132 | |
| 133 | tls_verify_certificates = CA2 |
| 134 | tls_try_verify_hosts = * |
| 135 | |
| 136 | # this will fail to verify the cert at HOSTNAME and fallback to unencrypted |
| 137 | # Fail due to lack of correct CA |
| 138 | send_to_server_req_fail: |
| 139 | driver = smtp |
| 140 | allow_localhost |
| 141 | hosts = HOSTNAME |
| 142 | port = PORT_D |
| 143 | tls_certificate = CERT2 |
| 144 | tls_privatekey = CERT2 |
| 145 | |
| 146 | tls_verify_certificates = CA2 |
| 147 | tls_verify_hosts = * |
| 148 | |
| 149 | # this will fail to verify the cert name and fallback to unencrypted |
| 150 | # fail because the cert is "server1.example.com" and the test system is something else |
| 151 | send_to_server_req_failname: |
| 152 | driver = smtp |
| 153 | allow_localhost |
| 154 | hosts = HOSTNAME |
| 155 | port = PORT_D |
| 156 | tls_certificate = CERT2 |
| 157 | tls_privatekey = CERT2 |
| 158 | |
| 159 | tls_verify_certificates = CA1 |
| 160 | tls_verify_cert_hostnames = * |
| 161 | tls_verify_hosts = * |
| 162 | |
| 163 | # this will pass the cert verify including name check |
| 164 | # our stunt DNS has an A record for server1.example.com -> HOSTIPV4 |
| 165 | send_to_server_req_passname: |
| 166 | driver = smtp |
| 167 | allow_localhost |
| 168 | hosts = server1.example.com |
| 169 | port = PORT_D |
| 170 | tls_certificate = CERT2 |
| 171 | tls_privatekey = CERT2 |
| 172 | |
| 173 | tls_verify_certificates = CA1 |
| 174 | tls_verify_cert_hostnames = * |
| 175 | tls_verify_hosts = * |
| 176 | |
| 177 | # this will fail to verify the cert name but carry on (try-verify mode) |
| 178 | # fail because the cert is "server1.example.com" and the test system is something else |
| 179 | send_to_server_req_failcarryon: |
| 180 | driver = smtp |
| 181 | allow_localhost |
| 182 | hosts = HOSTNAME |
| 183 | port = PORT_D |
| 184 | tls_certificate = CERT2 |
| 185 | tls_privatekey = CERT2 |
| 186 | |
| 187 | tls_verify_certificates = CA1 |
| 188 | tls_verify_cert_hostnames = * |
| 189 | tls_try_verify_hosts = * |
| 190 | |
| 191 | # End |