guides/system_administration/certbot-cron/README.md
2023-10-30 13:35:03 -06:00

29 lines
853 B
Markdown

# Script for automating certbot on the background
```shell
#!/bin/sh
# Add the domains for which you need an ssl cert
set -- example.org sub.example.org mail.example.org
# Specify argunments for certbot
CERTBOT_OPTS="certonly --standalone --register-unsafely-without-email --agree-tos"
for i in "$@"; do
certbot -d $i "$CERTBOT_OPTS"
# The following commands move certs to a preconfigured ejabberd
# directory, ignore if not using ejabberd.
#mkdir -p /etc/ejabberd/certs/$i
#cp /etc/letsencrypt/live/$i/fullchain.pem /etc/ejabberd/certs/$i
#cp /etc/letsencrypt/live/$i/privkey.pem /etc/ejabberd/certs/$i
done
```
# Or run as one command
``` shell
set -- example.org sub.example.org mail.example.org
```
``` shell
for i in "$@"; do certbot -d $i certonly --standalone --register-unsafely-without-email --agree-tos; done
```