-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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 #11482
Conversation
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? |
This patch solves #11457 |
How to use:
|
@andrewkroh can you help me understand what this means so I could solve it?
|
@leopucci Run Any chance to get some tests added to this PR? It also needs a changelog entry. |
@ruflin the CI build is failing... i don't know how to |
The CI build is failing because some linting rules are not passing. You need to run |
Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this. Can you also add an entry to the CHANGELOG.next.asciidoc file under the "Added" section for Metricbeat.
Thanks @andrewkroh for reviewing. Will change right away |
@andrewkroh Thanks for the revisions :) |
Thanks for all the work @leopucci I think this will also need an update in the docs about the new options: https://github.com/elastic/beats/blob/master/metricbeat/module/http/server/_meta/docs.asciidoc To make CI happy, you must run |
@ruflin @andrewkroh Thanks for helping me to understand the whole process |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hola @odacremolbap ! |
@leopucci Thanks a lot for going down this rabbit hole! I think we are getting to a nice pattern here, let's improve it a bit more. Let me re-review. |
:) I have made some more changes trying to understand why Travis ci is failing.. Locally the tests happen OK! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking very good, thanks for the effort, it is being worth it :-)
Check for requested changes and bring your own opinion on them
@odacremolbap Thanks for your help! I've tested and committed the new code! |
The reason tests are not succeeding is https://github.com/elastic/beats/blob/master/metricbeat/tests/system/test_http.py#L58 I'll have time in some hours to take a deeper look, but you can probably go ahead and modify that string to match the prefix for the HTTP and HTTPS server start log line |
I will! |
Done :) |
@@ -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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if h.server.TLSConfig != nil && h.server.TLSConfig.Certificates != nil { | |
if h.server.TLSConfig != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can't be done. I've tested and for some reason, HTTP server creates a TLSConfig after calling ListenAndServe(), so the HTTP server will print the wrong message if we remove that, and HTTP tests will fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, OK. Then I'm glad you tested it!
\o/! |
@leopucci thanks again for this contribution, this is looking superb 🍕 |
... and rebase ... 😉 |
Update config.go Update http.go Update config.go Adding ssl tests, adjusting review requests
@leopucci Looks like it is only the Ping me if I can help |
@odacremolbap Strange... my file already includes coredns line. Don't know if it is the `` around it. The only mod on this file is the new SSL support |
weird |
@odacremolbap Only those with write access to this repository can merge pull requests. |
if err != nil && err != http.ErrServerClosed { | ||
logp.Critical("Unable to start HTTP server due to error: %v", err) | ||
if h.server.TLSConfig != nil { | ||
logp.Info("Starting HTTPS server on %s", h.server.Addr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it HTTP here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Kaiyan, it is HTTPS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hummmm... there is this logp.Critical that is not adjusted.. thanks i will change it now
@andrewkroh @odacremolbap today was git branches learning day... recreated all pull requests... |
you are super welcomed, @leopucci |
=) |
No description provided.