Configuring SSL with Self-Signed Certificate for Martini Server Runtime
Creating a self-signed SSL certificate can be useful for development, testing purposes, or internal networks. Follow these steps to generate and configure a self-signed certificate for your Martini Server Runtime.
Install OpenSSL
OpenSSL is required for the following steps. OpenSSL is installed by default on Linux and macOS, so users of these operating systems can proceed directly to the next step.
Windows users will need to install OpenSSL. The easiest way is to install Git, which bundles OpenSSL.
Download and install Git. After installation, open Git Bash and continue with the next steps.
1. Generate a Private Key
Start by generating a private key with the following command:
1 |
|
2. Create a Certificate Signing Request (CSR)
Next, create a CSR using the private key:
1 |
|
3. Create Configuration File
Create a configuration file named www.YourDomain.com.cnf
and insert the following content:
1 2 3 4 5 6 7 8 9 |
|
4. Generate Self-Signed Certificate
Use the CSR and the configuration file to generate the self-signed certificate:
1 |
|
When prompted for a Distinguished Name (DN), you can type your domain. In this example, we are using www.YourDomain.com
.
5. Convert to PKCS12 Format
Convert the self-signed certificate and private key to PKCS12 format for use with Tomcat:
1 |
|
Note: Remember the password you set, as it will be needed for the Martini configuration.
6. Importing Certificate to Linux
To ensure your system recognizes the new certificate, follow these steps:
- Navigate to the CA certificates directory:
1 |
|
- Create a new directory for your local certificates:
1 |
|
- Copy the
.crt
file into thewww.YourDomain.com
directory:
1 |
|
- Set the appropriate permissions:
1 2 |
|
- Update the CA certificates:
1 |
|
- Restart your web browser if it is currently running.
7. Martini Configuration
Edit the <martini-home>/conf/override.properties
file to configure the SSL certificate for your Martini Runtime:
1 2 3 4 5 6 7 8 9 10 |
|
8. Start or Restart Martini Runtime
Start the Martini Runtime if it is not already running. If it is running, restart it to apply the changes.
9. Verify SSL Installation
Visit https://www.YourDomain.com
in your web browser to verify that your self-signed certificate is installed correctly.