-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
inputs.x509_cert unexpected behavior with SNI #8914
Comments
I've encountered a similar problem: in my scenario, I specify 10 different domains (with different IP addresses) in the |
@moorglade you can "fix" this if you specify you 10 domains in 10 different inputs.
to
But this is a workaround and i don't think that's the expected behavior. |
@MorphBonehunter thanks, I will do that if this issue not fixed, but nevertheless it would be nice to know if it's a bug or not ;) |
Thanks, had the same problem. This workaround works. |
NIce workaround, but is this scheduled to be fixed soon? |
I think I found what's wrong with this. x509_cert input sets/uses SNI in this order (https://github.com/influxdata/telegraf/blob/master/plugins/inputs/x509_cert/x509_cert.go#L93 / https://github.com/influxdata/telegraf/blob/master/plugins/inputs/x509_cert/x509_cert.go#L124):
c.tlsCfg.ServerName is not reset between certificates so x509_cert (re)uses first u.Hostname() for all certs (unless configuration has explicit Something like this probably fixes the issue:
If this looks ok to maintainers I can create PR (CC: @ssoroka) |
@jjh74 please submit a PR and let's discuss there. Please reference this issue (and the potential duplicate) in the PR. Thank you for caring! |
@srebhan I'll create a PR, but I think in current master https/tcp uris are broken after #6952 This results in: [inputs.x509_cert] could not find file: &{https://example.org:443 false false } |
@jjh74 @srebhan I've just raised #9384 as I have found this issue in testing v1.19.0. |
Just did a code review and arrived at the same conclusion as @jjh74. Line 124 of the plugin breaks the functionality quite obviously |
Relevant telegraf.conf:
System info:
Telegraf 1.17.3 on ArchLinux
Steps to reproduce:
I ran two little Websites on one of my Servers. DNS resolves to the same IP and i use SNI to distinguish between the sites.
After upgrading telegraf to 1.17.3 (from 1.17.0) i realized that the behavior changed of the x509 plugin.
Before i got the right certificates from the server and got 2 different measurements from the plugin.
After the update it shows for both entries the same certificate (its the default one).
So i guess PR #7897 with 545d996 (introduced in 1.17.1) breaks the original behavior of the plugin.
Expected behavior:
Actual behavior:
The text was updated successfully, but these errors were encountered: