-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add new probe_ssl_latest_verified_chain_expiry metric #636
Merged
brian-brazil
merged 8 commits into
prometheus:master
from
itkq:probe_ssl_latest_verified_chain_expiry
Jun 10, 2020
Merged
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a70527c
Add new probe_ssl_latest_verified_chain_expiry metric
itkq 29c5df5
Rename metric to follow modern convention
itkq 00a3207
Omit expiry when no verified chains found
itkq f535138
Make sure to set metric
itkq 9c377cc
Add unit test for probe_ssl_last_chain_expiry_timestamp_seconds
itkq 304121a
Make behaivior of new metric consistent with existing ones
itkq 2059d86
Correct metric description
itkq d45159b
Compare two certificates chains where one is expired
itkq File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,23 @@ func getEarliestCertExpiry(state *tls.ConnectionState) time.Time { | |
return earliest | ||
} | ||
|
||
func getLatestVerifiedChainExpiry(state *tls.ConnectionState) time.Time { | ||
latestVerifiedChainExpiry := time.Time{} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does this output if there's no chains? You'll probably need insecure_skip_verify to test this. |
||
for _, chain := range state.VerifiedChains { | ||
earliestCertExpiry := time.Time{} | ||
for _, cert := range chain { | ||
if (earliestCertExpiry.IsZero() || cert.NotAfter.Before(earliestCertExpiry)) && !cert.NotAfter.IsZero() { | ||
earliestCertExpiry = cert.NotAfter | ||
} | ||
} | ||
if latestVerifiedChainExpiry.IsZero() || latestVerifiedChainExpiry.After(earliestCertExpiry) { | ||
latestVerifiedChainExpiry = earliestCertExpiry | ||
} | ||
|
||
} | ||
return latestVerifiedChainExpiry | ||
} | ||
|
||
func getTLSVersion(state *tls.ConnectionState) string { | ||
switch state.Version { | ||
case tls.VersionTLS10: | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a little of a mouthful, and naming conventions have matured since the previous one was named.
I'd go for something like probe_ssl_last_chain_expiry_timestamp_seconds.