aboutsummaryrefslogtreecommitdiffstats
path: root/roles/space_server/files/radius/bootstrap
diff options
context:
space:
mode:
authorEmil Renner Berthing <esmil@labitat.dk>2021-01-19 21:58:10 +0100
committerEmil Renner Berthing <esmil@labitat.dk>2021-01-19 22:39:39 +0100
commitd43cdbc412d6548447d3d4c6238fc56c99e09d98 (patch)
tree8f5d9b7eabc3dfffaaa7be0088bae08777146aeb /roles/space_server/files/radius/bootstrap
parent3da205a190c0b6f36a726d90afa4dc303ee84ffe (diff)
downloadlabitat-ansible-d43cdbc412d6548447d3d4c6238fc56c99e09d98.tar.gz
labitat-ansible-d43cdbc412d6548447d3d4c6238fc56c99e09d98.tar.xz
labitat-ansible-d43cdbc412d6548447d3d4c6238fc56c99e09d98.zip
space_server: radius: use letsencrypt certificate
Diffstat (limited to 'roles/space_server/files/radius/bootstrap')
-rwxr-xr-xroles/space_server/files/radius/bootstrap28
1 files changed, 28 insertions, 0 deletions
diff --git a/roles/space_server/files/radius/bootstrap b/roles/space_server/files/radius/bootstrap
new file mode 100755
index 0000000..376aa78
--- /dev/null
+++ b/roles/space_server/files/radius/bootstrap
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+set -e
+
+certname=space.labitat.dk
+privkey="/etc/letsencrypt/live/$certname/privkey.pem"
+fullchain="/etc/letsencrypt/live/$certname/fullchain.pem"
+
+umask 027
+cd "$(dirname $0)"
+
+if [ ! -f dh ]; then
+ openssl dhparam -out dh 2048
+ chown root:radiusd dh
+ chmod 640 dh
+fi
+
+if ! diff -q "$privkey" privkey.pem >/dev/null 2>&1; then
+ install -m640 -o root -g radiusd "$privkey" privkey.pem
+fi
+
+if ! diff -q "$fullchain" fullchain.pem >/dev/null 2>&1; then
+ install -m640 -o root -g radiusd "$fullchain" fullchain.pem
+fi
+
+openssl verify -untrusted fullchain.pem fullchain.pem
+
+# vim: set ts=2 sw=2 et: