aboutsummaryrefslogtreecommitdiffstats
path: root/debian
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2024-05-10 14:41:21 +0200
committerOliver Smith <osmith@sysmocom.de>2024-05-10 14:47:27 +0200
commit240b43f3f6316cfb4b92270467d9cb3b5867fa73 (patch)
tree5c187cce15b15542ad907f7e07c01f032f01c016 /debian
parente9c2b1ddaa2cc9eba23e8b2285a6691ba795bdf6 (diff)
contrib/systemd: run as osmocom user
Run the systemd service as osmocom user and group instead of root. Set the StateDirectory and WorkingDirectory like we have it in other Osmocom service files. Remove the ExecStartPre mkdir, as the directory now gets created by postinst. Related: OS#4107 Change-Id: I2c0c7f4b98300b3b0bb5b95013b51b6b60625b95
Diffstat (limited to 'debian')
-rw-r--r--debian/postinst30
1 files changed, 30 insertions, 0 deletions
diff --git a/debian/postinst b/debian/postinst
new file mode 100644
index 0000000..f9f64c8
--- /dev/null
+++ b/debian/postinst
@@ -0,0 +1,30 @@
+#!/bin/sh -e
+case "$1" in
+ configure)
+ # Create the osmocom group and user (if it doesn't exist yet)
+ if ! getent group osmocom >/dev/null; then
+ groupadd --system osmocom
+ fi
+ if ! getent passwd osmocom >/dev/null; then
+ useradd \
+ --system \
+ --gid osmocom \
+ --home-dir /var/lib/osmocom \
+ --shell /sbin/nologin \
+ --comment "Open Source Mobile Communications" \
+ osmocom
+ fi
+
+ # Fix permissions of previous (root-owned) install (OS#4107)
+ chown osmocom:osmocom /etc/osmocom/osmo_dia2gsup.service
+ chmod 0660 /etc/osmocom/osmo_dia2gsup.service
+ chown root:osmocom /etc/osmocom
+ chmod 2775 /etc/osmocom
+ mkdir -p /var/lib/osmo_dia2gsup
+ chown -R osmocom:osmocom /var/lib/osmo_dia2gsup
+ ;;
+esac
+
+# dh_installdeb(1) will replace this with shell code automatically
+# generated by other debhelper scripts.
+#DEBHELPER#