Skip to content

inputs.x509_cert unexpected behavior with SNI #8914

@MorphBonehunter

Description

@MorphBonehunter

Relevant telegraf.conf:

[global_tags]

[agent]
  interval = "60s"
  round_interval = false
  metric_batch_size = 500
  metric_buffer_limit = 5000
  collection_jitter = "0s"
  flush_interval = "60s"
  flush_jitter = "0s"
  precision = ""
  debug = false
  quiet = false
  logfile = ""
  hostname = ""
  omit_hostname = false

[[inputs.x509_cert]]
  sources = ["https://www.underverse.net:443", "https://www.gynpraxis-bahls.de:443"]
  [inputs.x509_cert.tagdrop]
    common_name  = ["Let's Encrypt Authority X3", "R3"]

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.

  1. Run the above config with telegraf 1.17.0 and inspect output (expected behavior).
  2. Run the above config with telegraf 1.17.3 and inspect output (actual behavior).

Expected behavior:

2021-02-26T14:07:10Z I! Starting Telegraf 1.17.0
2021-02-26T14:07:10Z D! [agent] Initializing plugins
2021-02-26T14:07:10Z D! [agent] Starting service inputs
> x509_cert,common_name=underverse.net,host=evelyn,issuer_common_name=R3,public_key_algorithm=RSA,san=*.underverse.net\,underverse.net,serial_number=4c11c31923c7824b9055dbd729f06c41ab2,signature_algorithm=SHA256-RSA,source=https://www.underverse.net:443,verification=valid age=5208391i,enddate=1616916039i,expiry=2567608i,startdate=1609140039i,verification_code=0i 1614348431000000000
2021-02-26T14:07:10Z D! [agent] Stopping service inputs
> x509_cert,common_name=gynpraxis-bahls.de,host=evelyn,issuer_common_name=R3,public_key_algorithm=RSA,san=gynpraxis-bahls.de\,www.gynpraxis-bahls.de,serial_number=32b96a849248c02179ae09479551704d315,signature_algorithm=SHA256-RSA,source=https://www.gynpraxis-bahls.de:443,verification=valid age=5208429i,enddate=1616916001i,expiry=2567570i,startdate=1609140001i,verification_code=0i 1614348431000000000
2021-02-26T14:07:10Z D! [agent] Input channel closed
2021-02-26T14:07:10Z D! [agent] Stopped Successfully

Actual behavior:

2021-02-26T14:07:31Z I! Starting Telegraf 1.17.3
2021-02-26T14:07:31Z D! [agent] Initializing plugins
2021-02-26T14:07:31Z D! [agent] Starting service inputs
> x509_cert,common_name=underverse.net,host=evelyn,issuer_common_name=R3,public_key_algorithm=RSA,san=*.underverse.net\,underverse.net,serial_number=4c11c31923c7824b9055dbd729f06c41ab2,signature_algorithm=SHA256-RSA,source=https://www.underverse.net:443,verification=valid age=5208412i,enddate=1616916039i,expiry=2567587i,startdate=1609140039i,verification_code=0i 1614348451000000000
> x509_cert,common_name=underverse.net,host=evelyn,issuer_common_name=R3,public_key_algorithm=RSA,san=*.underverse.net\,underverse.net,serial_number=4c11c31923c7824b9055dbd729f06c41ab2,signature_algorithm=SHA256-RSA,source=https://www.gynpraxis-bahls.de:443,verification=valid age=5208412i,enddate=1616916039i,expiry=2567587i,startdate=1609140039i,verification_code=0i 1614348451000000000
2021-02-26T14:07:31Z D! [agent] Stopping service inputs
2021-02-26T14:07:31Z D! [agent] Input channel closed
2021-02-26T14:07:31Z D! [agent] Stopped Successfully

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugunexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions