Support configuration of web SSL using PEM-encoded certificates

This commit adds the ability to configure SSL in embedded web containers
using PEM-encoded certificate and private key files, as an alternative
to configuring SSL with Java KeyStore files.

Closes gh-29273
This commit is contained in:
Scott Frederick
2022-04-13 16:12:38 -05:00
parent f032690d0a
commit d387b3fa81
23 changed files with 910 additions and 20 deletions

View File

@@ -183,7 +183,7 @@ You can configure this behavior by setting the configprop:server.compression.mim
[[howto.webserver.configure-ssl]]
=== Configure SSL
SSL can be configured declaratively by setting the various `+server.ssl.*+` properties, typically in `application.properties` or `application.yml`.
The following example shows setting SSL properties in `application.properties`:
The following example shows setting SSL properties using a Java KeyStore file:
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
@@ -195,6 +195,19 @@ The following example shows setting SSL properties in `application.properties`:
key-password: "another-secret"
----
The following example shows setting SSL properties using PEM-encoded certificate and private key files:
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
server:
port: 8443
ssl:
certificate: "classpath:my-cert.crt"
certificate-private-key: "classpath:my-cert.key"
trust-certificate: "classpath:ca-cert.crt"
key-store-password: "secret"
----
See {spring-boot-module-code}/web/server/Ssl.java[`Ssl`] for details of all of the supported properties.
Using configuration such as the preceding example means the application no longer supports a plain HTTP connector at port 8080.