aboutsummaryrefslogtreecommitdiffstats
path: root/debian/nginx-config.postinst
diff options
context:
space:
mode:
Diffstat (limited to 'debian/nginx-config.postinst')
-rw-r--r--debian/nginx-config.postinst32
1 files changed, 21 insertions, 11 deletions
diff --git a/debian/nginx-config.postinst b/debian/nginx-config.postinst
index 92449c8..8045a6d 100644
--- a/debian/nginx-config.postinst
+++ b/debian/nginx-config.postinst
@@ -2,21 +2,31 @@
#
# TODO: Handle "$1".
-set -e
+set -eu
#DEBHELPER#
# `certbot` *must* be installed by this package.
-certbot \
- --nginx \
- --agree-tos \
- --redirect \
- --hsts \
- --staple-ocsp \
- --email renken+letsencrypt@shione.net \
- -d shione.net \
- -d www.shione.net \
- -d git.shione.net
+if [ "$(hostname)" = shione ]; then
+ certbot \
+ --agree-tos \
+ --email renken+letsencrypt@shione.net \
+ -d shione.net \
+ -d www.shione.net \
+ -d git.shione.net
+else
+ out=/etc/letsencrypt/live/shione.net
+
+ mkdir -p -- "$out"
+ openssl genrsa \
+ >"$out"/privkey.pem
+ openssl req \
+ -new \
+ -x509 \
+ -key /etc/letsencrypt/live/shione.net/privkey.pem \
+ -subj '/CN=shione.net/O=shione.net./C=FR' \
+ >/etc/letsencrypt/live/shione.net/fullchain.pem
+fi
# Apply new nginx configuration.
deb-systemd-invoke restart nginx