Bug 1104581

Summary: Tomcat configured to use SSL is discovered as Tomcat(null) in JBoss ON
Product: [JBoss] JBoss Enterprise Web Server 2 Reporter: bkramer <bkramer>
Component: JON PluginAssignee: Jean-frederic Clere <jclere>
Status: CLOSED CURRENTRELEASE QA Contact: Libor Fuka <lfuka>
Severity: high Docs Contact:
Priority: unspecified    
Version: 2.1.0CC: ccrouch, jdoyle, loleary, mfoley, mhusnain, myarboro, tsegismo
Target Milestone: ER04   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Previously when using JBoss Enterprise Web Server with JBoss Operations Network, when Tomcat was configured to use SSL, it was incorrectly discovered as <literal>Tomcat(null)</literal> instead of correctly identified as <literal>Tomcat($PORT)</literal>. This problem is now fixed in JBoss Enterprise Web Server 2.1 and Tomcat is correctly discovered as <literal>Tomcat($PORT)</literal> as expected.
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-08-21 21:40:11 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1104586    
Bug Blocks: 1111666    

Description bkramer 2014-06-04 09:06:26 UTC
Description of problem:
Tomcat configured to use SSL is discovered as Tomcat(null) in JBoss ON

Version-Release number of selected component (if applicable):
JBoss On 3.1.2
Tomcat 6

How reproducible:
Always

Steps to Reproduce:
1. Tomcat6/conf/server.xml connector config should contain something like:

    <Connector port="9441" protocol="HTTP/1.1" SSLEnabled="true"

               maxThreads="50" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS"
               keystoreFile="/home/guest/jboss/ews10/tomcat6/conf/tomcat.jks" 
               keystorePass="password"
               truststoreFile="/home/guest/jboss/ews10/tomcat6/conf/tomcat.truststore.jks" 
               truststorePass="password"/>

2.  ** self-signed cert tomcat server
    keytool -genkeypair  -keystore tomcat.jks -storepass password -keypass password -dname "cn=boom.usersys.redhat.com, ou=GSS,dc=redhat,dc=com" -alias tomcat  -keyalg RSA -keysize 1024 -validity 365
 
    ** self-signed cert browser
    keytool -genkeypair  -keystore client.keystore.jks -storepass password -keypass password -dname "cn=donkey.usersys.redhat.com, ou=GSS,dc=redhat,dc=com" -alias donkey -validity 365

    ** export tomcat server cert
    keytool -exportcert  -keystore tomcat.jks -alias tomcat -storepass password -file tomcat.cer
 
    ** export client cert
    keytool -exportcert  -keystore client.keystore.jks -alias donkey -storepass password -file client.cer
 
    ** import client cert to tomcat svr truststore
    keytool -importcert -keystore tomcat.truststore.jks -storepass password -alias donkey -file client.cer -noprompt

    ** import tomcat svr cert into client truststore
    keytool -importcert -keystore client.truststore.jks -storepass password -alias tomcat -file tomcat.cer -noprompt

3. Make the following changed in the Tomcat6/bin/startup.sh - top entry in the file:

   JAVA_OPTS="${JAVA_OPTS} -Dcom.sun.management.jmxremote.port=7444 -Djava.rmi.server.hostname=127.0.0.1"
   JAVA_OPTS="${JAVA_OPTS} -Dcom.sun.management.jmxremote.access.file=/home/guest/jboss/ews10/tomcat6/conf/access.properties"
   JAVA_OPTS="${JAVA_OPTS} -Dcom.sun.management.jmxremote.password.file=/home/guest/jboss/ews10/tomcat6/conf/password.properties"
   JAVA_OPTS="${JAVA_OPTS} -Dcom.sun.management.jmxremote.ssl=false"

Where  access.properties and password.properties were copied over from $JAVA_HOME/sample/jmx/jmx-scandir/src/etc/

4. Make sure that permissions are properly set for password.properties file:
   sudo chmod 0600 /home/guest/jboss/ews10/tomcat6/conf/password.properties

5. Start tomcat6 instance

6. Login to JBoss ON UI and navigate to the discovery queue - and it should show up Tomcat (null)

Actual results:
Tomcat instance is discovered but as Tomcat(null)

Expected results:
Tomcat instance is discovered properly with Tomcat(<port>)

Additional info:

The issue seems to be in the rhq/source/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/helper/TomcatConfig.java#146:

***********************************************************

             String scheme = attributes.getValue("scheme");
147             if ("https".equals(scheme)) {
148                 return;
149             }
150 
151             String className = attributes.getValue("className");
152             if (className != null) {
153                 if (className.endsWith("WarpConnector") //e.g. 4.0.x
154                     || className.endsWith("Ajp13Connector")) {
155                     return;
156                 }
157             }
158 
159             this.port = attributes.getValue("port");
160             this.address = attributes.getValue("address");
161         }
162 
163         protected String getPort() {
164             return port;
165         }
166 
167         protected String getAddress() {
168             return address;
169         }
170     }


***********************************************************

If schema is https no port or address is returned.

Comment 2 Jean-frederic Clere 2014-06-12 17:39:16 UTC
https://github.com/rhq-project/rhq/pull/53 fix for upstream.

Comment 3 Thomas Segismont 2014-06-13 08:00:51 UTC
Merged in master

commit 8cca19810d4a684fd9f376328bc5e45054684845
Merge: a348010 fd63a38
Author: Thomas Segismont <tsegismont>
Date:   Fri Jun 13 09:58:54 2014 +0200

Comment 5 Libor Fuka 2014-07-17 13:32:48 UTC
VERIFIED on RHEL5 x86_64 + JON 3.2.0.GA (update02) + JON Tomcat plugin (update01) + OpenJDK 1.7 + EWS RPM Tomcat6/7

It is discovered as Tomcat(8443)

Comment 6 Libor Fuka 2014-07-18 08:57:58 UTC
VERIFIED on RHEL7 x86_64 + JON 3.2.0.GA (update02) + JON Tomcat plugin (update01) + OpenJDK 1.7 + EWS RPM Tomcat6/7

Comment 7 Larry O'Leary 2014-08-21 21:40:11 UTC
This fix, change, or update was tested and released in Web Server Plugin Pack Update-01 for JBoss ON 3.2 -- https://access.redhat.com/jbossnetwork/restricted/softwareDetail.html?softwareId=32543