Help: "Returns last SSL chain expiry in timestamp seconds",
})
+ probeSSLLastInformation = prometheus.NewGaugeVec(
+ prometheus.GaugeOpts{
+ Name: "probe_ssl_last_chain_info",
+ Help: "Contains SSL leaf certificate information",
+ },
+ []string{"fingerprint_sha256"},
+ )
+
probeTLSVersion = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "probe_tls_version_info",
if resp.TLS != nil {
isSSLGauge.Set(float64(1))
- registry.MustRegister(probeSSLEarliestCertExpiryGauge, probeTLSVersion, probeSSLLastChainExpiryTimestampSeconds)
+ registry.MustRegister(probeSSLEarliestCertExpiryGauge, probeTLSVersion, probeSSLLastChainExpiryTimestampSeconds, probeSSLLastInformation)
probeSSLEarliestCertExpiryGauge.Set(float64(getEarliestCertExpiry(resp.TLS).Unix()))
probeTLSVersion.WithLabelValues(getTLSVersion(resp.TLS)).Set(1)
probeSSLLastChainExpiryTimestampSeconds.Set(float64(getLastChainExpiry(resp.TLS).Unix()))
+ probeSSLLastInformation.WithLabelValues(getFingerprint(resp.TLS)).Set(1)
if httpConfig.FailIfSSL {
level.Error(logger).Log("msg", "Final request was over SSL")
success = false
Name: "probe_ssl_last_chain_expiry_timestamp_seconds",
Help: "Returns last SSL chain expiry in unixtime",
})
+ probeSSLLastInformation := prometheus.NewGaugeVec(
+ prometheus.GaugeOpts{
+ Name: "probe_ssl_last_chain_info",
+ Help: "Contains SSL leaf certificate information",
+ },
+ []string{"fingerprint_sha256"},
+ )
probeTLSVersion := prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "probe_tls_version_info",
}
if module.TCP.TLS {
state := conn.(*tls.Conn).ConnectionState()
- registry.MustRegister(probeSSLEarliestCertExpiry, probeTLSVersion, probeSSLLastChainExpiryTimestampSeconds)
+ registry.MustRegister(probeSSLEarliestCertExpiry, probeTLSVersion, probeSSLLastChainExpiryTimestampSeconds, probeSSLLastInformation)
probeSSLEarliestCertExpiry.Set(float64(getEarliestCertExpiry(&state).Unix()))
probeTLSVersion.WithLabelValues(getTLSVersion(&state)).Set(1)
probeSSLLastChainExpiryTimestampSeconds.Set(float64(getLastChainExpiry(&state).Unix()))
+ probeSSLLastInformation.WithLabelValues(getFingerprint(&state)).Set(1)
}
scanner := bufio.NewScanner(conn)
for i, qr := range module.TCP.QueryResponse {
probeSSLEarliestCertExpiry.Set(float64(getEarliestCertExpiry(&state).Unix()))
probeTLSVersion.WithLabelValues(getTLSVersion(&state)).Set(1)
probeSSLLastChainExpiryTimestampSeconds.Set(float64(getLastChainExpiry(&state).Unix()))
+ probeSSLLastInformation.WithLabelValues(getFingerprint(&state)).Set(1)
}
}
return true
// Check values
expectedResults := map[string]float64{
"probe_ssl_earliest_cert_expiry": float64(certExpiry.Unix()),
+ "probe_ssl_last_chain_info": 1,
"probe_tls_version_info": 1,
}
checkRegistryResults(expectedResults, mfs, t)
expectedResults := map[string]float64{
"probe_ssl_earliest_cert_expiry": float64(serverCertExpiry.Unix()),
"probe_ssl_last_chain_expiry_timestamp_seconds": float64(serverCertExpiry.Unix()),
+ "probe_ssl_last_chain_info": 1,
"probe_tls_version_info": 1,
}
checkRegistryResults(expectedResults, mfs, t)
package prober
import (
+ "crypto/sha256"
"crypto/tls"
+ "encoding/hex"
"time"
)
return earliest
}
+func getFingerprint(state *tls.ConnectionState) string {
+ cert := state.PeerCertificates[0]
+ fingerprint := sha256.Sum256(cert.Raw)
+ return hex.EncodeToString(fingerprint[:])
+}
+
func getLastChainExpiry(state *tls.ConnectionState) time.Time {
lastChainExpiry := time.Time{}
for _, chain := range state.VerifiedChains {