This document describes the automated Certificate Transparency (CT) log monitoring system for GistPin.
The CT monitoring system watches for unauthorized SSL/TLS certificates issued against GistPin domains by querying public CT logs. When a certificate appears that is not on the approved allowlist, an alert is raised.
| File | Purpose |
|---|---|
scripts/monitor-ct-logs.sh |
Main monitoring script |
monitoring/ct-alerts.yml |
Prometheus alert rules for CT events |
security/ct-allowlist.txt |
Approved domain list |
echo "*.gistpin.org" > infrastructure/security/ct-allowlist.txt
echo "*.staging.gistpin.org" >> infrastructure/security/ct-allowlist.txt
echo "api.gistpin.org" >> infrastructure/security/ct-allowlist.txtOne domain or wildcard pattern per line. Lines starting with # are ignored.
| Variable | Default | Description |
|---|---|---|
DOMAIN_ALLOWLIST_FILE |
security/ct-allowlist.txt |
Path to domain allowlist |
SLACK_WEBHOOK |
(none) | Slack incoming webhook URL |
CT_API_BASE |
https://crt.sh |
CT log API endpoint |
CHECK_INTERVAL |
3600 |
Seconds between monitoring cycles |
LOOKBACK_HOURS |
24 |
Hours of CT log to scan per check |
REPORT_DIR |
/tmp/ct-reports |
Directory for weekly reports |
# One-shot check
./scripts/monitor-ct-logs.sh
# Generate weekly report
./scripts/monitor-ct-logs.sh --reportapiVersion: batch/v1
kind: CronJob
metadata:
name: ct-monitor
namespace: gistpin-monitoring
spec:
schedule: "0 */6 * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: ct-monitor
image: gistpin/ct-monitor:latest
env:
- name: SLACK_WEBHOOK
valueFrom:
secretKeyRef:
name: ct-alerts
key: slack-webhook
restartPolicy: OnFailure- The script reads domains from the allowlist
- For each domain, it queries
crt.shfor certificates issued in the last N hours - Certificates from known trusted CAs (Let's Encrypt, Google Trust, DigiCert, Cloudflare) are ignored
- Remaining certificates are checked against the allowlist
- Any unexpected certificate triggers a Slack alert
| Alert | Severity | Condition |
|---|---|---|
UnexpectedCertificateDetected |
critical | Certificate found outside allowlist |
CTLogCheckFailing |
warning | Script failing for > 30 minutes |
CTReportOverdue |
info | Weekly report not generated in 7 days |
CTLogHighCertificateCount |
warning | > 50 certs in 24h for a domain |
When an unexpected certificate is detected:
- Verify — Check the alert details for the domain and issuer
- Check crt.sh — Manually browse https://crt.sh/?q=DOMAIN for details
- Contact issuer — If unauthorized, contact the certificate authority to revoke
- Rotate keys — If compromise is suspected, rotate all secrets and keys
- Update allowlist — If the certificate is legitimate, add the domain to the allowlist
- Document — Record the incident in the runbook under
docs/incident-response.md
| Code | Meaning |
|---|---|
| 0 | All domains clean |
| 1 | Warning — unexpected certificates detected |
| 2 | Critical — script error or alert sent |