Create a java keystore
Start by creating a java keystore with a self signed certificate:c:
mkdir ssl
cd ssl
keytool -genkey -keyalg RSA -alias mycert -keystore keystore.jks -storepass password -keypass password -validity 360 -keysize 2048 -dname "cn=coder36.com, O=Coder36 L=Newcastle, S=England, C=GB"
The keystore password is: password and the private key password is: password
View the certificate using:
keytool -list -v -keystore keystore.jks -alias mycert -storepass password
c:/ssl/keystore.jks will now contain your private key and a self signed certificate.
Enable SSL
The next step is to enable SSL on the management interfaces. Edit standalone.xml. Search for the <management> tags and update. I've highlighted what's changed from out of the box:<management>
<security-realms>
<security-realm name="ManagementRealm">
<server-identities>
<ssl protocol="TLSv1">
<keystore path="C:/ssl/keystore.jks" password="password"/>
</ssl>
</server-identities>
<authentication>
<properties path="mgmt-users.properties" relative-to="jboss.server.config.dir"/>
</authentication>
</security-realm>
<security-realm name="ApplicationRealm">
<authentication>
<properties path="application-users.properties" relative-to="jboss.server.config.dir"/>
</authentication>
</security-realm>
</security-realms>
<management-interfaces>
<native-interface security-realm="ManagementRealm">
<socket-binding native="management-native"/>
</native-interface>
<http-interface security-realm="ManagementRealm">
<socket-binding https="management-https"/>
</http-interface>
</management-interfaces>
</management>
Testing
Restart the JBoss standalone server and test:Open a web and navigate to: https://localhost:9443/console. You will be presented with the usual warnings about using untrusted certificates Interestingly, the https console does not work with Google Chrome, but works fine with Internet Explorer, and what ever is built into eclipse.
Test the CLI using:
jboss-cli.sh -c
Using this solution we can prove that the jboss server we are calling is who we think we are calling. It's also more secure in that it encrypts traffic to and from the server.
Comments
With a few changes, it straight forward to get the management console protected with SSL.I'm of the opinion that java key stores are a bit clunky and unfriendly. I much prefer the .pem format with openssl etc. From my commercial experience, it's generally a bad idea to use java to do the SSL work. Architecturally it would be better to offload the SSL termination to dedicated hardware (CISCO provides ACE modules to do this kind of work), or dedicated software like apache - see one of my earlier posts for how this could be done.
tempat nyari SSL murah ya di IDwebhost.com Cuman disini kamu bisa menemukan paket terbaik untuk hosting webkamu.
ReplyDelete