CLI and python library to export Traefik SSL certificates
Project description
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:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file traefik_cert_exporter-1.0.1.tar.gz.
File metadata
- Download URL: traefik_cert_exporter-1.0.1.tar.gz
- Upload date:
- Size: 17.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aea16f586d1945a9b6f07fea082e1b2f87bcba3b3a18ef889391aef3a222dc5a
|
|
| MD5 |
b8c134c9a3116eeedcaedf592e3cf918
|
|
| BLAKE2b-256 |
2ead2342b998aeb5a4a81ebe79d58a30afbe62ecf41856956001c1416f0ea0d3
|
File details
Details for the file traefik_cert_exporter-1.0.1-py3-none-any.whl.
File metadata
- Download URL: traefik_cert_exporter-1.0.1-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50becc14de56960e89062509776569560b131b91e9d8303b86e0168f6311a7e7
|
|
| MD5 |
5b8f3472ffd84cbb05f6a5a8113f34fa
|
|
| BLAKE2b-256 |
14d1079f6f7e247cdbd8c76b0cb52140c31027a0dc650b27c70d636b1e7814d9
|