Skip to content

Allow to configure TrustManagerFactory/KeyManagerFactory via SslBundles for embedded Tomcat #51146

Open

Description

@Amarteau

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.

Activity

  1. added
    status: waiting-for-triage
    on Jul 29, 2026
  2. adityaanikam commented on Aug 3, 2026

    @adityaanikam

    Dug into this a bit — SslConnectorCustomizer.addSslHostConfig() is the dead end you found:

    private void addSslHostConfig(AbstractHttp11Protocol<?> protocol, String serverName, SslBundle sslBundle) {
        SSLHostConfig sslHostConfig = new SSLHostConfig();
        ...
        applySslBundle(protocol, sslHostConfig, sslBundle);
        protocol.addSslHostConfig(sslHostConfig, true);
    }

    It builds a brand new SSLHostConfig on every pass, so anything you set directly on Tomcat's own SSLHostConfig just gets thrown away next time this runs. And applySslBundle() only pulls sslBundle.getStores() and sslBundle.getKey() (password/alias) off SslOptions — there's no provider or algorithm field on SslOptions at all, so a custom TrustManagerFactory on SslManagerBundle really has nowhere to go right now.

    I'd like to take this on — adding provider/algorithm properties to SslOptions and wiring them into applySslBundle() where it builds the trust/key manager config, roughly what you sketched. Since SslOptions is shared, I'll also check Jetty, Undertow, and Reactor Netty to see if they have the same gap before scoping the fix to just Tomcat.

  3. added a commit that references this issue on Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: waiting-for-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions