专属域名
文档搜索
轩辕助手
Run助手
邀请有礼
返回顶部
快速返回页面顶部
收起
收起工具栏
轩辕镜像 官方专业版
轩辕镜像 官方专业版轩辕镜像 官方专业版官方专业版
首页个人中心搜索镜像

交易
充值流量我的订单
工具
提交工单镜像收录一键安装
Npm 源Pip 源Homebrew 源
帮助
常见问题
其他
关于我们网站地图

官方QQ群: 1072982923

ribbybibby/ssl-exporter Docker 镜像 - 轩辕镜像

ssl-exporter
ribbybibby/ssl-exporter
ribbybibby
Exports Prometheus metrics for SSL certificates
3 收藏0 次下载
⏱️ 镜像拉取更稳定,部署项目不再心跳加速
镜像简介版本下载
⏱️ 镜像拉取更稳定,部署项目不再心跳加速

SSL Certificate Exporter

Exports metrics for certificates collected from various sources:

  • TCP probes
  • HTTPS probes
  • PEM files
  • Kubernetes secrets
  • Kubeconfig files

The metrics are labelled with fields from the certificate, which allows for informational dashboards and flexible alert routing.

Building

make
./ssl_exporter <flags>

Similarly to the blackbox_exporter, visiting http://localhost:9219/probe?target=example.com:443 will return certificate metrics for example.com. The ssl_probe_success metric indicates if the probe has been successful.

Docker
docker pull ribbybibby/ssl-exporter
docker run -p 9219:9219 ribbybibby/ssl-exporter:latest <flags>
Release process
  • Update the VERSION file in this repository and commit to master
  • This github action will add a changelog and upload binaries in response to a release being created in Github
  • Dockerhub will build and tag a new container image in response to tags of the format /^v[0-9.]+$/

Usage

usage: ssl_exporter [<flags>]

Flags:
  -h, --help                     Show context-sensitive help (also try --help-long and
                                 --help-man).
      --web.listen-address=":9219"
                                 Address to listen on for web interface and telemetry.
      --web.metrics-path="/metrics"
                                 Path under which to expose metrics
      --web.probe-path="/probe"  Path under which to expose the probe endpoint
      --config.file=""           SSL exporter configuration file
      --log.level="info"         Only log messages with the given severity or above. Valid
                                 levels: [debug, info, warn, error, fatal]
      --log.format="logger:stderr"
                                 Set the log target and format. Example:
                                 "logger:syslog?appname=bob&local=7" or
                                 "logger:stdout?json=true"
      --version                  Show application version.

Metrics

MetricMeaningLabelsProbers
ssl_cert_not_afterThe date after which a peer certificate expires. Expressed as a Unix Epoch Time.serial_no, issuer_cn, cn, dnsnames, ips, emails, outcp, https
ssl_cert_not_beforeThe date before which a peer certificate is not valid. Expressed as a Unix Epoch Time.serial_no, issuer_cn, cn, dnsnames, ips, emails, outcp, https
ssl_file_cert_not_afterThe date after which a certificate found by the file prober expires. Expressed as a Unix Epoch Time.file, serial_no, issuer_cn, cn, dnsnames, ips, emails, oufile
ssl_file_cert_not_beforeThe date before which a certificate found by the file prober is not valid. Expressed as a Unix Epoch Time.file, serial_no, issuer_cn, cn, dnsnames, ips, emails, oufile
ssl_kubernetes_cert_not_afterThe date after which a certificate found by the kubernetes prober expires. Expressed as a Unix Epoch Time.namespace, secret, key, serial_no, issuer_cn, cn, dnsnames, ips, emails, oukubernetes
ssl_kubernetes_cert_not_beforeThe date before which a certificate found by the kubernetes prober is not valid. Expressed as a Unix Epoch Time.namespace, secret, key, serial_no, issuer_cn, cn, dnsnames, ips, emails, oukubernetes
ssl_kubeconfig_cert_not_afterThe date after which a certificate found by the kubeconfig prober expires. Expressed as a Unix Epoch Time.kubeconfig, name, type, serial_no, issuer_cn, cn, dnsnames, ips, emails, oukubeconfig
ssl_kubeconfig_cert_not_beforeThe date before which a certificate found by the kubeconfig prober is not valid. Expressed as a Unix Epoch Time.kubeconfig, name, type, serial_no, issuer_cn, cn, dnsnames, ips, emails, oukubeconfig
ssl_ocsp_response_next_updateThe nextUpdate value in the OCSP response. Expressed as a Unix Epoch Timetcp, https
ssl_ocsp_response_produced_atThe producedAt value in the OCSP response. Expressed as a Unix Epoch Timetcp, https
ssl_ocsp_response_revoked_atThe revocationTime value in the OCSP response. Expressed as a Unix Epoch Timetcp, https
ssl_ocsp_response_statusThe status in the OCSP response. 0=Good 1=Revoked 2=Unknowntcp, https
ssl_ocsp_response_stapledDoes the connection state contain a stapled OCSP response? Boolean.tcp, https
ssl_ocsp_response_this_updateThe thisUpdate value in the OCSP response. Expressed as a Unix Epoch Timetcp, https
ssl_probe_successWas the probe successful? Boolean.all
ssl_proberThe prober used by the exporter to connect to the target. Boolean.proberall
ssl_tls_version_infoThe TLS version used. Always 1.versiontcp, https
ssl_verified_cert_not_afterThe date after which a certificate in the verified chain expires. Expressed as a Unix Epoch Time.chain_no, serial_no, issuer_cn, cn, dnsnames, ips, emails, outcp, https
ssl_verified_cert_not_beforeThe date before which a certificate in the verified chain is not valid. Expressed as a Unix Epoch Time.chain_no, serial_no, issuer_cn, cn, dnsnames, ips, emails, outcp, https

