/spring-boot-ssl-truststore-gen

add trusted Certificate Authoritiy to java truststore on spring boot application startup

Primary LanguageJavaApache License 2.0Apache-2.0

spring-boot-ssl-truststore-gen Build Status

Feature

Provides spring boot application with a java SSL truststore made up of :

  • default truststore CA certificates
  • additional CA certificate extracted from a custom TRUSTED_CA_CERTIFICATE_VALUE System property

The java SSL truststore will be accessible through javax.net.ssl.trustStore and javax.net.ssl.trustStorePassword system properties.

Details

spring-boot-ssl-truststore-gen will register a spring boot event listener that reacts whenever an ApplicationStartedEvent is sent (at the start of a run, but before any processing except the registration of listeners and initializers).

Building

To build the source you will need to install JDK 1.8.

spring-boot-ssl-truststore-gen uses Maven

$ ./mvn install

Usage

To enable automatic truststore generation, all you need is to add spring-boot-ssl-truststore-gen dependency to you spring boot application.

Example for maven

        <dependency>
                <groupId>com.orange.clara.cloud.boot.ssl-truststore-gen</groupId>
                <artifactId>spring-boot-ssl-truststore-gen</artifactId>
                <version>2.0.21</version>
        </dependency>

and set a TRUSTED_CA_CERTIFICATE System property with a String chain containing trusted CA Certificate to add to default java truststore

$ export TRUSTED_CA_CERTIFICATE=<TRUSTED_CA_CERTIFICATE_VALUE>

Here is a sample of <TRUSTED_CA_CERTIFICATE_VALUE> content :

-----BEGIN CERTIFICATE-----
MIIDhzCCAm+gAwIBAgIEYmqHlTANBgkqhkiG9w0BAQsFADB0MRAwDgYDVQQGEwdV
bmtub3duMRAwDgYDVQQIEwdVbmtub3duMRAwDgYDVQQHEwdVbmtub3duMRYwFAYD
VQQKEw13b3JsZCBjb21wYW55MRAwDgYDVQQLEwdVbmtub3duMRIwEAYDVQQDEwlq
b2huIHBhdWwwHhcNMTUxMDI5MTQzNjEwWhcNMTYwMTI3MTQzNjEwWjB0MRAwDgYD
VQQGEwdVbmtub3duMRAwDgYDVQQIEwdVbmtub3duMRAwDgYDVQQHEwdVbmtub3du
MRYwFAYDVQQKEw13b3JsZCBjb21wYW55MRAwDgYDVQQLEwdVbmtub3duMRIwEAYD
VQQDEwlqb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