Strovent SystemsSign in
Reference

TN3270 TLS works from Windows but fails in a Linux container: the private CA is missing

A TN3270 or TN5250 TLS host that works from a Windows PC can fail from a Linux container. The container's own CA list lacks your company CA. How to add it.

A script or emulator connects to a TN3270 or TN5250 host over TLS (often port 992). It works from a Windows PC. The same program, or a similar one, run in a Linux container fails at the TLS handshake with a certificate error.

The usual cause is not the host. The host's certificate was issued by your company's own certificate authority (CA), and the two machines check it against different lists of trusted CAs.

Two different trust stores

  • Windows. Programs that use the Windows TLS stack check certificates against the Windows certificate store. Its Trusted Root Certification Authorities store holds the root CAs Windows trusts, and a company can push its internal root CA into it with Group Policy. Then every program on the PC that uses this store trusts the company CA.
  • A Linux container. Programs built on OpenSSL commonly load OpenSSL's default CA file and directory. In a container, those hold whatever CA bundle the image installed, which has no company CA unless someone added it.

Emulators can use a different TLS library on each platform. The x3270 family, for example, documents CA file and CA directory options that apply only where it uses OpenSSL, and has separate settings for Windows TLS.

Fix: add the CA to the image

On a Debian or Ubuntu based image, with the ca-certificates package:

COPY company-root-ca.crt /usr/local/share/ca-certificates/
RUN update-ca-certificates

The file name must end in .crt. update-ca-certificates adds every .crt file under /usr/local/share/ca-certificates to /etc/ssl/certs and to the single file /etc/ssl/certs/ca-certificates.crt.

Other ways to point an OpenSSL-based program at the CA:

  • The SSL_CERT_FILE (a file) or SSL_CERT_DIR (a directory) environment variable overrides OpenSSL's default locations.
  • Many programs have their own option, such as x3270's -cafile and -cadir.

Check from inside the container

openssl s_client -connect host.example.com:992 -showcerts
openssl s_client -connect host.example.com:992 -CAfile company-root-ca.crt

-showcerts prints the certificates the server sent (not a verified chain), so you can see which CA issued them. The second command verifies against the file you name.

Turning certificate checking off (for example x3270's -noverifycert) hides the problem instead of fixing it. If the CA is trusted and the handshake still fails, check the TLS version: x3270, for example, documents its default minimum TLS version as platform dependent. For a name error, see TLS hostname mismatch on a TN3270 or TN5250 connection.

This app has no setting to load a CA certificate file; to connect to a host whose certificate comes from a private CA, see TLS and certificates.

Sources

Spotted a mistake? Email [email protected].