spring-projects / spring-projects/spring-boot

Allow to configure TrustManagerFactory/KeyManagerFactory via SslBundles for embedded Tomcat

Open
#51,146 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage
Dominant language
Java
Stars
81.5k
Forks
42.7k
Avg merge
2d 4h
Merged PRs (30d)
65

Description

In Spring Boot 3.1 SslBundles were added as concept to configure and update Server keys programmatically.

In my project I'm using the embedded Tomcat server, and I need to use a custom TrustManager. SslManagerBundle allows to configure KeyManagerFactory and TrustManagerFactory. Therefore, I've tried to use it to supply my custom TrustManagerFactory.

Unfortunately, the embedded Tomcat doesn't use SslManagerBundle. (Tomcat's SSLHostConfig creates the instance itself).

Then I've tried to configure "org.apache.tomcat.util.net.SSLHostConfig#truststoreType" via the SSLHostConfig assigned to the connector. But this was also a dead end because "org.springframework.boot.tomcat.SslConnectorCustomizer#addSslHostConfig" creates a new SSLHostConfig and erases all custom changes.

Is there a way to configure a custom TrustManagerFactory for the embedded Tomcat?

It would be nice if "org.springframework.boot.ssl.SslOptions" had properties for TrustManager/KeyManager provider & algorithm. These values could be applied in "SslConnectorCustomizer#applySslBundle" to the newly created SSLHostConfig.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading SslOptions and SslConnectorCustomizer#applySslBundle and #addSslHostConfig, then compare them with Tomcat's SSLHostConfig behavior. Trace how SslManagerBundle's KeyManagerFactory and TrustManagerFactory are represented and applied. Done means embedded Tomcat can use the configured custom factories without custom SSLHostConfig changes being overwritten.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.