aboutsummaryrefslogtreecommitdiffstats
path: root/debian/nginx-config.postinst
blob: 8045a6df813443718cae312fdd1106bd28c4337b (plain) (blame)
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
32
#!/bin/sh
#
# TODO: Handle "$1".

set -eu

#DEBHELPER#

# `certbot` *must* be installed by this package.
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