summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorVarac <varac@leap.se>2017-06-28 18:45:06 +0200
committerVarac <varac@leap.se>2017-06-28 18:45:11 +0200
commitdae33366b076bede7fa4657c5cf3b0726dbe428b (patch)
tree5c7a451a21c393773414c960c965cb082928e8e6 /pkg
parentb5728b0e4ef9810c76db246e322fab11de153784 (diff)
[pkg] Add missing soledad-server.postinst
Diffstat (limited to 'pkg')
-rw-r--r--pkg/server/soledad-server.postinst34
1 files changed, 34 insertions, 0 deletions
diff --git a/pkg/server/soledad-server.postinst b/pkg/server/soledad-server.postinst
new file mode 100644
index 00000000..44112fc7
--- /dev/null
+++ b/pkg/server/soledad-server.postinst
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+export PATH=/bin:/usr/bin:/sbin:/usr/sbin
+
+# create soledad group
+getent group soledad > /dev/null
+RET=$?
+
+if [ ! $RET -eq 0 ]; then
+ addgroup --system soledad
+fi
+
+# create soledad user
+id soledad > /dev/null 2>&1
+RET=$?
+
+if [ ! $RET -eq 0 ]; then
+ adduser --system soledad --no-create-home --home /srv/leap/ --ingroup soledad
+fi
+
+# allow soledad user to read ssl certificates
+usermod -aG ssl-cert soledad
+
+# create soledad-admin user
+id soledad-admin > /dev/null 2>&1
+RET=$?
+
+if [ ! $RET -eq 0 ]; then
+ adduser --system soledad-admin --no-create-home --home /srv/leap/ --ingroup soledad
+fi
+
+# update systemd and start service
+systemctl --system daemon-reload >/dev/null || true
+deb-systemd-invoke start soledad-server.service >/dev/null || true