Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ACME file format description #1012

Closed
Vad1mo opened this issue Jan 2, 2017 · 7 comments
Closed

ACME file format description #1012

Vad1mo opened this issue Jan 2, 2017 · 7 comments

Comments

@Vad1mo
Copy link

Vad1mo commented Jan 2, 2017

What version of Traefik are you using (traefik version)?

1.1.2

What is your environment & configuration (arguments, toml...)?

I need to get the private key to sign a token in a downstream service. I need to get the private key in the .pem format or convert it into this format.

What is the format of the acme.json private keys?
Why are there 2 private keys?
Is there a way to get a key in the pem format?

@Vad1mo
Copy link
Author

Vad1mo commented Jan 5, 2017

I am still trying to figure out the format of the private key. I need to use the key in another service to encrypt the token.

Does maybe traefik offer an option store the keys as files in pem format?

@farodin91
Copy link

farodin91 commented Jan 20, 2017

I would like traefik automatic generate pem files after updating acme.json.

What is the format of the acme.json private keys?
All keys are base64 encode, after encoding the keys are in default pem format.
Why are there 2 private keys?
Their are two types of private keys.

  • One for your account at letsencrypt based on your email address
  • One for each domain.
    Is there a way to get a key in the pem format?
    See my first answer.

Shell script to get the pem files.

cat acme/acme.json | head -n {line} | tail -n 1 | cut -d ":" -f 2 | cut -d "\"" -f 2 | base64 --decode > certs/private.pem
cat acme/acme.json | head -n {line} | tail -n 1 | cut -d ":" -f 2 | cut -d "\"" -f 2 | base64 --decode > certs/certificate.pem

@Vad1mo Vad1mo closed this as completed Feb 9, 2017
@brianredbeard
Copy link
Contributor

To make this a more stable process, I just submitted a PR for a script to /contrib:

#1484 - contrib: Dump keys/certs from acme.json to files

@ldez ldez added the area/acme label Jun 11, 2017
@kachkaev
Copy link
Contributor

I'm also wondering how to get a folder with Let’s Encrypt certs so that the they could be reused inside the services (gitlab and docker-mailserver in particular). These services are declared with docker-compose.yml, which has something like this:

services:
  gitlab:
    #...
    volumes:
      #...
      - 'certs:/etc/gitlab/ssl'

volumes:
  certs:
    external:
      name: acme_certs

In my current setup, a global docker volume called acme_certs corresponds to a folder that nginx-proxy with docker-letsencrypt-nginx-proxy-companion have provided; it contains a bunch of files and subfolders for all verified Let’s Encrypt domain names.

@brianredbeard is your PR generating such a folder? If yes, how can I tell traefik to always keep it up-to-date so that I could use it as a volume for my other dockerized services?

@flesser
Copy link

flesser commented Feb 28, 2018

@kachkaev See #2418 (comment) for a (hacky) solution to create such volume from acme.json

@tompson
Copy link
Contributor

tompson commented Apr 27, 2018

Is there a way to to the opposite? I want to migrate from nginx to traefik and I want to import the existing PEM files from Letsencrypt into the acme.json file

@bswinnerton
Copy link

@tompson: it looks like it's just a base64 encoding of the .pems. If you have an existing acme.json file, you could do something like this:

base64 /path/to/cert.pem | tr -d '\n'
base64 /path/to/key.pem | tr -d '\n'

And then pate those value into the relevant sections below (Certificate and Key) respectively:

"Certificates": [
  {
    "Domain": {
      "Main": "",
      "SANs": null
    },
    "Certificate": "",
    "Key": ""
  }
]

@traefik traefik locked and limited conversation to collaborators Sep 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants