-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcertificate.sh
More file actions
executable file
·31 lines (26 loc) · 884 Bytes
/
certificate.sh
File metadata and controls
executable file
·31 lines (26 loc) · 884 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env bash
HOST=""
CONTACT_EMAIL=""
while [ -n "$1" ]; do
case "$1" in
--host | -h) HOST="$2" && shift;;
--email | -e) CONTACT_EMAIL="$2" && shift;;
esac
shift
done
if [ -z "${HOST}" ]; then
echo "Please, provide a host to be used with the '--host' argument. Example:"
echo "$ ./certificate.sh --host website.domain.com --email user@website.domain.com"
exit 1
fi
if [ -z "${CONTACT_EMAIL}" ]; then
echo "Please, provide a host to be used with the '--email' argument. Example:"
echo "$ ./certificate.sh --host website.domain.com --email user@website.domain.com"
exit 1
fi
docker run \
-v letsencrypt:/etc/letsencrypt \
-v acme-challenge:/var/www/challenge/.well-known/acme-challenge \
--name certbot \
"certbot/certbot" \
certonly --webroot -w /var/www/challenge -d "${HOST}" -m "${CONTACT_EMAIL}" --agree-tos