Traefik Cert Exporter
CLI and python library to export Traefik SSL certificates.
This project is intended to provide tools to automate the process of extracting the certificates generated by Traefik's automatic certificate generation
Project based on the excelent work on Traefik SSL Certificate Exporter
Python library
You can use the python library on your own automation scripts
Installation
pip install traefik-cert-exporter
Usage
from traefik_cert_exporter import export_certificates
acme_file = "./acme.json"
output_dir = "./certs"
export_certificates(acme_file, output_dir)
CLI
You can use the included CLI directly from the terminal
Installation
pip install traefik-cert-exporter
Usage
export-certs ./acme.json ./certs
Docker
There is also a Docker image that create a cron job that runs the certificate export process on a schedule.
The container needs to have access to the store file generated by Traefik, so it needs to be configured with the correct variables to run successfully.
You can use the docker compose example to create your own environment.
image: https://hub.docker.com/r/ahuahuachi/traefik-cert-exporter
Environment Variables
| Variable | Default value | Description |
|---|---|---|
| CRON_SCHEDULE | 0 0 1 * * |
Cron schedule to run the extraction script |
| STORAGE_FILE | traefik/acme.json |
Path to the acme storage file |
| OUTPUT_PATH | certs/ |
Path where the certs are going to be extracted to |
| ON_START | 1 (true) |
Run export scripts once when container starts |
Docker compose example
Traefik's static configuration file
# static.yaml
certificatesResolvers:
myresolver:
acme:
storage: "/config/acme.json"
...
# docker-compose.yaml
version: "3"
services:
cert-exporter:
image: ahuahuachi/traefik-cert-exporter:latest
environment:
- STORAGE_FILE="/config/acme.json"
- OUTPUT_PATH="/certs"
volumes:
- traefik-config:/config/
- ./certs:/certs
traefik:
image: traefik:latest
volumes:
- traefik-config:/config/
...
volumes:
traefik-config:
Release files for traefik-cert-exporter 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| traefik_cert_exporter-1.0.1.tar.gz | 17.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| traefik_cert_exporter-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.2 kB
Release files / traefik_cert_exporter-1.0.1.tar.gz
| Download URL | traefik_cert_exporter-1.0.1.tar.gz |
|---|---|
| Size | 17.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aea16f586d1945a9b6f07fea082e1b2f87bcba3b3a18ef889391aef3a222dc5a
|
|
BLAKE2b-256 checksum How to use checksums |
2ead2342b998aeb5a4a81ebe79d58a30afbe62ecf41856956001c1416f0ea0d3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.0 CPython/3.12.4
|
Release files / traefik_cert_exporter-1.0.1-py3-none-any.whl
| Download URL | traefik_cert_exporter-1.0.1-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
50becc14de56960e89062509776569560b131b91e9d8303b86e0168f6311a7e7
|
|
BLAKE2b-256 checksum How to use checksums |
14d1079f6f7e247cdbd8c76b0cb52140c31027a0dc650b27c70d636b1e7814d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.0 CPython/3.12.4
|