![license](https://badgen.net/github/license/ahuahuachi/traefik-cert-exporter/)
![releases](https://badgen.net/github/releases/ahuahuachi/traefik-cert-exporter/?icon=github)
![stars](https://badgen.net/github/stars/ahuahuachi/traefik-cert-exporter/?icon=github)
![docker stars](https://badgen.net/docker/stars/ahuahuachi/traefik-cert-exporter/?icon=docker)
![docker pulls](https://badgen.net/docker/pulls/ahuahuachi/traefik-cert-exporter/?icon=docker)
![docker size](https://badgen.net/docker/size/ahuahuachi/traefik-cert-exporter/?icon=docker)
![pypi version](https://badgen.net/pypi/v/traefik-cert-exporter/?icon=pypi)
![python versions](https://badgen.net/pypi/python/traefik-cert-exporter/?icon=pypi)
![python downloads](https://badgen.net/pypi/dm/traefik-cert-exporter/?icon=pypi)
# Traefik Cert Exporter
CLI and python library to export [Traefik](https://traefik.io/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](https://doc.traefik.io/traefik/https/acme)
<sub>Project based on the excelent work on [Traefik SSL Certificate Exporter](https://github.com/rafi0101/traefik-ssl-certificate-exporter)</sub>
## Python library
You can use the python library on your own automation scripts
### Installation
```bash
pip install traefik-cert-exporter
```
### Usage
```python
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
```bash
pip install traefik-cert-exporter
```
### Usage
```bash
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
```yaml
# static.yaml
certificatesResolvers:
myresolver:
acme:
storage: "/config/acme.json"
...
```
```yaml
# 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:
```
Raw data
{
"_id": null,
"home_page": null,
"name": "traefik-cert-exporter",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "certificate, cli, export, ssl, traefik",
"author": null,
"author_email": "Alfredo Altamirano <pypi.sprinkled287@passmail.net>",
"download_url": "https://files.pythonhosted.org/packages/2e/ad/2342b998aeb5a4a81ebe79d58a30afbe62ecf41856956001c1416f0ea0d3/traefik_cert_exporter-1.0.1.tar.gz",
"platform": null,
"description": "![license](https://badgen.net/github/license/ahuahuachi/traefik-cert-exporter/)\n![releases](https://badgen.net/github/releases/ahuahuachi/traefik-cert-exporter/?icon=github)\n![stars](https://badgen.net/github/stars/ahuahuachi/traefik-cert-exporter/?icon=github)\n![docker stars](https://badgen.net/docker/stars/ahuahuachi/traefik-cert-exporter/?icon=docker)\n![docker pulls](https://badgen.net/docker/pulls/ahuahuachi/traefik-cert-exporter/?icon=docker)\n![docker size](https://badgen.net/docker/size/ahuahuachi/traefik-cert-exporter/?icon=docker)\n![pypi version](https://badgen.net/pypi/v/traefik-cert-exporter/?icon=pypi)\n![python versions](https://badgen.net/pypi/python/traefik-cert-exporter/?icon=pypi)\n![python downloads](https://badgen.net/pypi/dm/traefik-cert-exporter/?icon=pypi)\n\n# Traefik Cert Exporter\n\nCLI and python library to export [Traefik](https://traefik.io/traefik/) SSL certificates.\n\nThis project is intended to provide tools to automate the process of extracting the certificates generated by [Traefik's automatic certificate generation](https://doc.traefik.io/traefik/https/acme)\n\n<sub>Project based on the excelent work on [Traefik SSL Certificate Exporter](https://github.com/rafi0101/traefik-ssl-certificate-exporter)</sub>\n\n## Python library\n\nYou can use the python library on your own automation scripts\n\n### Installation\n\n```bash\npip install traefik-cert-exporter\n```\n\n### Usage\n\n```python\nfrom traefik_cert_exporter import export_certificates\n\nacme_file = \"./acme.json\"\noutput_dir = \"./certs\"\n\nexport_certificates(acme_file, output_dir)\n```\n\n## CLI\n\nYou can use the included CLI directly from the terminal\n\n### Installation\n\n```bash\npip install traefik-cert-exporter\n```\n\n### Usage\n\n```bash\nexport-certs ./acme.json ./certs\n```\n\n## Docker\n\nThere is also a Docker image that create a cron job that runs the certificate export process on a schedule.\n\nThe 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.\n\nYou can use the docker compose example to create your own environment.\n\nimage: https://hub.docker.com/r/ahuahuachi/traefik-cert-exporter\n\n### Environment Variables\n\n| Variable | Default value | Description |\n| ------------- | ------------------- | ------------------------------------------------- |\n| CRON_SCHEDULE | `0 0 1 * *` | Cron schedule to run the extraction script |\n| STORAGE_FILE | `traefik/acme.json` | Path to the acme storage file |\n| OUTPUT_PATH | `certs/` | Path where the certs are going to be extracted to |\n| ON_START | `1` (true) | Run export scripts once when container starts |\n\n### Docker compose example\n\nTraefik's static configuration file\n\n```yaml\n# static.yaml\ncertificatesResolvers:\n myresolver:\n acme:\n storage: \"/config/acme.json\"\n ...\n```\n\n```yaml\n# docker-compose.yaml\nversion: \"3\"\n\nservices:\n cert-exporter:\n image: ahuahuachi/traefik-cert-exporter:latest\n environment:\n - STORAGE_FILE=\"/config/acme.json\"\n - OUTPUT_PATH=\"/certs\"\n volumes:\n - traefik-config:/config/\n - ./certs:/certs\n\n traefik:\n image: traefik:latest\n volumes:\n - traefik-config:/config/\n ...\n\nvolumes:\n traefik-config:\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "CLI and python library to export Traefik SSL certificates",
"version": "1.0.1",
"project_urls": {
"Documentation": "https://github.com/ahuahuachi/traefik-cert-exporter#readme",
"Issues": "https://github.com/ahuahuachi/traefik-cert-exporter/issues",
"Source": "https://github.com/ahuahuachi/traefik-cert-exporter"
},
"split_keywords": [
"certificate",
" cli",
" export",
" ssl",
" traefik"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "14d1079f6f7e247cdbd8c76b0cb52140c31027a0dc650b27c70d636b1e7814d9",
"md5": "5b8f3472ffd84cbb05f6a5a8113f34fa",
"sha256": "50becc14de56960e89062509776569560b131b91e9d8303b86e0168f6311a7e7"
},
"downloads": -1,
"filename": "traefik_cert_exporter-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5b8f3472ffd84cbb05f6a5a8113f34fa",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 8007,
"upload_time": "2024-07-11T02:18:35",
"upload_time_iso_8601": "2024-07-11T02:18:35.337726Z",
"url": "https://files.pythonhosted.org/packages/14/d1/079f6f7e247cdbd8c76b0cb52140c31027a0dc650b27c70d636b1e7814d9/traefik_cert_exporter-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2ead2342b998aeb5a4a81ebe79d58a30afbe62ecf41856956001c1416f0ea0d3",
"md5": "b8c134c9a3116eeedcaedf592e3cf918",
"sha256": "aea16f586d1945a9b6f07fea082e1b2f87bcba3b3a18ef889391aef3a222dc5a"
},
"downloads": -1,
"filename": "traefik_cert_exporter-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "b8c134c9a3116eeedcaedf592e3cf918",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 17239,
"upload_time": "2024-07-11T02:18:36",
"upload_time_iso_8601": "2024-07-11T02:18:36.971936Z",
"url": "https://files.pythonhosted.org/packages/2e/ad/2342b998aeb5a4a81ebe79d58a30afbe62ecf41856956001c1416f0ea0d3/traefik_cert_exporter-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-11 02:18:36",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ahuahuachi",
"github_project": "traefik-cert-exporter#readme",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "traefik-cert-exporter"
}