| 1 | 1 |
new file mode 100755 |
| ... | ... |
@@ -0,0 +1,47 @@ |
| 1 |
+#!/bin/sh |
|
| 2 |
+set -euC |
|
| 3 |
+ |
|
| 4 |
+# nfsn-dns-certbot DOMAIN NAME EMAIL_NAME INSTALLER [CERTBOT_ARG]... |
|
| 5 |
+ |
|
| 6 |
+# nfsn-dns-certbot "example.com" "" "" "" |
|
| 7 |
+# nfsn-dns-certbot "example.com" "git" "" "apache" --quiet |
|
| 8 |
+ |
|
| 9 |
+# Arguments. |
|
| 10 |
+ |
|
| 11 |
+domain="$1" ; shift |
|
| 12 |
+name="$1" ; shift |
|
| 13 |
+email_name="${1:-"hostmaster"}" ; shift
|
|
| 14 |
+installer="${1:-}" ; shift
|
|
| 15 |
+ |
|
| 16 |
+# Certbot. |
|
| 17 |
+ |
|
| 18 |
+host="${name:+"$name."}$domain"
|
|
| 19 |
+dir="$(cd "$(dirname "$0")" ; pwd)" |
|
| 20 |
+ |
|
| 21 |
+certbot certonly \ |
|
| 22 |
+ --non-interactive \ |
|
| 23 |
+ --email "$email_name@$host" \ |
|
| 24 |
+ --agree-tos \ |
|
| 25 |
+ --manual \ |
|
| 26 |
+ --manual-public-ip-logging-ok \ |
|
| 27 |
+ --manual-auth-hook "$dir/nfsn-dns-certbot-auth" \ |
|
| 28 |
+ --manual-cleanup-hook "$dir/nfsn-dns-certbot-cleanup" \ |
|
| 29 |
+ --preferred-challenges="dns" \ |
|
| 30 |
+ --domains "$host" \ |
|
| 31 |
+ "$@" |
|
| 32 |
+ |
|
| 33 |
+if [ -n "$installer" ] |
|
| 34 |
+then |
|
| 35 |
+ certbot install \ |
|
| 36 |
+ --cert-name "$host" \ |
|
| 37 |
+ --installer "$installer" \ |
|
| 38 |
+ |
|
| 39 |
+ certbot enhance \ |
|
| 40 |
+ --non-interactive \ |
|
| 41 |
+ --cert-name "$host" \ |
|
| 42 |
+ --domain "$host" \ |
|
| 43 |
+ --installer "$installer" \ |
|
| 44 |
+ --redirect \ |
|
| 45 |
+ --hsts \ |
|
| 46 |
+ --uir |
|
| 47 |
+fi |