summaryrefslogtreecommitdiff
path: root/custom/simp_le.nix
diff options
context:
space:
mode:
Diffstat (limited to 'custom/simp_le.nix')
-rw-r--r--custom/simp_le.nix26
1 files changed, 26 insertions, 0 deletions
diff --git a/custom/simp_le.nix b/custom/simp_le.nix
new file mode 100644
index 00000000..686533a6
--- /dev/null
+++ b/custom/simp_le.nix
@@ -0,0 +1,26 @@
1{ stdenv, writeText
2, simp_le
3, eject
4}:
5dir:
6domain:
7
8let
9 script = writeText "${domain}.sh" ''
10 backupDir=/root/ssl_archive/$(date +'%Y-%m-%d')-$$-${domain}
11 mkdir -p ${dir}
12 cd ${dir}
13 mkdir -p $backupDir
14 for f in account_key.json cert.pem fullchain.pem key.pem privkey.pem; do
15 [[ -e $f ]] && mv $f $backupDir
16 done
17 ${simp_le}/bin/simp_le -d ${domain}:/srv/www/acme/${domain}/ \
18 --email "phikeebaogobaegh@141.li" \
19 -f account_key.json \
20 -f cert.pem \
21 -f fullchain.pem \
22 -f key.pem || { for f in *; do rm $f; done; mv $backupDir/* . && rmdir $backupDir; }
23 [[ -e key.pem ]] && ln -s -f key.pem privkey.pem
24 '';
25in
26 "bash ${script} 2>&1 | ${eject}/bin/logger -p auth.info"