Skip to content

Commit

Permalink
Fix Serial Number example
Browse files Browse the repository at this point in the history
Signed-off-by: Rhys Evans <[email protected]>
  • Loading branch information
rhysxevans committed Dec 9, 2024
1 parent b4999a4 commit e83ca65
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions prober/tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ func getLastChainExpiry(state *tls.ConnectionState) time.Time {

func getSerialNumber(state *tls.ConnectionState) string {
cert := state.PeerCertificates[0]
// Actual serial number = 0B:FF:BC5:11:F1:90:7D:02:AF:71:9A:FC:D6:4F:B2:53
// serialNumber := cert.SerialNumber.Text(16) // drops leading zeros outputs = BFFBC511F1907D02AF719AFCD64FB253 in lower case, telgraf follows this https://github.com/influxdata/telegraf/blob/a9c91f162ddbe453364f68a89799535c43328a3c/plugins/inputs/x509_cert/x509_cert.go#L218
// Actual serial number = 0B:FF:BC:11:F1:90:7D:02:AF:71:9A:FC:D6:4F:B2:53
// serialNumber := cert.SerialNumber.Text(16) // drops leading zeros outputs = BFFBC11F1907D02AF719AFCD64FB253 in lower case, telgraf follows this https://github.com/influxdata/telegraf/blob/a9c91f162ddbe453364f68a89799535c43328a3c/plugins/inputs/x509_cert/x509_cert.go#L218
// https://github.com/atc0005/check-cert retains the leading zero with some aditional formatting

serialNumber := strings.ToLower(fmt.Sprintf("%X", cert.SerialNumber.Bytes()))
Expand Down

0 comments on commit e83ca65

Please sign in to comment.