Back to TILs

Certbot Hooks

Date: 2020-06-29Last modified: 2023-02-17

Exemplo

Exemplos retirados de How to Install and Secure the Mosquitto MQTT Messaging Broker on Debian 8.

O certbot utiliza as portas 80 (HTTP) e 443 (HTTPS).

Vamos usar apenas a porta 80.

sudo ufw allow http
sudo certbot certonly --standalone --standalone-supported-challenges http-01 -d mqtt.example.com
crontab -e
15 3 * * * certbot renew --noninteractive --post-hook "systemctl restart mosquitto"

Opções

--pre-hook PRE_HOOK

Comando a ser executado antes de obter um certificado. Se existirem vários hooks iguais somente um será executado.

--post-hook POST_HOOK

Comando a ser executado depois da tentativa de obter ou renovar o certificado. Se existirem vários hooks iguais somente um será executado.

--deploy-hook DEPLOY_HOOK

Comando a ser executado uma vez para cada certificado emitido. São passados as seguintes variáveis para o shell:

--disable-hook-validation

Manual: Ordinarily the commands specified for --pre- hook/–post-hook/–deploy-hook will be checked for validity, to see if the programs being run are in the $PATH, so that mistakes can be caught early, even when the hooks aren’t being run just yet. The validation is rather simplistic and fails if you use more advanced shell constructs, so you can use this switch to disable it. (default: False)

--no-directory-hooks

Manual: Disable running executables found in Certbot’s hook directories during renewal. (default: False)

Referências