Beats: [Metricbeat] module HTTP server: Add TLS

Created on 26 Mar 2019  路  7Comments  路  Source: elastic/beats

Describe the enhancement:

The Metricbeat module for HTTP server currently doesn't support TLS. This is less of an issue for connections on the same host, but to be able to collect data over the network this would be a good improvement.

Describe a specific use case for the enhancement or feature:

Logstash has an HTTP input that supports TLS. To be a lightweight alternative the Metricbeat module would need to add TLS, otherwise it's mainly useful on localhost. This started off from a discussion with @loekvangool.

Metricbeat Integrations enhancement good first issue module

Most helpful comment

@andrewkroh any bugs that i can help today? nice work btw https://github.com/andrewkroh/gvm

All 7 comments

go net/http already have https. it is just a matter of adjusting it.

Let me grab a coffee and play with this one :)

@leopucci Take a look at tlscommon.ServerConfig and how it's used. I think some of this can be reused.

https://github.com/elastic/beats/blob/dba0f7c6d7ed584f1ddb448832e9f2f63f7cb66f/filebeat/inputsource/tcp/config.go#L38

@andrewkroh HttpHelper already have it! Thanks for the tip!

@andrewkroh, ListenAndServeTLS dos not acept certificate object, only certificate path... i will not be able to reuse config:ssl.... it was so beautiful
giphy (3)

Tadah!

capture-26

How to use:
add ssl config on http.yml

- module: http
  metricsets:
    - server
  host: "localhost"
  port: "8080"
  enabled: true
  #ssl.certificate_authorities: ["/etc/pki/root/ca.pem"]
  ssl.certificate: "/etc/pki/client/cert.pem"
  ssl.key: "/etc/pki/client/cert.key"
  paths:
    - path: "/foo"
      namespace: "foo"
  #    fields: # added to the the response in root. overwrites existing fields
  #      key: "value"

@andrewkroh any bugs that i can help today? nice work btw https://github.com/andrewkroh/gvm

Was this page helpful?
0 / 5 - 0 ratings