Configuration

TCP

Just like with the blackbox_exporter, you should pass the targets to a single instance of the exporter in a scrape config with a clever bit of relabelling. This allows you to leverage service discovery and keeps configuration centralised to your Prometheus config.

yml
scrape_configs:
  - job_name: "ssl"
    metrics_path: /probe
    static_configs:
      - targets:
          - example.com:443
          - prometheus.io:443
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: 127.0.0.1:9219 # SSL exporter.
HTTPS

By default the exporter will make a TCP connection to the target. This will be suitable for most cases but if you want to take advantage of http proxying you can use a HTTPS client by setting the https module parameter:

yml
scrape_configs:
  - job_name: "ssl"
    metrics_path: /probe
    params:
      module: ["https"] # <-----
    static_configs:
      - targets:
          - example.com:443
          - prometheus.io:443
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: 127.0.0.1:9219

This will use proxy servers discovered by the environment variables HTTP_PROXY, HTTPS_PROXY and ALL_PROXY. Or, you can set the proxy_url option in the module configuration.

The latter takes precedence.

File

The file prober exports ssl_file_cert_not_after and ssl_file_cert_not_before for PEM encoded certificates found in local files.

Files local to the exporter can be scraped by providing them as the target parameter:

curl "localhost:9219/probe?module=file&target=/etc/ssl/cert.pem"

The target parameter supports globbing (as provided by the doublestar package), which allows you to capture multiple files at once:

curl "localhost:9219/probe?module=file&target=/etc/ssl/**/*.pem"

One specific usage of this prober could be to run the exporter as a DaemonSet in Kubernetes and then scrape each instance to check the expiry of certificates on each node:

yml
scrape_configs:
  - job_name: "ssl-kubernetes-file"
    metrics_path: /probe
    params:
      module: ["file"]
      target: ["/etc/kubernetes/**/*.crt"]
    kubernetes_sd_configs:
      - role: node
    relabel_configs:
      - source_labels: [__address__]
        regex: ^(.*):(.*)$
        target_label: __address__
        replacement: ${1}:9219
Kubernetes

The kubernetes prober exports ssl_kubernetes_cert_not_after and ssl_kubernetes_cert_not_before for PEM encoded certificates found in secrets of type kubernetes.io/tls.

Provide the namespace and name of the secret in the form <namespace>/<name> as the target:

curl "localhost:9219/probe?module=kubernetes&target=kube-system/secret-name"

Both the namespace and name portions of the target support glob matching (as provided by the doublestar package):

curl "localhost:9219/probe?module=kubernetes&target=kube-system/*"

curl "localhost:9219/probe?module=kubernetes&target=*/*"

The exporter retrieves credentials and context configuration from the following sources in the following order:

  • The kubeconfig path in the module configuration
  • The $KUBECONFIG environment variable
  • The default configuration file ($HOME/.kube/config)
  • The in-cluster environment, if running in a pod
Kubeconfig

