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

Influxdb Output - Support SSL #191

Closed
dblooman opened this issue Sep 13, 2015 · 20 comments
Closed

Influxdb Output - Support SSL #191

dblooman opened this issue Sep 13, 2015 · 20 comments
Labels
help wanted Request for community participation, code, contribution

Comments

@dblooman
Copy link

Would like to use self signed certs with telegraf, seems to be missing from the output options and config.

@sparrc sparrc added the bug unexpected problem or unintended behavior label Sep 14, 2015
@sparrc
Copy link
Contributor

sparrc commented Sep 14, 2015

thanks for bringing it to my attention :-)

@dblooman
Copy link
Author

I was going to submit a PR, but it doesn't seem like certificates are actually supported in the Go Influx client, so perhaps one for that project too. Ideal situation is a similar setup to the Ruby SDK for influx

@sparrc
Copy link
Contributor

sparrc commented Sep 14, 2015

I'm not very familiar with the Ruby Influx SDK, could you include a link to the relevant code?

@dblooman
Copy link
Author

SSL verify, SSL enabled and cert path are what we should add. https://github.com/influxdb/influxdb-ruby/blob/master/lib/influxdb/client/http.rb

If the cert store can't be used as in ruby, a ca.pem, cert and key setup would work too.

    cert, err := tls.LoadX509KeyPair(*certFile, *keyFile)
    if err != nil {
        log.Fatal(err)
    }

    // Load CA cert
    caCert, err := ioutil.ReadFile(*caFile)
    if err != nil {
        log.Fatal(err)
    }
    caCertPool := x509.NewCertPool()
    caCertPool.AppendCertsFromPEM(caCert)

    // Setup HTTPS client
    tlsConfig := &tls.Config{
        Certificates:       []tls.Certificate{cert},
        RootCAs:            caCertPool,
        InsecureSkipVerify: true,
    }
    tlsConfig.BuildNameToCertificate()
    transport := &http.Transport{TLSClientConfig: tlsConfig}
    client := &http.Client{Transport: transport}

@sparrc sparrc added enhancement and removed bug unexpected problem or unintended behavior labels Sep 17, 2015
@Millnert
Copy link

Missing this. Don't know Ruby. How can we get it in?

@smebberson
Copy link

Yeah, it would be great to get some SSL support here. Can't really configure InfluxDB over HTTPS without Telegraf supporting https connections too.

@deanefrati
Copy link

+1

@sparrc sparrc added the help wanted Request for community participation, code, contribution label Dec 15, 2015
@deanefrati
Copy link

@sparrc any update on this? We would really like to use telegraf but our use case requires data transfer over public wire which requires authenticating with influx and TLS.

@sparrc
Copy link
Contributor

sparrc commented Jan 28, 2016

I'll try to get to this next week. It will require a change to the influxdb client as well

@deanefrati
Copy link

thanks @sparrc please let me know if there is anything i can do to help

@Ormod
Copy link
Contributor

Ormod commented Feb 12, 2016

Any progress on this one?

@sparrc
Copy link
Contributor

sparrc commented Feb 12, 2016

InfluxDB client has tls support now as of Wednesday, I should be able to add this into master today for testing

@sparrc
Copy link
Contributor

sparrc commented Feb 13, 2016

this is now in master, if anyone has cycles to test it out on a working influxdb with ssl setup I'd be much obliged!

geodimm pushed a commit to miketonks/telegraf that referenced this issue Mar 10, 2016
@cherwin
Copy link

cherwin commented Mar 17, 2016

Anyone has tested this out yet with any success? I'm getting x509: certificate signed by unknown authority. Relevant piece of configuration file looks like this;

ssl_ca = "/etc/ssl/influxca.pem"
urls = ["https://<redacted>:8086"]

@yankcrime
Copy link

I've just switched about 20 or so nodes in our estate to using the native SSL support (away from a whacky stunnel4 setup) and it's working fine. We make use of Puppet's SSL configuration for our PKI, so this ends up looking like:

[[outputs.influxdb]]
  urls = ["https://influxdb.some.where:8086"]
  ssl_ca = "/var/lib/puppet/ssl/certs/ca.pem"
  ssl_cert = "/var/lib/puppet/ssl/certs/some.server.co.uk.pem"
  ssl_key = "/var/lib/puppet/ssl/private_keys/some.server.co.uk.pem"

@sparrc
Copy link
Contributor

sparrc commented Mar 17, 2016

@cherwin you need ssl_cert and ssl_key as well for a valid self-signed setup

@cherwin
Copy link

cherwin commented Mar 18, 2016

@yankcrime @sparrc awesome, exactly what I needed. Why isn't it enough to only trust the CA on telegraf's side?

@sparrc
Copy link
Contributor

sparrc commented Mar 18, 2016

@cherwin that might be a bug here: https://github.com/influxdata/telegraf/blob/master/internal/internal.go#L90, we don't create a certificate at all unless all three are defined

@sparrc
Copy link
Contributor

sparrc commented Mar 18, 2016

@cherwin could you open an issue?

@cherwin
Copy link

cherwin commented Mar 18, 2016

@sparrc will do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Request for community participation, code, contribution
Projects
None yet
Development

No branches or pull requests

8 participants