HTTPS on JBoss AS 7 - truststore configuration
guinotphil Sep 8, 2011 10:26 AMHello,
I’m trying to port some settings from a JBoss AS 4 server to JBoss AS 7, especially the SSL configuration.
Formerly in JBoss AS 4's server.xml I has the following configuration:
<Connector port="443" protocol="HTTP/1.1"
maxThreads="100"
strategy="ms"
maxHttpHeaderSize="8192"
emptySessionPath="false"
clientAuth="true"
URIEncoding="UTF-8"
scheme="https"
secure="true"
SSLEnabled="true"
keystoreFile="${jboss.server.home.dir}/conf/keystore.jks"
keystorePass="mypassword"
truststoreFile="${jboss.server.home.dir}/conf/truststore.jks"
truststorePass="mypassword"
sslProtocol="TLS"
/>
According to the JBoss Web 7 documentation the configuration is quite different now…
http://docs.jboss.org/jbossweb/7.0.x/config/ssl.html
In standalone.xml (subsystem urn:jboss:domain:web:1.0)
<connector name="https"
scheme="https"
protocol="HTTP/1.1"
socket-binding="https"
enable-lookups="false"
secure="true">
<ssl name="ssl" protocol="TLSv1" key-alias="mykey" />
</connector>
I’m not really sure how to use a keystore, but I guess the key-alias refer to the keystore in the security subsystem: https://docs.jboss.org/author/display/AS7/Security+subsystem+configuration
So, in <security-domain> :
<jsse server-alias="mykey"
keystore-url="C:/test/keystore.jks"
keystore-password="mypassword"
truststore-url="C:/test/truststore_test.jks"
truststore-password="mypassword"
protocols="TLS" />
But, when I start the server, I got the following exception :
10:32:26,224 ERROR [org.apache.tomcat.util.net.jsse.JSSESocketFactory] (MSC service thread 1-2) Failed to load keystore type JKS with path C:\Users\me/.keystore due to C:\Users\me\.keystore (Le fichier spécifié est introuvable): java.io.FileNotFoundException: C:\Users\me\.keystore (Le fichier spécifié est introuvable)
at java.io.FileInputStream.open(Native Method) [:1.6.0_22]
at java.io.FileInputStream.<init>(FileInputStream.java:106) [:1.6.0_22]
at org.apache.tomcat.util.net.jsse.JSSESocketFactory.getStore(JSSESocketFactory.java:374) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at org.apache.tomcat.util.net.jsse.JSSESocketFactory.getKeystore(JSSESocketFactory.java:299) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at org.apache.tomcat.util.net.jsse.JSSESocketFactory.getKeyManagers(JSSESocketFactory.java:515) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at org.apache.tomcat.util.net.jsse.JSSESocketFactory.init(JSSESocketFactory.java:452) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at org.apache.tomcat.util.net.jsse.JSSESocketFactory.createSocket(JSSESocketFactory.java:168) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at org.apache.tomcat.util.net.JIoEndpoint.init(JIoEndpoint.java:999) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at org.apache.coyote.http11.Http11Protocol.init(Http11Protocol.java:190) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at org.apache.catalina.connector.Connector.init(Connector.java:976) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at org.apache.catalina.core.StandardService.addConnector(StandardService.java:351) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at org.jboss.as.web.WebServerService.addConnector(WebServerService.java:121) [jboss-as-web-7.1.0.Alpha1-SNAPSHOT.jar:7.1.0.Alpha1-SNAPSHOT]
at org.jboss.as.web.WebConnectorService.start(WebConnectorService.java:223) [jboss-as-web-7.1.0.Alpha1-SNAPSHOT.jar:7.1.0.Alpha1-SNAPSHOT]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_22]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_22]
at java.lang.Thread.run(Thread.java:662) [:1.6.0_22]
A breakpoint in jbossweb-7.0.1.Final.jar’s org.apache.tomcat.util.net.jsse.JSSESocketFactory tells me that it looks for the keystore from the keystore attribute of the… <ssl> tag!
this.attribute : Hastable {keyAlias=mykey, protocols=TLSv1, enableLookups=false}
I could try to add those tomcat parameters (keystore, keystorePass, truststoreFile, truststorePass) as coded in JSSESocketFactory.java in the <ssl> tag but then the server won’t start because the standalone.xml validation fails!
Any idea then on how to configure JBoss web to use SSL with standalone.xml?
Thank you very much