Certificate discovery agent for CertForge. Finds TLS certificates across your infrastructure and reports them to CertForge for governance, expiry tracking, and compliance.
Most certificate problems start with not knowing what you have. certforge-discovery scans your infrastructure for TLS certificates — public CT logs, live network endpoints, local filesystems, and Kubernetes secrets — and surfaces them in CertForge so you can track, govern, and renew them before they cause an outage.
| Source | What it finds |
|---|---|
| CT log | All certificates ever issued for your domains (via crt.sh) |
| TLS scan | Certificates live on network endpoints — hostnames, IPs, CIDR ranges |
| Local filesystem | Cert files on the host (/etc/ssl, nginx, apache, letsencrypt paths) |
| Kubernetes | All kubernetes.io/tls secrets across every namespace |
No CertForge account required for standalone scanning — use -domain, -target, and -out to scan and save results locally without any account. A CertForge account unlocks full governance workflows, expiry tracking, alerting, and the continuous agent mode.
Download the binary for your platform from the latest release:
# Linux (AMD64)
curl -Lo certforge-discovery https://github.com/CertForge-LLC/certforge-discovery/releases/latest/download/certforge-discovery-linux-amd64
chmod +x certforge-discovery
sudo mv certforge-discovery /usr/local/bin/Verify the download (optional but recommended):
curl -Lo checksums.txt https://github.com/CertForge-LLC/certforge-discovery/releases/latest/download/checksums.txt
sha256sum -c checksums.txt --ignore-missingOr install from source (requires Go 1.21+):
go install github.com/certforge-llc/certforge-discovery/cmd/certforge-discovery@latestScan any domain or network target and write results locally — no account needed:
# CT log scan → pretty table to stdout
certforge-discovery scan -domain example.com
# CT log + TLS live scan → CSV file
certforge-discovery scan -domain example.com -target 10.0.1.0/24 -out certs.csv
# Local filesystem scan → JSON file
certforge-discovery scan -local -out certs.json
# All sources → JSON
certforge-discovery scan -domain example.com -target 10.0.1.0/24 -local -k8s -out certs.jsonOption A — mTLS enrollment (recommended)
mTLS connects directly to the CertForge agent endpoint on port 8443, bypassing Cloudflare.
- Go to Integrations → Connector Agents in CertForge
- Click + Enroll Agent and choose type Discovery
- Give it a label (e.g.
prod-scanner) and copy the one-time token
certforge-discovery enroll \
-token <one-time-token> \
-url https://app.certgov.app \
-label prod-scannerThis writes client.crt, client.key, and server.crt to ~/.certforge-discovery/ and updates ~/.certforge-discovery/config.yaml with the mtls_* fields automatically.
Option B — API key setup (legacy)
certforge-discovery setupPicks your data region and writes an API key to ~/.certforge-discovery/config.yaml.
Run a scan:
certforge-discovery scanResults appear immediately in CertForge → Discovery.
Run continuously (recommended — re-scans on the configured interval, default 6h):
certforge-discovery agent-config <path> Config file (default: ~/.certforge-discovery/config.yaml)
-domain <domain> Scan CT log for this domain (repeatable)
-target <host> TLS-scan this host, IP, or CIDR (repeatable)
-ports <ports> Ports for TLS scan (default: 443,8443)
-local Scan local filesystem for cert files
-k8s Scan Kubernetes TLS secrets
-k8s-namespace <ns> Limit K8s scan to this namespace (repeatable; default: all namespaces)
-out <file> Write to file (.csv or .json); stdout table if omitted
-dry-run Print the JSON payload without posting to CertForge
The config file lives at ~/.certforge-discovery/config.yaml by default. Override with -config <path>.
# URL of your CertForge instance (US East or EU West).
certforge_url: https://app.certgov.app
# ── Authentication — choose one ──────────────────────────────────────────────
# Option A: mTLS client certificate (recommended)
# Written by: certforge-discovery enroll -token <otp> -url ... -label ...
mtls_host: usagent.certgov.app # printed by the enroll command
mtls_port: 8443 # 8443 prod · 8444 preview/dev
mtls_cert: ~/.certforge-discovery/client.crt
mtls_key: ~/.certforge-discovery/client.key
mtls_ca: ~/.certforge-discovery/server.crt
# Option B: API key (legacy — comment out the mtls_* lines, uncomment below)
# api_key: cf_... # from CertForge Settings → API Keys
# ── Poll interval ─────────────────────────────────────────────────────────────
# How often the agent re-scans in continuous mode (default 6h).
poll_interval: 6h
# ── Optional scan settings ────────────────────────────────────────────────────
scan_local: false # scan local filesystem for cert files
scan_k8s: false # scan Kubernetes TLS secrets
kubeconfig: "" # path to kubeconfig; empty = in-cluster config
k8s_namespaces: # namespaces to scan; leave empty to scan all namespaces
- default # (empty = requires cluster-wide Secret list permission)
- production
storage_paths: # additional filesystem paths to scan (beyond the defaults)
- /opt/app/certsLocal filesystem scan paths: by default the agent scans /etc/ssl/certs, /etc/nginx/ssl, /etc/nginx/certs, /etc/apache2/ssl, /etc/httpd/ssl, /etc/letsencrypt/live, /etc/letsencrypt/archive, and /etc/pki/tls/certs. /etc/ssl/private is intentionally excluded — it contains private keys, not certificates.
EU West (GDPR):
certforge_url: https://eu.certgov.app
mtls_host: eu-agent.certgov.app
mtls_port: 8443
# ... or api_key: cf_... for legacy auth
poll_interval: 6h[Unit]
Description=CertForge Discovery Agent
After=network.target
[Service]
ExecStart=/usr/local/bin/certforge-discovery agent
Restart=on-failure
RestartSec=30
[Install]
WantedBy=multi-user.targetsudo systemctl enable --now certforge-discoverymTLS auth (recommended):
# Write config from certforge-discovery enroll to /etc/certforge-discovery/
docker run -d --name certforge-discovery \
-v /etc/certforge-discovery:/etc/certforge-discovery:ro \
ghcr.io/certforge-llc/certforge-discovery:latest \
agent -config /etc/certforge-discovery/config.yamlAPI key auth (legacy):
docker run -d --name certforge-discovery \
-e CERTFORGE_URL=https://app.certgov.app \
-e API_KEY=cf_... \
-v /etc/certforge-discovery/config.yaml:/etc/certforge-discovery/config.yaml:ro \
ghcr.io/certforge-llc/certforge-discovery:latestFor local filesystem scanning, mount the paths you want scanned:
docker run -d --name certforge-discovery \
-v /etc/certforge-discovery:/etc/certforge-discovery:ro \
-v /etc/ssl/certs:/etc/ssl/certs:ro \
-v /etc/nginx/ssl:/etc/nginx/ssl:ro \
ghcr.io/certforge-llc/certforge-discovery:latest \
agent -config /etc/certforge-discovery/config.yaml -localBuild from source:
docker build --build-arg VERSION=v0.1.20 -t certforge-discovery:latest .mTLS auth (recommended):
Store the mTLS credentials from certforge-discovery enroll in a Secret:
kubectl create secret generic certforge-discovery-mtls \
--namespace certforge-system \
--from-file=client.crt=~/.certforge-discovery/client.crt \
--from-file=client.key=~/.certforge-discovery/client.key \
--from-file=server.crt=~/.certforge-discovery/server.crtapiVersion: apps/v1
kind: Deployment
metadata:
name: certforge-discovery
namespace: certforge-system
spec:
replicas: 1
selector:
matchLabels:
app: certforge-discovery
template:
metadata:
labels:
app: certforge-discovery
spec:
serviceAccountName: certforge-discovery
volumes:
- name: mtls
secret:
secretName: certforge-discovery-mtls
containers:
- name: agent
image: ghcr.io/certforge-llc/certforge-discovery:latest
volumeMounts:
- name: mtls
mountPath: /etc/certforge-discovery/creds
readOnly: true
env:
- name: CERTFORGE_URL
value: https://app.certgov.app
- name: MTLS_HOST
value: usagent.certgov.app
- name: MTLS_PORT
value: "8443"
- name: MTLS_CERT
value: /etc/certforge-discovery/creds/client.crt
- name: MTLS_KEY
value: /etc/certforge-discovery/creds/client.key
- name: MTLS_CA
value: /etc/certforge-discovery/creds/server.crtAPI key auth (legacy):
apiVersion: apps/v1
kind: Deployment
metadata:
name: certforge-discovery
namespace: certforge-system
spec:
replicas: 1
selector:
matchLabels:
app: certforge-discovery
template:
metadata:
labels:
app: certforge-discovery
spec:
serviceAccountName: certforge-discovery
containers:
- name: agent
image: ghcr.io/certforge-llc/certforge-discovery:latest
env:
- name: CERTFORGE_URL
value: https://app.certgov.app
- name: API_KEY
valueFrom:
secretKeyRef:
name: certforge-discovery-credentials
key: api_keyEnable with scan_k8s: true in your config. By default the agent reads kubernetes.io/tls secrets across all namespaces, which requires a ClusterRole:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: certforge-discovery
rules:
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get", "list"]To limit scanning to specific namespaces, set k8s_namespaces in your config or use the -k8s-namespace flag. With namespace restrictions you can use a Role (not ClusterRole) bound to each namespace instead:
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: certforge-discovery
namespace: production # repeat per namespace
rules:
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get", "list"]The agent never reads tls.key — only tls.crt is accessed and only certificate metadata (not key material) is reported to CertForge.
If your network requires an outbound proxy, set the standard environment variables before running:
export HTTPS_PROXY=http://proxy.corp.com:8080
export NO_PROXY=localhost,127.0.0.1,10.0.0.0/8
certforge-discovery scan -domain example.comThis applies to CT log queries (crt.sh) and CertForge API calls. Live TLS scanning (-target) makes direct TCP connections and is not proxied — run the agent on a host that can reach the targets directly.
For a systemd service, set the proxy in the unit file:
[Service]
Environment=HTTPS_PROXY=http://proxy.corp.com:8080
Environment=NO_PROXY=localhost,10.0.0.0/8
ExecStart=/usr/local/bin/certforge-discovery agent -domain example.comWhen a CertForge account is configured, the agent posts certificate metadata only to your CertForge region. The exact fields sent for each certificate:
| Field | Example | Notes |
|---|---|---|
fingerprint |
sha256:3f2a... |
SHA-256 of the DER-encoded cert |
serial |
0x1A2B3C... |
Certificate serial number |
issuer |
C=US, O=Let's Encrypt, CN=R11 |
Issuer distinguished name |
subject |
example.com |
Subject common name |
sans |
example.com, www.example.com |
Subject alternative names |
not_before |
2024-01-01T00:00:00Z |
Validity start |
not_after |
2024-04-01T00:00:00Z |
Expiry |
source |
ct_log, tls_scan, local, k8s |
How the cert was found |
source_detail |
192.168.1.50:443 |
Specific endpoint or path |
seen_deployed |
true |
Whether a live TLS handshake confirmed it |
eku |
["TLS Web Server Authentication"] |
Extended key usages |
Never read or transmitted:
- Private keys or key material of any kind
- Plaintext traffic or HTTP request/response bodies
- Filesystem contents beyond recognized certificate file formats
- Kubernetes secrets other than
kubernetes.io/tlstype (and even those: only thetls.crtfield, nevertls.key)
Run any scan with -dry-run to print the exact JSON payload that would be sent to CertForge — without posting anything:
certforge-discovery scan -domain example.com -dry-run
certforge-discovery scan -domain example.com -target 10.0.1.0/24 -dry-run | jq .The output is the verbatim request body. You can confirm it contains only the fields listed above before allowing the agent outbound access to CertForge.
certforge-discovery sends certificate metadata only to your configured certforge_url. No certificate private keys are ever read or transmitted — the agent only reads the public certificate portion of TLS secrets and cert files.
Your data stays in the region you chose during setup. See CertForge data residency for details.
Apache 2.0