I\'ve gone through the steps to add an SSL certificate into glassfish v4. I\'ve verified that it works via browsers and via my java swing client (i\'m using apache\'s http
Thank you so much guys @cotfessi and @Mike, your posts really helped me to install an SSL certificate in Glassfish 4.1... so thanks a lot!
I only want to add some extra steps that I had to do, these are:
After step 10 - import ssl cert
keytool -export -alias s1as -file server.cer -keystore keystore.jks
keytool -delete -alias s1as -keystore cacerts.jks
keytool -import -v -trustcacerts -alias s1as -keystore cacerts.jks -file server.cer
later continue with step 11 - restart the server
I also want to add some information that could be useful to who buy the SSL certificate in GoDaddy...
I also want to recomend this post that helped me to redirect my HTTP trafic to HTTPS without doing extra configuration to Glassfish (only to my web app): how to redirect http to https with glassfish v4
The problem is almost certainly that the distinguished name (DN
) of the s1as certificate has changed, but the secure admin principal has not been updated.
There is an asadmin command (enable-secure-admin-principal
) which allows you to manually update this, but you can also just run enable-secure-admin
again (even though secure admin is already enabled). This command will call the same code as the previous one and replace the secure admin principals with the correct ones from whatever the admin certificate alias is (s1as).
You will then need to restart GlassFish for the change to take effect, but you will then be able to log in to the admin console.
The root cause is that the admin console is essentially doing 2-way SSL along with your login, so your username and password is verified for you, the admin user, then the admin console itself is verified with the DN
as a user ID and the s1as key as a password. This is because the admin console communicates with the DAS over REST and needs to identify itself as a trusted client.
Hope all that background helps, but the TL;DR is as follows:
enable-secure-admin
once more