Skip to main content

CLI and python library to export Traefik SSL certificates

Project description

license releases stars docker stars docker pulls docker size pypi version python versions python downloads

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

traefik_cert_exporter-1.0.0.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

traefik_cert_exporter-1.0.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file traefik_cert_exporter-1.0.0.tar.gz.

File metadata

  • Download URL: traefik_cert_exporter-1.0.0.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for traefik_cert_exporter-1.0.0.tar.gz
Algorithm Hash digest
SHA256 984f54e187684714c073abc6d80963654dc25669e3268ac40645746ce12c40a5
MD5 e1c29e37d6ec2506794af2e1b095a2a8
BLAKE2b-256 af1ecba573da9644dd7f85b2f2ebed99939d58b8e21bf0bc9bb9de5fe1f08b80

See more details on using hashes here.

File details

Details for the file traefik_cert_exporter-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for traefik_cert_exporter-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 88e889668c7584b32e3d2a23a3bde455eeae26377f2b1e71c494d3a96fbc59c0
MD5 f880cfcab8a15b4b22006b6fbc037e0b
BLAKE2b-256 c765ecd3ee1e92ad04c4a568a093b4037c1b17cb12a353a791a1cb7ba268c0fc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page