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

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

      WebLogic襍キ蜍輔☆繧九◆縺ウ縺ォ繝ヲ繝シ繧カ蜷阪→繝代せ繝ッ繝シ繝峨r閨槭>縺ヲ縺阪※辣ゥ繧上@縺九▲縺溘ョ縺ァ蝗樣∩縺励◆繝。繝「縲 ツツツ security繝輔か繝ォ繝繧剃ス懈 ツツツ $ mkdir $DOMAIN_HOME/servers/AdminServer/security ツツツ boot.properties繧剃ス懈青ツツ boot.properties ツツツ username=weblogicツツツ password=password ツツツ 窶サ蟷ウ譁縺ァOK ツツツ nohup & 縺ァWeblogic繧定オキ蜍 ツツツ $ nohup sh $DOMAIN_HOME/startWebLogic.sh & ツツツ 窶サnohup.out縺ォ蜷舌°繧後k縺ョ縺後>繧縺縺」縺溘i驕ゥ蠖薙↓繝ェ繝繧、繝ャ繧ッ繝医&縺帙k ツツツ boot.properties縺梧囓蜿キ蛹悶&繧後※繧九%縺ィ繧堤「コ隱 ツツツ $ ca…

      Read More...

Tomcat-8 SSL

This took me a day to setup on a new CentOS Amazon image. To be honest I窶囘 never configured SSL for tomcat before, and this was the first time that I窶囘 used tomcat8. So I just want to go over the steps I had to do so I窶冤l 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窶况e 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ツ//mail-archives.apache.org/mod_mbox/tomcat-users/200409.mbox/% 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;">apache.org
Assuming:

* key.pem 窶 your certificate窶冱 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窶冱 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 窶徭erver窶 -CAfile chain.crt -out server.p12

When prompt for export password, enter something and don窶冲 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窶冱 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: libjli.so: 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 ld.so path. See http://bugs.sun.com/view_bug.do?bug_id=7157699 for details. To fix this, you need to locate the library, and add its path to the ld.so 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 窶詫ibjli.so窶
JAVA_HOME/lib/amd64/jli/libjli.so

# echo 窶廱AVA_HOME/lib/amd64/jli窶 > /etc/ld.so.conf.d/java-libjli.conf
# 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:
<Connector
protocol=窶捐rg.apache.coyote.http11.Http11NioProtocol窶
port=窶443窶ウ maxThreads=窶200窶ウ
scheme=窶拮ttps窶 secure=窶掖rue窶 SSLEnabled=窶掖rue窶
keystoreFile=窶${user.home}/server.p12窶ウ keystoreType=窶抉KCS12窶ウ keystorePass=窶拂hangeit窶
clientAuth=窶拉alse窶 sslProtocol=窶抖LS窶/>

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=窶掫ebapps窶 autoDeploy=窶掖rue窶 name=窶挈ocalhost窶 unpackWARs=窶掖rue窶>
<Context docBase=窶/var/lib/tomcat8/webapps/YourAppName窶 path=窶昶 reloadable=窶掖rue窶 />

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

Comments   

 
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
Quote
 

Articles by Date

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