Loading repository data…
Loading repository data…
dig-sec / repository
CertMonitor is a Python 3.11+ application that monitors Certificate Transparency (CT) logs for new X.509 and Precertificate entries and indexes them into Elasticsearch using the official Python client.
CertMonitor is a Python 3.11+ application that monitors Certificate Transparency (CT) logs for new X.509 and Precertificate entries and indexes them into Elasticsearch using the official Python client.
CertMonitor/
├── src/
│ ├── config.py # Loads environment variables and configuration
│ ├── ct_parser.py # Parses CT entries into metadata
│ ├── ct_utils.py # HTTP utility and CT log list loader
│ ├── elastic.py # Elasticsearch client and index setup
│ ├── main.py # Entrypoint
│ ├── monitor.py # Monitoring and indexing logic
│ └── __pycache__/ # Compiled Python cache
├── .env_sample # Sample env config
├── .gitignore
├── docker-compose.yml # Docker orchestration
├── Dockerfile # Image definition
├── Makefile # Optional automation commands
├── README.md # This documentation
└── requirements.txt # Python dependencies
SIGINT/SIGTERMgit clone https://github.com/dig-sec/CertMonitor.git
cd CertMonitor
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
cp .env_sample .env
# Edit .env with your Elasticsearch credentials and config
docker-compose up --build
This spins up the monitor container and runs it using settings from .env.
Edit the .env file or override using environment variables:
| Variable | Default | Description |
|---|---|---|
CT_LOG_LIST_URL | https://www.gstatic.com/ct/log_list/v3/log_list.json | Google’s CT log list |
ELASTICSEARCH_HOSTS | http://localhost:9200 | One or more Elasticsearch hosts |
ELASTICSEARCH_INDEX | ssl_certificates | Index for storing parsed certs |
ELASTICSEARCH_USERNAME | elastic | Auth username |
ELASTICSEARCH_PASSWORD | changeme | Auth password |
FETCH_INTERVAL | 60 | Polling interval (seconds) |
BATCH_SIZE | 256 | Entry batch size |
CACHE_MAXSIZE | 100000 | Max cached fingerprints |
CACHE_TTL | 3600 | Cache expiry (seconds) |
REQUEST_TIMEOUT | 10 | Timeout for HTTP requests |
cachetools.TTLCache.An index template (ct-monitor-template) is auto-created for you, containing mappings for:
@timestamp, fingerprint, subject_cn, issuer_cnNo manual setup is required — the template is installed if it doesn't exist.
python src/main.py
This will: