diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2016-02-26 01:28:56 +0000 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2016-02-26 01:28:56 +0000 |
commit | 65254feece79f3d1b5859c9220c8f5ba10ba28dd (patch) | |
tree | 3509f0c1a12e8ad008d407a7d8cbad3149587643 /custom/simp_le.nix | |
parent | c05c42df458d21a75b970c6ef18071f061857f99 (diff) | |
parent | b848cdd2e63781c4cd01518ebec7e9bf81ce7781 (diff) | |
download | nixos-65254feece79f3d1b5859c9220c8f5ba10ba28dd.tar nixos-65254feece79f3d1b5859c9220c8f5ba10ba28dd.tar.gz nixos-65254feece79f3d1b5859c9220c8f5ba10ba28dd.tar.bz2 nixos-65254feece79f3d1b5859c9220c8f5ba10ba28dd.tar.xz nixos-65254feece79f3d1b5859c9220c8f5ba10ba28dd.zip |
Merge branch 'master' of git.yggdrasil.li:nixos
Diffstat (limited to 'custom/simp_le.nix')
-rw-r--r-- | custom/simp_le.nix | 26 |
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 | }: | ||
5 | dir: | ||
6 | domain: | ||
7 | |||
8 | let | ||
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 | ''; | ||
25 | in | ||
26 | "bash ${script} 2>&1 | ${eject}/bin/logger -p auth.info" | ||