Saminnet-Search Article Wiki Forum Piwigo SNS Cloud vtiger Sugar
Tomcat-8 SSL

  • Oracle
    • WebLogic Reset (292) Tue04,11:01am

      WebLogic起動するたびにユーザ名とパスワードを聞いてきて煩わしかったので回避したメモ。     securityフォルダを作成     $ mkdir $DOMAIN_HOME/servers/AdminServer/security     boot.propertiesを作成     username=weblogic    password=password     ※平文でOK     nohup & でWeblogicを起動     $ nohup sh $DOMAIN_HOME/ &     ※nohup.outに吐かれるのがいやだったら適当にリダイレクトさせる     boot.propertiesが暗号化されてることを確認     $ ca…


Tomcat-8 SSL

This took me a day to setup on a new CentOS Amazon image. To be honest I’d never configured SSL for tomcat before, and this was the first time that I’d used tomcat8. So I just want to go over the steps I had to do so I’ll remember all of the tweeks needed.

Configuring SSL was more painful than I expected. First issue was that I had to break up the Microsoft IIS formated certificate I had. Fortunatly that I’ve done before. From novell

First create a new folder for all of this.
Type: mkdir cert Type: cd cert
Now get the Intermediate and root certificates from your CA place them in the folder.
Get the .pfx certificate and put it in the folder.

To export the private key without a passphrase or password.
Type: openssl pkcs12 -in filename.pfx -nocerts -nodes -out key.pem

To Generate a public version of the private RSAkey
Type: openssl rsa -in key.pem -out server.key

To export the Certificate
Type: openssl pkcs12 -in filename.pfx -clcerts -nokeys -out cert.pem

The directory will now have a file cert.pem and a key.pem

Now from // This email address is being protected from spambots. You need JavaScript enabled to view it. %3E" target="_blank" style="color: rgb(23, 114, 175); text-decoration: none;">

* key.pem – your certificate’s private key
* cert.pem – your certificate
* domainIntermediate.crt – Organization Validation intermediate
* inter.crt – the intermediate CA that signed your certificate
* root.crt – the root CA that signed the intermediate CA

First, concatenate the CA certs, make sure the intermediate CA goes first:
Note on this – For the chain ON A NORMAL LOAD BALANCER, it’s intermediate first then domain Intermediate then the root, BUT if you want a unified cert like we are doing here the order is different, it would be domain Intermediate, then CA Intermediate, then the CA Root.  Makes no sense to me but for Comodo it is so.

$ cat domainIntermediate.crt inter.crt root.crt > chain.crt

Next, export the pkcs12 file:

$ openssl pkcs12 -export -chain -inkey key.pem -in cert.pem\
-name “server” -CAfile chain.crt -out server.p12

When prompt for export password, enter something and don’t leave it empty.

Now, use keytool to verify:

$ keytool -list -v -storetype pkcs12 -keystore server.p12

Enter the export password for the keystore password. Then you should see
a line like this from the output:

Certificate chain length: 3

Tomcat8 should now be able to use that server.p12 file as it’s keystore.
Move the server.p12 to the tomcat home directory which is /usr/share/tomcat8/
Make sure tomcat is the owner, Type: chmod tomcat:tomcat server.p12
This server needs to use 443 instead of 8443. To do that we need to tweek java permissions.
I used the guide at confluence but used the 5th option:

If using Linux 2.6.24 or later, you can set up a file capability on the java executable, to give elevated privileges to allow opening privileged ports only, and no other superuser privileges:
# setcap cap_net_bind_service+ep /path/to/bin/java
After setting this you may notice errors when starting Java like this, for example:
$ java -version
/path/to/bin/java: error while loading shared libraries: cannot open shared object file: No such file or directory
This means that the library is being imported from a dynamic path, and not in the trusted path. See for details. To fix this, you need to locate the library, and add its path to the configuration. Note that the below is an example, and this may differ depending on Linux distribution. Replace JAVA_HOME with the correct location:
$ find JAVA_HOME -name ‘’

# echo “JAVA_HOME/lib/amd64/jli” > /etc/
# ldconfig -v
After setting this all up, you need to make sure that Confluence only starts java with the direct binary path, and not via a symbolic link, otherwise the capability will not be picked up.
Setting this up means that any user can open privileged ports using Java, which may or may not be acceptable for you

At this point I usually switch user to tomcat. to do that edit /etc/passwd and change tomcat user to use /bin/bash
then as root su tomcat

We need to edit /etc/tomcat8/server.xml
Add a new connector like this:
port=”443″ maxThreads=”200″
scheme=”https” secure=”true” SSLEnabled=”true”
keystoreFile=”${user.home}/server.p12″ keystoreType=”PKCS12″ keystorePass=”changeit”
clientAuth=”false” sslProtocol=”TLS”/>

Also in my case the application was to live on the root so to do that find the host section and add Context like so:

<Host appBase=”webapps” autoDeploy=”true” name=”localhost” unpackWARs=”true”>
<Context docBase=”/var/lib/tomcat8/webapps/YourAppName” path=”” reloadable=”true” />

exit out of the tomcat account change it back to nologin then restart tomcat. Easy right?


0 #1 Guest 2019-09-01 01:03
Greetings from Idaho! I'm bored to death at work so I decided to check out your blog on my iphone during lunch
break. I really like the info you provide here and can't wait to take
a look when I get home. I'm amazed at how quick your
blog loaded on my phone .. I'm not even using WIFI, just 3G ..
Anyhow, very good blog!

Review my web blog; keyword

Articles by Date

TweetTweet Share on LinkedInShare on LinkedIn Share on Google+Google+ Submit to RedditReddit Publish on WordPress WordPress Send emailSend email