LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Issues with self signed cert tomcat 9 (https://www.linuxquestions.org/questions/linux-software-2/issues-with-self-signed-cert-tomcat-9-a-4175652141/)

mozer 04-14-2019 01:36 PM

Issues with self signed cert tomcat 9
 
Hello all,

I’m having problems with tomcat, this should be an easy task but I'm really confused right now

First I generated the cert,

Code:

keytool -genkey -keystore /opt/tomcat/keys/keystore -alias mozer -keyalg RSA -keysize 4096 -validity 720
Then changed configuration in conf/server.xml to open 8443 port whit this code

Code:

<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
          maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
          clientAuth="false"
        SSLProtocol="TLS" 
          keyAlias="mozer" keystoreFile="/opt/tomcat/keys/keystore"
          keystorePass="XXXXXXX" />

Restarted tomcat but there's no port 8443 listening

Code:

[root@localhost logs]# ss -tua
Netid State      Recv-Q Send-Q                                      Local Address:Port                                                        Peer Address:Port               
udp  UNCONN    0      0                                            192.168.0.50:ntp                                                                    *:*                   
udp  UNCONN    0      0                                            192.168.0.55:ntp                                                                    *:*                   
udp  UNCONN    0      0                                            192.168.0.35:ntp                                                                    *:*                   
udp  UNCONN    0      0                                                127.0.0.1:ntp                                                                    *:*                   
udp  UNCONN    0      0                                                        *:ntp                                                                    *:*                   
udp  UNCONN    0      0                          fe80::a00:27ff:fe73:867e%enp0s3:ntp                                                                  :::*                   
udp  UNCONN    0      0                                                      ::1:ntp                                                                  :::*                   
udp  UNCONN    0      0                                                      :::ntp                                                                  :::*                   
tcp  LISTEN    0      128                                                      *:ssh                                                                    *:*                   
tcp  LISTEN    0      100                                              127.0.0.1:smtp                                                                  *:*                   
tcp  ESTAB      0      0                                            192.168.0.35:ssh                                                        192.168.0.16:55006               
tcp  ESTAB      0      0                                            192.168.0.35:ssh                                                        192.168.0.16:55022               
tcp  ESTAB      0      0                                            192.168.0.35:ssh                                                        192.168.0.16:55048               
tcp  LISTEN    0      100                                                    :::8009                                                                  :::*                   
tcp  LISTEN    0      100                                                    :::webcache                                                              :::*                   
tcp  LISTEN    0      128                                                    :::ssh                                                                  :::*                   
tcp  LISTEN    0      100                                                    ::1:smtp                                                                  :::*                   
tcp  LISTEN    0      1                                        ::ffff:127.0.0.1:mxi                                                                  :::*

And I don’t even get errors in catalina.out or any other log….nothing, I have a a couple of WAR deployed and everything is fine…

I also have a couple of virtual hosts

Code:

<Host name="192.168.0.50"  appBase="hudson" unpackWARs="true" autoDeploy="true">
<Alias> test  </Alias>

<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="HU_access_log" suffix=".log"
pattern="%h %l %u %t %r %s %b" />

<Context path="" docBase="/opt/tomcat/webapps/hudson"
debug="0" reloadable="true"/>
</Host>

<Host name="192.168.0.55"  appBase="world" unpackWARs="true" autoDeploy="true">
<Alias> HW  </Alias>

<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="HW_access_log" suffix=".log"
pattern="%h %l %u %t %r %s %b" />

<Context path="" docBase="/opt/tomcat/webapps/world"


debug="0" reloadable="true"/>
</Host>

They are working fine, no firewall, no selinux (using centos 7).

Is there something wrong?

bathory 04-15-2019 05:54 AM

Hi,

I used your server.xml snippet and I got the following exception
Quote:

Caused by: java.lang.IllegalArgumentException: None of the [protocols] specified are supported by the SSL engine : [[TLS]]
Looking closer at your config and tomcat's documentation, looks like you need to use sslProtocol instead of SSLProtocol:
Code:

<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
          maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
          clientAuth="false"
        sslProtocol="TLS" 
          keyAlias="mozer" keystoreFile="/opt/tomcat/keys/keystore"
          keystorePass="XXXXXXX" />

In fact with the above change, tomcat started using tls on port 8443.
Probably the keyword sslProtocol is case sensitive!

Regards


All times are GMT -5. The time now is 12:52 AM.