Strovent SystemsSign in
Reference

TLS hostname mismatch on a TN3270 or TN5250 connection

Hostname mismatch means no subjectAltName entry in the host's certificate matches the name or IP you typed. Connect with a listed name or get a new certificate.

A secure 3270 or 5250 connection stops with a message such as Hostname mismatch or "certificate name does not match". The certificate itself may be valid and trusted. It was issued for a different name than the one you connected to.

What the client compares

During the TLS handshake the client compares the name you typed in the connection (or the IP address) with the names in the host's certificate. Current rules (RFC 9525):

  • Only the subjectAltName extension counts. A host name must appear as a DNS: entry.
  • The Common Name (CN) in the certificate subject is not used for this check. A certificate with the right CN but no matching subjectAltName fails with clients that follow these rules, even if older clients accepted it.
  • An IP address must appear as its own IP Address: entry and match exactly. A certificate that lists only names fails when you connect by IP.
  • A wildcard such as *.example.com matches exactly one label: tn3270.example.com, but not example.com and not a.b.example.com.

Usual causes

  • You connected by IP address (for example 192.0.2.10), and the certificate lists only host names.
  • You used a short name or alias (mainframe), and the certificate lists the full name (mainframe.example.com), or the reverse.
  • The host was renamed or moved, and the certificate still carries the old name.
  • The certificate has the name only in the CN, with no subjectAltName.
  • A load balancer or a host with several services presents a different certificate than expected.

See which names the certificate has

From a computer with OpenSSL, replace the host and port:

echo | openssl s_client -connect host.example.com:992 -servername host.example.com | openssl x509 -noout -subject -ext subjectAltName

The X509v3 Subject Alternative Name line lists every DNS: and IP Address: entry. Connect with one of those names exactly.

The right fix

  • As a user: change the host field to a name that appears in the subjectAltName list. Make sure that name resolves to the same host.
  • As an administrator: issue a certificate whose subjectAltName contains every name and IP address users connect with, and assign it to the TN3270 or Telnet server.

Turning off certificate checking makes the error go away, but then the client cannot tell the real host from an impostor, and the password crosses the network to whoever answers. Treat that as a short test only, not a fix.

Other certificate errors

A mismatch is only one of the checks. An untrusted company CA or an expired certificate gives different errors; see TLS for 3270 and 5250. On z/OS the server side of a failed handshake shows as EZZ6034I CONN DROP ERR 6002. If the handshake fails over the TLS version rather than the name, see 5250 TLS stops working after an IBM i upgrade or PTF.

Sources

Spotted a mistake? Email [email protected].