-
Notifications
You must be signed in to change notification settings - Fork 41.6k
Add SslInfoContributor and SslHealthIndicator #41205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Hey @jonatan-ivanov, that's quite a cool feature, thank you! The implementation looks good, too. This works for all SSL bundles, and not only for the one used by the webserver, right? |
|
Great to hear! The main focus is the webserver but I think this should work for all SSL bundles (not tested yet) since using an expired cert can cause issues in every place they are used. I can go ahead and work on the TODO items/docs/tests, in the meantime, can I get some feedback on two important items?
|
I think this is fine. However, I'm not sure we need to use That class adapts the discrete We could just focus the |
👍🏼 That's the exact same use-case I'm using
That would simplify the changes in the PR a bit but also complicate the life of the users: simply enabling the feature might not do anything for them if they are not using bundles or it would work just half-way for them if they use bundles just not for the webserver. If it is not a big issue to use |
|
Along with In either case, I don't think it's necessary to make |
|
Treating the discrete web server SSL properties specially somewhat makes sense to me since that's what |
|
I removed support for |
1c6695d to
2cabf11
Compare
|
We need to discuss if we want to have this warning status and if we do, to which http code to map it. |
|
My two cents about having a dedicated
Other than the feature introduced in this PR (the certificate will expire soon), I think there could be a few more use-cases where a |
2cabf11 to
6ae64f5
Compare
72df5fe to
2a1bb3f
Compare
|
We discussed this today and a couple of things came up:
|
|
What do you mean by the custom status? Do mean what is in the PR right now ( You can see all of the certs on the info endpoint, do you also want the health endpoint to show all of them under a ~valid/not-valid key? |
|
Sorry, I quickly wrote that comment in the meeting and it was obviously too terse.
We're not keen on an indicator-specific status such as In the meantime, I think
We'd like it to show something as additional details (so they'll only appear when details are visible) but we're not yet 100% sure exactly what it should be. Moritz is going to take a look at this too. |
Great to hear! Btw since this is targeted to a milestone release would it make sense to use @mhalbritter fyi: I modified the health indicator a bit so that now it returns the whole chain instead of the separate certs since if a cert is invalid in a chain, the whole chain is invalid. I think this also helps troubleshooting if there is an invalid cert (I updated the examples in the description). |
...moke-test-tomcat-ssl/src/test/java/smoketest/tomcat/ssl/SampleTomcatSslApplicationTests.java
Outdated
Show resolved
Hide resolved
|
I'd remove the warning bit completely for M2. Then we can take our time and come up with a |
86cedc6 to
fbe0c5d
Compare
|
Makes sense, I changed it to |
|
Thanks @jonatan-ivanov ! The health endpoint now always adds details about invalid and valid chains. |
Production incidents because of invalid certificates are common issues in the industry.
SslInfoContributorandSslHealthIndicatorin this PR can help to mitigate them, they:issuer,subject,validity, etc.)Example
/infoand/healthoutputs:/infoof aVALIDcert (click here to expand){ "ssl": { "bundles": [ { "name": "ssldemo", "certificateChains": [ { "alias": "spring-boot", "certificates": [ { "version": "V3", "signatureAlgorithmName": "SHA256withRSA", "validityStarts": "2024-06-21T21:17:02Z", "validityEnds": "2024-07-05T21:17:02Z", "validity": { "status": "VALID" }, "serialNumber": "9fbcacfed83af328", "issuer": "CN=localhost,OU=Spring,O=VMware,L=Palo Alto,ST=California,C=US", "subject": "CN=localhost,OU=Spring,O=VMware,L=Palo Alto,ST=California,C=US" } ] } ] } ] } }/healthof aVALIDcert (click here to expand){ "status": "UP", "components": { "ping": { "status": "UP" }, "ssl": { "status": "UP" } } }/infoof anEXPIREDcert (click here to expand){ "ssl": { "bundles": [ { "name": "ssldemo", "certificateChains": [ { "alias": "spring-boot-ssl-sample", "certificates": [ { "version": "V3", "validity": { "status": "EXPIRED", "message": "Not valid after 2014-10-21T19:48:43Z" }, "validityStarts": "2014-07-23T19:48:43Z", "validityEnds": "2014-10-21T19:48:43Z", "signatureAlgorithmName": "SHA256withRSA", "serialNumber": "7207ee6e", "issuer": "CN=localhost,OU=Unknown,O=Unknown,L=Unknown,ST=Unknown,C=Unknown", "subject": "CN=localhost,OU=Unknown,O=Unknown,L=Unknown,ST=Unknown,C=Unknown" } ] } ] } ] } }/healthof anEXPIREDcert (click here to expand){ "status": "OUT_OF_SERVICE", "components": { "ping": { "status": "UP" }, "ssl": { "status": "OUT_OF_SERVICE", "details": { "certificateChains": [ { "alias": "spring-boot-ssl-sample", "certificates": [ { "version": "V3", "validityEnds": "2014-10-21T19:48:43Z", "validityStarts": "2014-07-23T19:48:43Z", "signatureAlgorithmName": "SHA256withRSA", "validity": { "status": "EXPIRED", "message": "Not valid after 2014-10-21T19:48:43Z" }, "serialNumber": "7207ee6e", "issuer": "CN=localhost,OU=Unknown,O=Unknown,L=Unknown,ST=Unknown,C=Unknown", "subject": "CN=localhost,OU=Unknown,O=Unknown,L=Unknown,ST=Unknown,C=Unknown" } ] } ] } } } }/infoof a cert thatWILL_EXPIRE_SOON(click here to expand){ "ssl": { "bundles": [ { "name": "ssldemo", "certificateChains": [ { "alias": "spring-boot", "certificates": [ { "version": "V3", "validityEnds": "2024-06-22T21:32:22Z", "validityStarts": "2024-06-21T21:32:22Z", "signatureAlgorithmName": "SHA256withRSA", "validity": { "status": "WILL_EXPIRE_SOON", "message": "Certificate will expire within threshold (PT168H) at 2024-06-22T21:32:22Z" }, "subject": "CN=localhost,OU=Spring,O=VMware,L=Palo Alto,ST=California,C=US", "serialNumber": "64d019d1dd94eee0", "issuer": "CN=localhost,OU=Spring,O=VMware,L=Palo Alto,ST=California,C=US" } ] } ] } ] } }/healthof a cert thatWILL_EXPIRE_SOON(click here to expand){ "status": "UP", "components": { "ping": { "status": "UP" }, "ssl": { "status": "WARNING", "details": { "certificateChains": [ { "alias": "spring-boot-ssl-sample", "certificates": [ { "version": "V3", "validityEnds": "2024-06-22T21:32:22Z", "validityStarts": "2024-06-21T21:32:22Z", "signatureAlgorithmName": "SHA256withRSA", "validity": { "status": "WILL_EXPIRE_SOON", "message": "Certificate will expire within threshold (PT168H) at 2024-06-22T21:32:22Z" }, "subject": "CN=localhost,OU=Spring,O=VMware,L=Palo Alto,ST=California,C=US", "serialNumber": "64d019d1dd94eee0", "issuer": "CN=localhost,OU=Spring,O=VMware,L=Palo Alto,ST=California,C=US" } ] } ] } } } }If you want to play with it, start
spring-boot-smoke-test-tomcat-ssl, the cert inresources/sample.jksis alreadyEXPIRED, you can generate aVALIDone viaor one that
WILL_EXPIRE_SOONvia: