@@ -98,6 +98,15 @@ func ProbeTCP(ctx context.Context, target string, module config.Module, registry
98
98
},
99
99
[]string {"fingerprint_sha256" , "subject" , "issuer" , "subjectalternative" },
100
100
)
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
+
101
110
probeTLSVersion := prometheus .NewGaugeVec (
102
111
probeTLSInfoGaugeOpts ,
103
112
[]string {"version" },
@@ -126,11 +135,13 @@ func ProbeTCP(ctx context.Context, target string, module config.Module, registry
126
135
}
127
136
if module .TCP .TLS {
128
137
state := conn .(* tls.Conn ).ConnectionState ()
129
- registry .MustRegister (probeSSLEarliestCertExpiry , probeTLSVersion , probeSSLLastChainExpiryTimestampSeconds , probeSSLLastInformation )
138
+ registry .MustRegister (probeSSLEarliestCertExpiry , probeTLSVersion , probeSSLLastChainExpiryTimestampSeconds , probeSSLLastInformation , probeSSLLastKeyBits )
130
139
probeSSLEarliestCertExpiry .Set (float64 (getEarliestCertExpiry (& state ).Unix ()))
131
140
probeTLSVersion .WithLabelValues (getTLSVersion (& state )).Set (1 )
132
141
probeSSLLastChainExpiryTimestampSeconds .Set (float64 (getLastChainExpiry (& state ).Unix ()))
133
142
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 ))
134
145
}
135
146
scanner := bufio .NewScanner (conn )
136
147
for i , qr := range module .TCP .QueryResponse {
@@ -192,11 +203,13 @@ func ProbeTCP(ctx context.Context, target string, module config.Module, registry
192
203
193
204
// Get certificate expiry.
194
205
state := tlsConn .ConnectionState ()
195
- registry .MustRegister (probeSSLEarliestCertExpiry , probeTLSVersion , probeSSLLastChainExpiryTimestampSeconds , probeSSLLastInformation )
206
+ registry .MustRegister (probeSSLEarliestCertExpiry , probeTLSVersion , probeSSLLastChainExpiryTimestampSeconds , probeSSLLastInformation , probeSSLLastKeyBits )
196
207
probeSSLEarliestCertExpiry .Set (float64 (getEarliestCertExpiry (& state ).Unix ()))
197
208
probeTLSVersion .WithLabelValues (getTLSVersion (& state )).Set (1 )
198
209
probeSSLLastChainExpiryTimestampSeconds .Set (float64 (getLastChainExpiry (& state ).Unix ()))
199
210
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 ))
200
213
}
201
214
}
202
215
return true
0 commit comments