HTTPS SSL configuration

Overall steps :
**Java Key Store — is where you store all your keys (its a vault)
**Overall Process
1. Create private key → 2. Create CSR → 3. Get it signed by CA → 4. Cert Chain (server, intermediate, root CA) generated → 5. Configure webserver with private key & cert chain(3)

→ Java Application (ex. jira) : create key store (JKS, java key store) — usually in the java_home/bin directory
create csr (CSR, certificate signing request)
submit csr to CA for signing

<JAVA_HOME>/keytool -genkey -alias jira -keyalg RSA -keystore <Jira_HOME>/jira.jks

Inside Java_home/bin -> there is a lot of tools including keytool
Where is Java_home
which java
sudo find /usr/ -name *jdk
/usr/lib/jvm/java-1.8.0-openjdk <- find this!! (don’t confuse with other dir)

Openssl vs Java Keytool

CACERT vs Letsencrypt (&certbot)

Certificate Chain vs Signed Certificate(server), Intermediate CA, Root CA
- Certificate Chain (chain.pem) is all of these 3 together in one file
- If you send CSR → CA for signing, CA will generate ALL 3 or CHAIN

$ sudo certbot certonly --standalone -d # Ubuntu
$ sudo ./certbot-auto certonly --standalone -d # CentOS/RHEL

This will generate two things
1. Key chain /etc/letsencrypt/live/
2. Server's Private Key /etc/letsencrypt/live/

***How to Configure in Jira *****
>> : using CAcert(create individual priv key + key chain + CSR)
>> letsencrypt does it all for you -> and converting to JKS at the end)

[Objective] After you get your CA signed, you need to …
: PRIVATE KEY(server signed) + KEY CHAIN(3) ==> PKCS12 KEY

openssl pkcs12 -export -out /tmp/digifac.online_fullchain_and_key.p12 -in /etc/letsencrypt/live/ -inkey /etc/letsencrypt/live/ -name jira

>>Convert PKCS12 into JKS (Java Key Store)

keytool -importkeystore -deststorepass 1234 -destkeypass 1234 -destkeystore jira.jks -srckeystore /tmp/digifac.online_fullchain_and_key.p12 -srcstoretype PKCS12 -srcstorepass 1234 -alias jira

>>Configure the Server settings (sever.xml)
>>EDIT HTTPS connector

<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
maxHttpHeaderSize="8192" SSLEnabled="true"
maxThreads="150" minSpareThreads="25"
enableLookups="false" disableUploadTimeout="true"
acceptCount="100" scheme="https" secure="true"
clientAuth="false" useBodyEncodingForURI="true"
keyAlias="jira" keystoreFile="/usr/lib/jvm/java-8-openjdk-amd64/jre/jira.jks"
keystorePass="1234" keystoreType="JKS"/>

>>EDIT HTTP connector to redirect 80 -> 8443
<Connector acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" enableLookups="false" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" port="8080" protocol="HTTP/1.1" redirectPort="8443" useBodyEncodingForURI="true"/>

>>Redirect all (underlying) URLS to HTTPS
(Insert in web.xml file)


>>RESTART jira
>>Open Security Group 8443 (https)
>>Configure Auto renewal of CERTBOT certificate (cronjob)