Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Heartbeat] Handle TLS certs missing notBefore/notAfter #9566

Merged
merged 2 commits into from
Dec 21, 2018

Conversation

andrewvc
Copy link
Contributor

@andrewvc andrewvc commented Dec 14, 2018

Some certs in the wild don't set these standard fields and can cause an NPE. I left a long comment in the code, this is sort of a bizarre situation.

Fixes #9556

Copy link
Member

@ruflin ruflin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but we should add a CHANGELOG entry.


return conn, nil
}), nil
}
}

func addCertMetdata(event common.MapStr, chains [][]*x509.Certificate) {
// The behavior here might seem strange. We *always* set a notBefore, but only optionally set a notAfter.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for all the details here in case someone wants to change this in the future.

@andrewvc andrewvc force-pushed the handle-missing-cert-not-before branch from 73421eb to 5e2d922 Compare December 17, 2018 16:35
@andrewvc andrewvc requested a review from a team as a code owner December 17, 2018 16:35
@andrewvc
Copy link
Contributor Author

@ruflin thanks for the review. Changelog pushed. Am I good to merge?

@@ -68,6 +68,8 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha1...master[Check the HEAD d

*Heartbeat*

- Fixed rare issue where TLS connections to endpoints with x509 certificates missing either notBefore or notAfter would cause the check to fail with a stacktrace.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Fixed rare issue where TLS connections to endpoints with x509 certificates missing either notBefore or notAfter would cause the check to fail with a stacktrace.
- Fixed rare issue where TLS connections to endpoints with x509 certificates missing either notBefore or notAfter would cause the check to fail with a stacktrace. {issue}9556[9556] {pull}9566[9566]

Copy link
Member

@ruflin ruflin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added one small minor suggestion to the changelog. Good to be merged afterwards.

Could you give me write permissions to your repo so I could push such small changes directly?

@andrewvc andrewvc force-pushed the handle-missing-cert-not-before branch 2 times, most recently from 8e5ce5c to cb6bf93 Compare December 18, 2018 17:52
@andrewvc
Copy link
Contributor Author

@ruflin I just pushed the change myself. Your edit adds extra whitespace which it should not.

@andrewvc
Copy link
Contributor Author

jenkins, retest this please

Some certs in the wild don't set these standard fields and can cause an NPE

Fixes elastic#9556
@andrewvc andrewvc force-pushed the handle-missing-cert-not-before branch from cb6bf93 to a14916b Compare December 20, 2018 18:29
@andrewvc andrewvc merged commit 337113e into elastic:master Dec 21, 2018
@andrewvc andrewvc added needs_backport PR is waiting to be backported to other branches. v7.0.0-alpha1 labels Dec 21, 2018
@andrewvc andrewvc added v6.7.0 and removed needs_backport PR is waiting to be backported to other branches. labels Dec 21, 2018
andrewvc added a commit to andrewvc/beats that referenced this pull request Dec 21, 2018
* [Heartbeat] Handle TLS certs missing notBefore/notAfter

Some certs in the wild don't set these standard fields and can cause an NPE

Fixes elastic#9556

* Add changelog entry
andrewvc added a commit that referenced this pull request Dec 30, 2018
…ore/notAfter (#9759)

* Add heartbeat test for TLS client cert auth (#8984) (#9676)

* Add heartbeat test for TLS client cert auth

We were missing a test for this specific case. I wrote this hoping to confirm #8979, but actually wound up disproving it.

That said, this is still a good test to have, so we should merge it.

* [Heartbeat] Handle TLS certs missing notBefore/notAfter (#9566)

Some certs in the wild don't set these standard fields and can cause an NPE

Fixes #9556
andrewvc added a commit to andrewvc/beats that referenced this pull request Dec 31, 2018
* [Heartbeat] Handle TLS certs missing notBefore/notAfter

Some certs in the wild don't set these standard fields and can cause an NPE

Fixes elastic#9556

* Add changelog entry

(cherry picked from commit 337113e)
andrewvc added a commit that referenced this pull request Jan 2, 2019
* [Heartbeat] Handle TLS certs missing notBefore/notAfter

Some certs in the wild don't set these standard fields and can cause an NPE

Fixes #9556

* Add changelog entry

(cherry picked from commit 337113e)
leweafan pushed a commit to leweafan/beats that referenced this pull request Apr 28, 2023
… notBefore/notAfter (elastic#9759)

* Add heartbeat test for TLS client cert auth (elastic#8984) (elastic#9676)

* Add heartbeat test for TLS client cert auth

We were missing a test for this specific case. I wrote this hoping to confirm elastic#8979, but actually wound up disproving it.

That said, this is still a good test to have, so we should merge it.

* [Heartbeat] Handle TLS certs missing notBefore/notAfter (elastic#9566)

Some certs in the wild don't set these standard fields and can cause an NPE

Fixes elastic#9556
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants