Environment variables available in /etc/letsencrypt/renewal-hooks scripts

In the documentation I can see the following environment variables are available:

CERTBOT_DOMAIN
CERTBOT_VALIDATION
CERTBOT_TOKEN

I don’t see any others. Are there any? I am specifically looking for something with the certificate name.

1 Like

Those variables only exist in authentication hooks.

The other hook that receives environment variables is the --deploy-hook (which is equivalent to the /renewal-hooks/deploy/ directory):

--deploy-hook DEPLOY_HOOK
Command to be run in a shell once for each
successfully issued certificate. For this command, the
shell variable $RENEWED_LINEAGE will point to the
config live subdirectory (for example,
"/etc/letsencrypt/live/example.com") containing the
new certificates and keys; the shell variable
$RENEWED_DOMAINS will contain a space-delimited list
of renewed certificate domains (for example,
"example.com www.example.com" (default: None)

3 Likes

In that case, you could then get the certificate name with $(basename "$RENEWED_LINEAGE"). :slight_smile:

4 Likes

Thanks to both.

I’ve set up some tests and I’m just waiting for certificate renewal. My OS has a front end which already uses –deploy-hook so I am hoping this variable will pass through their script.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.