'Tomcat 9 APR Connector and SSL

I have installed Tomcat on a Centos7 machine. The tomcat on this machine is accessible from users connected to the company vpn.

http:10.xx.xx.xx:8080 works fine but when we tried to secure the connection and use an SSL using the APR Connector that does not work.

To generate my certificates I followed these steps :

Generate a private key for the CA:

$ openssl genrsa 2048 > ca-key.pem

Generate the X509 certificate for the CA:

$ openssl req -new -x509 -nodes -days 365000 \
   -key ca-key.pem \
   -out ca-cert.pem

Creating the Server's Certificate and Keys Generate the private key and certificate request:

$ openssl req -newkey rsa:2048 -nodes -days 365000 \
   -keyout server-key.pem \
   -out server-req.pem

Generate the X509 certificate for the server:

$ openssl x509 -req -days 365000 -set_serial 01 \
   -in server-req.pem \
   -out server-cert.pem \
   -CA ca-cert.pem \
   -CAkey ca-key.pem

Verifying the Certificates :

$ openssl verify -CAfile ca-cert.pem    ca-cert.pem    server-cert.pem
>ca-cert.pem: OK
>server-cert.pem: OK

my server.xml configuration :

<Connector port="8443" maxHttpHeaderSize="8192"
                 maxThreads="150"
                 enableLookups="false" disableUploadTimeout="true"
                 acceptCount="100" scheme="https" secure="true"
                 SSLEnabled="true"
                 SSLCertificateFile="/opt/tomcat/cert/server-cert.pem"
                 SSLCertificateKeyFile="/opt/tomcat/cert/server-key.pem" />

the log file says that every thing went OK :

07-Apr-2022 17:27:57.028 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-apr-8080"]
07-Apr-2022 17:27:57.055 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["https-openssl-apr-8443"]

I tried to use the JSSE connector but same thing. Http works fine but not the HTTPS.

Testing with elinks locally :

enter image description here

but telnet says that network is ok and it cann connect to the server on the port 8443.

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source