Lego: [CLI] generate certbot like files

Created on 2 Oct 2020  路  3Comments  路  Source: go-acme/lego

How to use lego CLI to generate

  • fullchain.pem
  • cert.pem
  • chain.pem
  • privkey.pem
arecli aredocumentation help wanted question

Most helpful comment

Executing lego run will look like this:

$ cd .../some/where
$ lego --domains example.com [some options omitted] run

This will create a directory .../some/where/.lego/certificates:

$ ls .lego/certificates
example.com.crt example.com.issuer.crt  example.com.json    example.com.key

where:

  • $domain.crt is the server certificate (including the CA certificate; equivalent to fullchain.pem)
  • $domain.key it the server certificates' private key and key (= privkey.pem),
  • $domain.issuer.crt is only the CA certificate, and
  • $domain.json contains some meta information.

Notes:

  1. The path of the .lego directory can be changed by explicitly adding a --path flag (like lego --path /opt/lego/ ...).
  2. All .crt and the .key file are PEM encoded (they're just text files), the file extension (usually) doesn't matter.

All 3 comments

Executing lego run will look like this:

$ cd .../some/where
$ lego --domains example.com [some options omitted] run

This will create a directory .../some/where/.lego/certificates:

$ ls .lego/certificates
example.com.crt example.com.issuer.crt  example.com.json    example.com.key

where:

  • $domain.crt is the server certificate (including the CA certificate; equivalent to fullchain.pem)
  • $domain.key it the server certificates' private key and key (= privkey.pem),
  • $domain.issuer.crt is only the CA certificate, and
  • $domain.json contains some meta information.

Notes:

  1. The path of the .lego directory can be changed by explicitly adding a --path flag (like lego --path /opt/lego/ ...).
  2. All .crt and the .key file are PEM encoded (they're just text files), the file extension (usually) doesn't matter.

Notes to self:

@mhf-ir: I'm sorry, I've misread the code. Lego actually already writes the full chain to $domain.crt. I've updated my answer above: you don't need to cat domain.issuer.crt domain.crt > domain.fullchain.crt.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

athanp picture athanp  路  3Comments

lenovouser picture lenovouser  路  5Comments

kuuji picture kuuji  路  4Comments

bouwerp picture bouwerp  路  3Comments

onlyjob picture onlyjob  路  3Comments