go-acme / lego

Let's Encrypt/ACME client and library written in Go
https://go-acme.github.io/lego/
MIT License
7.44k stars 985 forks source link

Missing and misleading hook environment variables #2158

Closed webcompas closed 2 months ago

webcompas commented 2 months ago

Welcome

What did you expect to see?

Hook scripts are provided with certificate related information using the following environment variables. But some of them are set and contain the respective file path even if the file has not been created:

In addition there should also be an environment variable (e.g. LEGO_ISSUER_CERT_PATH) containing the path to the issuer's certificate if the file has been created.

What did you see instead?

The environment variables should only exist or have a value if the respective file has been created. Otherwise this may be misleading and makes it more complex for the scripts to decide/differentiate how to handle it.

How do you use lego?

Binary

Reproduction steps

Just create or renew a certificate without the mentioned options being set.

Version of lego

lego version 4.16.1 linux/amd64

Logs

LEGO_CERT_PFX_PATH=/etc/lego/lego-test/.lego/certificates/_.crt-ltw.example.com.pfx
LEGO_ACCOUNT_EMAIL=foobar@example.com
LEGO_CERT_PEM_PATH=/etc/lego/lego-test/.lego/certificates/_.crt-ltw.example.com.pem
LEGO_CERT_PATH=/etc/lego/lego-test/.lego/certificates/_.crt-ltw.example.com.crt
LEGO_CERT_KEY_PATH=/etc/lego/lego-test/.lego/certificates/_.crt-ltw.example.com.key
LEGO_CERT_DOMAIN=*.crt-ltw.example.com

Go environment (if applicable)

```console $ go version && go env # paste output here ```
webcompas commented 2 months ago

@ldez What about the path to the issuer's certificate? You closed the issue without any comment or change in this regard.

ldez commented 2 months ago

I was focused on the pfx and pem path, I completely missed the issuer path.

webcompas commented 2 months ago

I was focused on the pfx and pem path, I completely missed the issuer path.

So please re-open the issue to proceed with this part.

ldez commented 2 months ago

It's already fixed: #2164