The kubeconfig prober exports ssl_kubeconfig_cert_not_after and ssl_kubeconfig_cert_not_before for PEM encoded certificates found in the specified kubeconfig file.

Kubeconfigs local to the exporter can be scraped by providing them as the target parameter:

curl "localhost:9219/probe?module=kubeconfig&target=/etc/kubernetes/admin.conf"

One specific usage of this prober could be to run the exporter as a DaemonSet in Kubernetes and then scrape each instance to check the expiry of certificates on each node:

yml
scrape_configs:
  - job_name: "ssl-kubernetes-kubeconfig"
    metrics_path: /probe
    params:
      module: ["kubeconfig"]
      target: ["/etc/kubernetes/admin.conf"]
    kubernetes_sd_configs:
      - role: node
    relabel_configs:
      - source_labels: [__address__]
        regex: ^(.*):(.*)$
        target_label: __address__
        replacement: ${1}:9219

Configuration file

You can provide further module configuration by providing the path to a configuration file with --config.file. The file is written in yaml format, defined by the schema below.

modules: [<module>]
<module>
# The type of probe (https, tcp, file, kubernetes, kubeconfig)
prober: <prober_string>

# How long the probe will wait before giving up.
[ timeout: <duration> ]

# Configuration for TLS
[ tls_config: <tls_config> ]

# The specific probe configuration
[ https: <https_probe> ]
[ tcp: <tcp_probe> ]
[ kubernetes: <kubernetes_probe> ]
<tls_config>
# Disable target certificate validation.
[ insecure_skip_verify: <boolean> | default = false ]

# The CA cert to use for the targets.
[ ca_file: <filename> ]

# The client cert file for the targets.
[ cert_file: <filename> ]

# The client key file for the targets.
[ key_file: <filename> ]

# Used to verify the hostname for the targets.
[ server_name: <string> ]
<https_probe>
# HTTP proxy server to use to connect to the targets.
[ proxy_url: <string> ]
<tcp_probe>
# Use the STARTTLS command before starting TLS for those protocols that support it (smtp, ftp, imap)
[ starttls: <string> ]
<kubernetes_probe>
# The path of a kubeconfig file to configure the probe
[ kubeconfig: <string> ]

Example Queries

Certificates that expire within 7 days:

ssl_cert_not_after - time() < 86400 * 7

Wildcard certificates that are expiring:

ssl_cert_not_after{cn=~"\*.*"} - time() < 86400 * 7

Certificates that expire within 7 days in the verified chain that expires latest:

ssl_verified_cert_not_after{chain_no="0"} - time() < 86400 * 7

Number of certificates presented by the server:

count(ssl_cert_not_after) by (instance)

Identify failed probes:

ssl_probe_success == 0

Peer Certificates vs Verified Chain Certificates

Metrics are exported for the NotAfter and NotBefore fields for peer certificates as well as for the verified chain that is constructed by the client.

The former only includes the certificates that are served explicitly by the target, while the latter can contain multiple chains of trust that are constructed from root certificates held by the client to the target's server certificate.

This has important implications when monitoring certificate expiry.

For instance, it may be the case that ssl_cert_not_after reports that the root certificate served by the target is expiring soon even though clients can form another, much longer lived, chain of trust using another valid root certificate held locally. In this case, you may want to use ssl_verified_cert_not_after to alert on expiry instead, as this will contain the chain that the client actually constructs:

ssl_verified_cert_not_after{chain_no="0"} - time() < 86400 * 7

Each chain is numbered by the exporter in reverse order of expiry, so that chain_no="0" is the chain that will expire the latest. Therefore the query above will only alert when the chain of trust between the exporter and the target is truly nearing expiry.

It's very important to note that a query of this kind only represents the chain of trust between the exporter and the target. Genuine clients may hold different root certs than the exporter and therefore have different verified chains of trust.

Grafana

You can find a simple dashboard here that tracks certificate expiration dates and target connection errors.

