Skip to content

Commit f6a858e

Browse files
authored
feat(heartbeat): remove deprecated certificate fields (#45572)
The tls.certificate_not_valid_before and tls.certificate_not_valid_after fields have been deprecated since 7.8.0
1 parent eadc27e commit f6a858e

File tree

2 files changed

+0
-10
lines changed

2 files changed

+0
-10
lines changed

heartbeat/monitors/active/dialchain/tlsmeta/tlsmeta.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,7 @@ func CertFields(hostCert *x509.Certificate, verifiedChains [][]*x509.Certificate
7575
_, _ = x509Fields.Put("signature_algorithm", hostCert.SignatureAlgorithm.String())
7676
_, _ = x509Fields.Put("public_key_algorithm", hostCert.PublicKeyAlgorithm.String())
7777
_, _ = x509Fields.Put("not_before", hostCert.NotBefore)
78-
_, _ = tlsFields.Put("certificate_not_valid_before", hostCert.NotBefore)
7978
_, _ = x509Fields.Put("not_after", hostCert.NotAfter)
80-
_, _ = tlsFields.Put("certificate_not_valid_after", hostCert.NotAfter)
8179
if rsaKey, ok := hostCert.PublicKey.(*rsa.PublicKey); ok {
8280
sizeInBits := rsaKey.Size() * 8
8381
_, _ = x509Fields.Put("public_key_size", sizeInBits)
@@ -115,12 +113,8 @@ func CertFields(hostCert *x509.Certificate, verifiedChains [][]*x509.Certificate
115113
latestChainExpiration = *chainNotAfter
116114
}
117115

118-
// Legacy non-ECS field
119-
_, _ = tlsFields.Put("certificate_not_valid_before", chainNotBefore)
120116
_, _ = x509Fields.Put("not_before", chainNotBefore)
121117
if chainNotAfter != nil {
122-
// Legacy non-ECS field
123-
_, _ = tlsFields.Put("certificate_not_valid_after", *chainNotAfter)
124118
_, _ = x509Fields.Put("not_after", *chainNotAfter)
125119
}
126120
}

heartbeat/monitors/active/dialchain/tlsmeta/tlsmeta_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,6 @@ func TestCertFields(t *testing.T) {
114114
require.NoError(t, err)
115115

116116
elasticCertFields := lookslike.Strict(lookslike.MustCompile(map[string]interface{}{
117-
"certificate_not_valid_after": certNotAfter,
118-
"certificate_not_valid_before": certNotBefore,
119117
"server": mapstr.M{
120118
"hash": mapstr.M{
121119
"sha1": "b7b4b89ef0d0caf39d223736f0fdbb03c7b426f1",
@@ -145,8 +143,6 @@ func TestCertFields(t *testing.T) {
145143

146144
letsEncryptCertFields := func(notBefore time.Time, notAfter time.Time) validator.Validator {
147145
return lookslike.Strict(lookslike.MustCompile(map[string]interface{}{
148-
"certificate_not_valid_before": notBefore,
149-
"certificate_not_valid_after": notAfter,
150146
"server": mapstr.M{
151147
"hash": mapstr.M{
152148
"sha1": "98d7ca35e3608b0ee7accc9ec665babdbdc6e39c",

0 commit comments

Comments
 (0)