Skip to content

In Spring Boot 3.5.x and later, embedded Tomcat SSL ignores customized settings from application.yml #47326

@gengdashuai

Description

@gengdashuai

The reason for this bug is that the function setCertificateKeystoreFile(String certificateKeystoreFile), which is defined in SSLHostConfigCertificate.java is never called. So the property certificateKeystoreFile will always be the default value of DEFAULT_KEYSTORE_FILE, and thus the customized ssl file is never loaded.

here is the definition of applySslBundle in spring boot 3.5.5 ,

private void applySslBundle(AbstractHttp11Protocol<?> protocol, SSLHostConfig sslHostConfig, SslBundle sslBundle) {
		SslBundleKey key = sslBundle.getKey();
		SslStoreBundle stores = sslBundle.getStores();
		SslOptions options = sslBundle.getOptions();
		sslHostConfig.setSslProtocol(sslBundle.getProtocol());
		SSLHostConfigCertificate certificate = new SSLHostConfigCertificate(sslHostConfig, Type.UNDEFINED);
		String keystorePassword = (stores.getKeyStorePassword() != null) ? stores.getKeyStorePassword() : "";
		certificate.setCertificateKeystorePassword(keystorePassword);
		if (key.getPassword() != null) {
			certificate.setCertificateKeyPassword(key.getPassword());
		}
		if (key.getAlias() != null) {
			certificate.setCertificateKeyAlias(key.getAlias());
		}
		sslHostConfig.addCertificate(certificate);
		if (options.getCiphers() != null) {
			String ciphers = StringUtils.arrayToCommaDelimitedString(options.getCiphers());
			sslHostConfig.setCiphers(ciphers);
		}
		configureSslStores(sslHostConfig, certificate, stores);
		configureEnabledProtocols(sslHostConfig, options);
	}

Probably the value of certificateKeystoreFile should be set somewhere in this function, please fix this bug in future releases. thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: feedback-reminderWe've sent a reminder that we need additional information before we can continuestatus: waiting-for-feedbackWe need additional information before we can continuestatus: waiting-for-triageAn issue we've not yet triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions