2020-08-12 04:10:41 +08:00
|
|
|
# x509 Certificate Input Plugin
|
2018-07-31 03:12:45 +08:00
|
|
|
|
|
|
|
|
This plugin provides information about X509 certificate accessible via local
|
2022-06-16 00:46:26 +08:00
|
|
|
file, tcp, udp, https or smtp protocol.
|
2018-07-31 03:12:45 +08:00
|
|
|
|
2022-06-09 05:22:56 +08:00
|
|
|
When using a UDP address as a certificate source, the server must support
|
|
|
|
|
[DTLS](https://en.wikipedia.org/wiki/Datagram_Transport_Layer_Security).
|
2021-07-23 08:44:36 +08:00
|
|
|
|
2022-10-27 03:58:36 +08:00
|
|
|
## Global configuration options <!-- @/docs/includes/plugin_config.md -->
|
|
|
|
|
|
|
|
|
|
In addition to the plugin-specific configuration settings, plugins support
|
|
|
|
|
additional global and plugin configuration settings. These settings are used to
|
|
|
|
|
modify metrics, tags, and field or create aliases and configure ordering, etc.
|
|
|
|
|
See the [CONFIGURATION.md][CONFIGURATION.md] for more details.
|
|
|
|
|
|
2023-01-12 23:55:21 +08:00
|
|
|
[CONFIGURATION.md]: ../../../docs/CONFIGURATION.md#plugins
|
2022-10-27 03:58:36 +08:00
|
|
|
|
2021-11-25 02:50:22 +08:00
|
|
|
## Configuration
|
2018-07-31 03:12:45 +08:00
|
|
|
|
2022-05-24 21:49:47 +08:00
|
|
|
```toml @sample.conf
|
2018-07-31 03:12:45 +08:00
|
|
|
# Reads metrics from a SSL certificate
|
|
|
|
|
[[inputs.x509_cert]]
|
2021-03-24 05:31:15 +08:00
|
|
|
## List certificate sources, support wildcard expands for files
|
|
|
|
|
## Prefix your entry with 'file://' if you intend to use relative paths
|
2021-07-23 08:44:36 +08:00
|
|
|
sources = ["tcp://example.org:443", "https://influxdata.com:443",
|
2022-06-16 00:46:26 +08:00
|
|
|
"smtp://mail.localhost:25", "udp://127.0.0.1:4433",
|
|
|
|
|
"/etc/ssl/certs/ssl-cert-snakeoil.pem",
|
2025-03-10 15:11:57 +08:00
|
|
|
"/etc/mycerts/*.mydomain.org.pem", "file:///path/to/*.pem",
|
|
|
|
|
"jks:///etc/mycerts/keystore.jks",
|
|
|
|
|
"pkcs12:///etc/mycerts/keystore.p12"]
|
2018-07-31 03:12:45 +08:00
|
|
|
|
|
|
|
|
## Timeout for SSL connection
|
2018-07-31 03:14:55 +08:00
|
|
|
# timeout = "5s"
|
2018-07-31 03:12:45 +08:00
|
|
|
|
2020-12-24 03:39:43 +08:00
|
|
|
## Pass a different name into the TLS request (Server Name Indication).
|
|
|
|
|
## This is synonymous with tls_server_name, and only one of the two
|
|
|
|
|
## options may be specified at one time.
|
2020-01-22 09:11:50 +08:00
|
|
|
## example: server_name = "myhost.example.org"
|
|
|
|
|
# server_name = "myhost.example.org"
|
|
|
|
|
|
2022-11-16 21:37:13 +08:00
|
|
|
## Only output the leaf certificates and omit the root ones.
|
|
|
|
|
# exclude_root_certs = false
|
|
|
|
|
|
2025-02-04 23:57:13 +08:00
|
|
|
## Pad certificate serial number with zeroes to 128-bits.
|
|
|
|
|
# pad_serial_with_zeroes = false
|
|
|
|
|
|
2025-03-10 15:11:57 +08:00
|
|
|
## Password to be used with PKCS#12 or JKS files
|
|
|
|
|
# password = ""
|
|
|
|
|
|
2018-07-31 03:12:45 +08:00
|
|
|
## Optional TLS Config
|
|
|
|
|
# tls_ca = "/etc/telegraf/ca.pem"
|
|
|
|
|
# tls_cert = "/etc/telegraf/cert.pem"
|
|
|
|
|
# tls_key = "/etc/telegraf/key.pem"
|
2020-12-24 03:39:43 +08:00
|
|
|
# tls_server_name = "myhost.example.org"
|
2022-06-22 04:50:06 +08:00
|
|
|
|
|
|
|
|
## Set the proxy URL
|
|
|
|
|
# use_proxy = true
|
|
|
|
|
# proxy_url = "http://localhost:8888"
|
2018-07-31 03:12:45 +08:00
|
|
|
```
|
|
|
|
|
|
2021-11-25 02:50:22 +08:00
|
|
|
## Metrics
|
2018-07-31 03:12:45 +08:00
|
|
|
|
2018-10-19 14:34:59 +08:00
|
|
|
- x509_cert
|
2018-07-31 03:12:45 +08:00
|
|
|
- tags:
|
2023-02-22 20:39:15 +08:00
|
|
|
- type - "leaf", "intermediate" or "root" classification of certificate
|
2018-10-19 14:34:59 +08:00
|
|
|
- source - source of the certificate
|
|
|
|
|
- organization
|
|
|
|
|
- organizational_unit
|
|
|
|
|
- country
|
|
|
|
|
- province
|
|
|
|
|
- locality
|
2019-07-23 07:10:40 +08:00
|
|
|
- verification
|
2019-11-27 02:04:55 +08:00
|
|
|
- serial_number
|
|
|
|
|
- signature_algorithm
|
|
|
|
|
- public_key_algorithm
|
|
|
|
|
- issuer_common_name
|
|
|
|
|
- issuer_serial_number
|
|
|
|
|
- san
|
2023-02-17 16:47:54 +08:00
|
|
|
- ocsp_stapled
|
|
|
|
|
- ocsp_status (when ocsp_stapled=yes)
|
|
|
|
|
- ocsp_verified (when ocsp_stapled=yes)
|
2018-07-31 03:12:45 +08:00
|
|
|
- fields:
|
2019-07-23 07:10:40 +08:00
|
|
|
- verification_code (int)
|
|
|
|
|
- verification_error (string)
|
2025-02-07 04:11:18 +08:00
|
|
|
- expiry (int, seconds) - Time when the certificate will expire, in seconds
|
|
|
|
|
since the Unix epoch. `SELECT (expiry / 60 / 60 / 24) as "expiry_in_days"`
|
2018-10-19 14:34:59 +08:00
|
|
|
- age (int, seconds)
|
|
|
|
|
- startdate (int, seconds)
|
|
|
|
|
- enddate (int, seconds)
|
2023-02-17 16:47:54 +08:00
|
|
|
- ocsp_status_code (int)
|
|
|
|
|
- ocsp_next_update (int, seconds)
|
|
|
|
|
- ocsp_produced_at (int, seconds)
|
|
|
|
|
- ocsp_this_update (int, seconds)
|
2018-07-31 03:12:45 +08:00
|
|
|
|
2022-06-09 05:22:56 +08:00
|
|
|
## Example Output
|
2018-07-31 03:12:45 +08:00
|
|
|
|
2023-04-04 19:43:49 +08:00
|
|
|
```text
|
2023-02-17 16:47:54 +08:00
|
|
|
x509_cert,common_name=ubuntu,ocsp_stapled=no,source=/etc/ssl/certs/ssl-cert-snakeoil.pem,verification=valid age=7693222i,enddate=1871249033i,expiry=307666777i,startdate=1555889033i,verification_code=0i 1563582256000000000
|
|
|
|
|
x509_cert,common_name=www.example.org,country=US,locality=Los\ Angeles,organization=Internet\ Corporation\ for\ Assigned\ Names\ and\ Numbers,organizational_unit=Technology,province=California,ocsp_stapled=no,source=https://example.org:443,verification=invalid age=20219055i,enddate=1606910400i,expiry=43328144i,startdate=1543363200i,verification_code=1i,verification_error="x509: certificate signed by unknown authority" 1563582256000000000
|
|
|
|
|
x509_cert,common_name=DigiCert\ SHA2\ Secure\ Server\ CA,country=US,organization=DigiCert\ Inc,ocsp_stapled=no,source=https://example.org:443,verification=valid age=200838255i,enddate=1678276800i,expiry=114694544i,startdate=1362744000i,verification_code=0i 1563582256000000000
|
|
|
|
|
x509_cert,common_name=DigiCert\ Global\ Root\ CA,country=US,organization=DigiCert\ Inc,organizational_unit=www.digicert.com,ocsp_stapled=yes,ocsp_status=good,ocsp_verified=yes,source=https://example.org:443,verification=valid age=400465455i,enddate=1952035200i,expiry=388452944i,ocsp_next_update=1676714398i,ocsp_produced_at=1676112480i,ocsp_status_code=0i,ocsp_this_update=1676109600i,startdate=1163116800i,verification_code=0i 1563582256000000000
|
2018-07-31 03:12:45 +08:00
|
|
|
```
|