An open API service indexing awesome lists of open source software.

https://github.com/orange-cloudfoundry/spring-boot-ssl-truststore-gen

add trusted Certificate Authoritiy to java truststore on spring boot application startup
https://github.com/orange-cloudfoundry/spring-boot-ssl-truststore-gen

Last synced: about 1 year ago
JSON representation

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

Awesome Lists containing this project

README

          

# spring-boot-ssl-truststore-gen [![Build Status](https://travis-ci.org/Orange-OpenSource/spring-boot-ssl-truststore-gen.svg?branch=master)](https://travis-ci.org/Orange-OpenSource/spring-boot-ssl-truststore-gen)

## Feature

Provides spring boot application with a [java SSL truststore](https://docs.oracle.com/javase/8/docs/technotes/guides/security/jsse/JSSERefGuide.html#CustomizingStores) made up of :
* default truststore CA certificates
* additional CA certificate extracted from a custom TRUSTED_CA_CERTIFICATE_VALUE System property

The [java SSL truststore](https://docs.oracle.com/javase/8/docs/technotes/guides/security/jsse/JSSERefGuide.html#CustomizingStores) 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](https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-spring-application.html#boot-features-application-events-and-listeners) that reacts whenever an [ApplicationStartedEvent](http://docs.spring.io/autorepo/docs/spring-boot/1.2.0.M2/api/org/springframework/boot/context/event/ApplicationStartedEvent.html) 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

```

com.orange.clara.cloud.boot.ssl-truststore-gen
spring-boot-ssl-truststore-gen
2.0.21

```

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=
```

Here is a sample of content :

```
-----BEGIN CERTIFICATE-----
MIIDhzCCAm+gAwIBAgIEYmqHlTANBgkqhkiG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