Update Certbot well-known auto renew script

This commit is contained in:
Fedor Katurov 2024-03-21 18:22:44 +07:00
parent d1afc3aeef
commit be9db4c395

View file

@ -3,29 +3,38 @@ This is translation of article from [clsv.ru](https://clsv.ru/linux/lets_encrypt
You'll need 4 scripts: You'll need 4 scripts:
1. Authentication script, which will write authentication file: 1. Authentication script, which will write authentication file:
```shell ```shell
#!/bin/bash #!/bin/bash
echo $CERTBOT_VALIDATION > /var/www/html/.well-known/$CERTBOT_TOKEN echo $CERTBOT_VALIDATION > /var/www/html/.well-known/$CERTBOT_TOKEN
``` ```
2. Cleanup script, that will delete that 2. Cleanup script, that will delete that
```shell ```shell
#!/bin/bash #!/bin/bash
rm -f /var/www/html/.well-known/$CERTBOT_TOKEN rm -f /var/www/html/.well-known/$CERTBOT_TOKEN
``` ```
3. Initial cert acquiring script: 3. Initial cert acquiring script:
```shell ```shell
certbot certonly \ certbot certonly \
--preferred-challenges=http --manual \ --preferred-challenges=http --manual \
--manual-auth-hook /path/to/auth.sh \ --manual-auth-hook /path/to/auth.sh \
--manual-cleanup-hook /oath/to/clean.sh --manual-cleanup-hook /oath/to/clean.sh
-d "vault48.org,*.vault48.org" \ -d "yourhost.org,*.yourhost.org" \
--manual-public-ip-logging-ok --manual-public-ip-logging-ok
``` ```
1. Renewal script itself to put it in crontab
4. Renewal script itself, to put it in crontab (or /etc/cron.weekly)
```shell ```shell
certbot renew --manual-public-ip-logging-ok \ certbot renew --manual-public-ip-logging-ok \
--manual-auth-hook /path/to/auth.sh \ --manual-auth-hook /path/to/auth.sh \
--manual-cleanup-hook /path/to/clean.sh --manual-cleanup-hook /path/to/clean.sh
systemctl reload nginx
``` ```
Don't forget to configure your http server to serve `.well-known`. Don't forget to configure your http server to serve `.well-known`.