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

Add TLS support for metric beat http server #11611

Merged
merged 3 commits into from
Apr 4, 2019

Conversation

leopucci
Copy link
Contributor

@leopucci leopucci commented Apr 2, 2019

Solves #11457

@leopucci leopucci requested review from a team as code owners April 2, 2019 18:29
@elasticmachine
Copy link
Collaborator

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

Copy link
Member

@andrewkroh andrewkroh left a comment

Choose a reason for hiding this comment

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

I left a minor comment. But everything else LGTM.

@@ -130,6 +148,11 @@ func (h *HttpServer) handleFunc(writer http.ResponseWriter, req *http.Request) {

case "GET":
writer.WriteHeader(http.StatusOK)
writer.Write([]byte("HTTP Server accepts data via POST"))
if h.server.TLSConfig != nil && h.server.TLSConfig.Certificates != nil {
Copy link
Member

Choose a reason for hiding this comment

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

The request itself can tell you if it was received over TLS: if req.TLS != nil. Sorry to bother you about this line again, but the thought came to be late.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No problem. It looks better this way. Let me test it...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@andrewkroh Done, tested ok

Update config.go
Update http.go
Update config.go
Adding ssl tests, adjusting review requests
Line update

Line Update
req.TLS check
@andrewkroh
Copy link
Member

jenkins, test this

@andrewkroh andrewkroh merged commit 0fb063f into elastic:master Apr 4, 2019
@leopucci leopucci deleted the patch-1 branch April 9, 2019 14:22
@@ -130,6 +148,11 @@ func (h *HttpServer) handleFunc(writer http.ResponseWriter, req *http.Request) {

case "GET":
writer.WriteHeader(http.StatusOK)
writer.Write([]byte("HTTP Server accepts data via POST"))
if req.TLS != nil {
writer.Write([]byte("HTTPS Server accepts data via POST"))
Copy link

Choose a reason for hiding this comment

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

tip: io.WriteString(writer, "...").

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

Successfully merging this pull request may close these issues.

5 participants