Changes between Initial Version and Version 1 of dev/tls


Ignore:
Timestamp:
10/27/21 13:33:29 (3 years ago)
Author:
Mad Martian
Comment:

Initial introduction

Legend:

Unmodified
Added
Removed
Modified
  • dev/tls

    v1 v1  
     1= Mutual TLS Connectivity
     2This page isn't strictly related to MadMartian Mod but it is necessary for JMX over TLS which we use to monitor MadMartian Mod remotely and securely.
     3
     4== Mutual Trust
     5Both the client (Java Mission Control) and the server (JMX) require three things:
     6* Self-signed certificate
     7* Private key
     8* Trust store
     9
     10Self-signed certificates come with a private key (standard PKI), that's the infamous pair right there (you hare).  The trust store is for storing the other side's public key.
     11
     12== Generate Self-Signed Certificate and Private Key Store
     13Before we get started it is imperative that the store passwords match the private key passwords, otherwise you'll get unrecoverable key errors when trying to handshake.
     14
     15First step is to generate a private key:
     16{{{#!sh
     17openssl genrsa -out my.key 2048
     18}}}
     19
     20Then create the certificate from it:
     21{{{#!sh
     22openssl req -x509 -new -nodes -key my.key -sha256 -days 1024 -out my.pem
     23}}}
     24
     25Now create a PKCS12 store from the PKI pair (private key + public cert):
     26{{{#!sh
     27openssl pkcs12 -export -name my-side -in my.pem -inkey my.key -out my.p12
     28}}}
     29Replace ''my-side'' with the side that the certificate belongs to ('server' if it will reside on the server and be trusted by the client and vice versa for the client)
     30
     31Import the PKCS12 store into a local JKS:
     32{{{#!sh
     33keytool -importkeystore -destkeystore my.jks -srckeystore my.p12 -srcstoretype pkcs12 -alias my-side
     34}}}
     35
     36== Trust The Other Side's Certificate
     37Once you have completed generating certificates for both sides you must now create the trust relationship between them:
     38
     39Trust the ''other'' side's certificate:
     40{{{#!sh
     41keytool -import -alias other-side -file other.pem -keystore my.trust.jks
     42}}}