@@ -98,6 +98,15 @@ func ProbeTCP(ctx context.Context, target string, module config.Module, registry
9898 },
9999 []string {"fingerprint_sha256" , "subject" , "issuer" , "subjectalternative" },
100100 )
101+
102+ probeSSLLastKeyBits := prometheus .NewGaugeVec (
103+ prometheus.GaugeOpts {
104+ Name : "probe_ssl_last_chain_key_bits" ,
105+ Help : "Contains SSL leaf certificate information" ,
106+ },
107+ []string {"type" , "fingerprint_sha256" },
108+ )
109+
101110 probeTLSVersion := prometheus .NewGaugeVec (
102111 probeTLSInfoGaugeOpts ,
103112 []string {"version" },
@@ -126,11 +135,13 @@ func ProbeTCP(ctx context.Context, target string, module config.Module, registry
126135 }
127136 if module .TCP .TLS {
128137 state := conn .(* tls.Conn ).ConnectionState ()
129- registry .MustRegister (probeSSLEarliestCertExpiry , probeTLSVersion , probeSSLLastChainExpiryTimestampSeconds , probeSSLLastInformation )
138+ registry .MustRegister (probeSSLEarliestCertExpiry , probeTLSVersion , probeSSLLastChainExpiryTimestampSeconds , probeSSLLastInformation , probeSSLLastKeyBits )
130139 probeSSLEarliestCertExpiry .Set (float64 (getEarliestCertExpiry (& state ).Unix ()))
131140 probeTLSVersion .WithLabelValues (getTLSVersion (& state )).Set (1 )
132141 probeSSLLastChainExpiryTimestampSeconds .Set (float64 (getLastChainExpiry (& state ).Unix ()))
133142 probeSSLLastInformation .WithLabelValues (getFingerprint (& state ), getSubject (& state ), getIssuer (& state ), getDNSNames (& state )).Set (1 )
143+ keyType , keySize := getTLSKeyTypeAndSize (& state )
144+ probeSSLLastKeyBits .WithLabelValues (keyType , getTLSKeyFingerprint (& state )).Set (float64 (keySize ))
134145 }
135146 scanner := bufio .NewScanner (conn )
136147 for i , qr := range module .TCP .QueryResponse {
@@ -192,11 +203,13 @@ func ProbeTCP(ctx context.Context, target string, module config.Module, registry
192203
193204 // Get certificate expiry.
194205 state := tlsConn .ConnectionState ()
195- registry .MustRegister (probeSSLEarliestCertExpiry , probeTLSVersion , probeSSLLastChainExpiryTimestampSeconds , probeSSLLastInformation )
206+ registry .MustRegister (probeSSLEarliestCertExpiry , probeTLSVersion , probeSSLLastChainExpiryTimestampSeconds , probeSSLLastInformation , probeSSLLastKeyBits )
196207 probeSSLEarliestCertExpiry .Set (float64 (getEarliestCertExpiry (& state ).Unix ()))
197208 probeTLSVersion .WithLabelValues (getTLSVersion (& state )).Set (1 )
198209 probeSSLLastChainExpiryTimestampSeconds .Set (float64 (getLastChainExpiry (& state ).Unix ()))
199210 probeSSLLastInformation .WithLabelValues (getFingerprint (& state ), getSubject (& state ), getIssuer (& state ), getDNSNames (& state )).Set (1 )
211+ keyType , keySize := getTLSKeyTypeAndSize (& state )
212+ probeSSLLastKeyBits .WithLabelValues (keyType , getTLSKeyFingerprint (& state )).Set (float64 (keySize ))
200213 }
201214 }
202215 return true
0 commit comments