查看更多 ssl-exporter 相关镜像 →
bitnami/redis-exporter logo
bitnami/redis-exporter
Bitnami安全镜像,集成redis-exporter工具,用于安全导出Redis监控指标。
16100M+ pulls
上次更新:未知
bitnami/jmx-exporter logo
bitnami/jmx-exporter
Bitnami提供的安全镜像,用于运行jmx-exporter以导出JMX指标,适用于Java应用监控场景。
810M+ pulls
上次更新:未知
bitnami/node-exporter logo
bitnami/node-exporter
Bitnami安全版node-exporter镜像,用于节点监控,收集主机系统及硬件指标。
2550M+ pulls
上次更新:未知
bitnami/nginx-exporter logo
bitnami/nginx-exporter
Bitnami安全镜像,用于NGINX Prometheus Exporter,支持通过Prometheus监控NGINX或NGINX Plus,提供安全加固、最小化攻击面、FIPS配置及持续更新等企业级特性。
510M+ pulls
上次更新:未知
bitnami/mongodb-exporter logo
bitnami/mongodb-exporter
Bitnami mongodb-exporter安全镜像,用于导出MongoDB监控指标,提供安全可靠的指标采集与导出功能。
1450M+ pulls
上次更新:未知
bitnami/nats-exporter logo
bitnami/nats-exporter
Bitnami安全镜像,用于NATS指标的Prometheus导出器,提供安全优化的容器化部署方案,支持非root运行及FIPS配置,适用于开发和生产环境的监控需求。
35M+ pulls
上次更新:未知

轩辕镜像配置手册

探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式

登录仓库拉取

通过 Docker 登录认证访问私有仓库

Linux

在 Linux 系统配置镜像服务

Windows/Mac

在 Docker Desktop 配置镜像

Docker Compose

Docker Compose 项目配置

K8s Containerd

Kubernetes 集群配置 Containerd

K3s

K3s 轻量级 Kubernetes 镜像加速

Dev Containers

VS Code Dev Containers 配置

MacOS OrbStack

MacOS OrbStack 容器配置

宝塔面板

在宝塔面板一键配置镜像

群晖

Synology 群晖 NAS 配置

飞牛

飞牛 fnOS 系统配置镜像

极空间

极空间 NAS 系统配置服务

爱快路由

爱快 iKuai 路由系统配置

绿联

绿联 NAS 系统配置镜像

威联通

QNAP 威联通 NAS 配置

Podman

Podman 容器引擎配置

Singularity/Apptainer

HPC 科学计算容器配置

其他仓库配置

ghcr、Quay、nvcr 等镜像仓库

专属域名拉取

无需登录使用专属域名

需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单

镜像拉取常见问题

轩辕镜像免费版与专业版有什么区别?

免费版仅支持 Docker Hub 访问,不承诺可用性和速度;专业版支持更多镜像源,保证可用性和稳定速度,提供优先客服响应。

轩辕镜像支持哪些镜像仓库?

专业版支持 docker.io、gcr.io、ghcr.io、registry.k8s.io、nvcr.io、quay.io、mcr.microsoft.com、docker.elastic.co 等;免费版仅支持 docker.io。

流量耗尽错误提示

当返回 402 Payment Required 错误时,表示流量已耗尽,需要充值流量包以恢复服务。

410 错误问题

通常由 Docker 版本过低导致,需要升级到 20.x 或更高版本以支持 V2 协议。

manifest unknown 错误

先检查 Docker 版本,版本过低则升级;版本正常则验证镜像信息是否正确。

镜像拉取成功后,如何去掉轩辕镜像域名前缀?

使用 docker tag 命令为镜像打上新标签,去掉域名前缀,使镜像名称更简洁。

查看全部问题→

用户好评

来自真实用户的反馈,见证轩辕镜像的优质服务

用户头像

oldzhang

运维工程师

Linux服务器

5

"Docker访问体验非常流畅,大镜像也能快速完成下载。"

轩辕镜像
镜像详情
...
ribbybibby/ssl-exporter
官方博客Docker 镜像使用技巧与技术博客
热门镜像查看热门 Docker 镜像推荐
一键安装一键安装 Docker 并配置镜像源
咨询镜像拉取问题请 提交工单,官方技术交流群:1072982923
轩辕镜像面向开发者与科研用户,提供开源镜像的搜索和访问支持。所有镜像均来源于原始仓库,本站不存储、不修改、不传播任何镜像内容。
咨询镜像拉取问题请提交工单,官方技术交流群:
轩辕镜像面向开发者与科研用户,提供开源镜像的搜索和访问支持。所有镜像均来源于原始仓库,本站不存储、不修改、不传播任何镜像内容。
官方邮箱:点击复制邮箱
©2024-2026 源码跳动
官方邮箱:点击复制邮箱Copyright © 2024-2026 杭州源码跳动科技有限公司. All rights reserved.