mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-sip-connector.git
synced 2025-11-03 13:43:38 +00:00
.deb/.rpm: various fixes related to non-root
* Explicitly chown /var/lib/osmocom to osmocom:osmocom, instead of relying on systemd to do it when the service starts up. This does not work with the systemd versions in debian 10 and almalinux 8. * deb: Use "useradd" instead of the interactive "adduser" perl script from Debian. This makes it consistent with how we do it in rpm, and avoids the dependency on "adduser". * deb: Consistently use tabs through the file, instead of mixing tabs and spaces. * deb: Remove support for the "dpkg-statoverride --list" logic. This seems to be a rather obscure feature to override permissions for certain files or directories, for which it does not seem to be a good idea to make the postinst script less maintainable. Something similar can be achieved by using your own Osmocom config file in a different path with different permissions. Related: OS#4107 Change-Id: Ib129217f6aff713d1d0e7aa831b4b54823e9bade
This commit is contained in:
@@ -76,6 +76,8 @@ chown osmocom:osmocom /etc/osmocom/osmo-sip-connector.cfg
|
|||||||
chmod 0660 /etc/osmocom/osmo-sip-connector.cfg
|
chmod 0660 /etc/osmocom/osmo-sip-connector.cfg
|
||||||
chown root:osmocom /etc/osmocom
|
chown root:osmocom /etc/osmocom
|
||||||
chmod 2775 /etc/osmocom
|
chmod 2775 /etc/osmocom
|
||||||
|
mkdir -p /var/lib/osmocom
|
||||||
|
chown -R osmocom:osmocom /var/lib/osmocom
|
||||||
|
|
||||||
%check
|
%check
|
||||||
make %{?_smp_mflags} check || (find . -name testsuite.log -exec cat {} +)
|
make %{?_smp_mflags} check || (find . -name testsuite.log -exec cat {} +)
|
||||||
|
|||||||
2
debian/control
vendored
2
debian/control
vendored
@@ -17,7 +17,7 @@ Vcs-Browser: https://gitea.osmocom.org/cellular-infrastructure/osmo-sip-connecto
|
|||||||
|
|
||||||
Package: osmo-sip-connector
|
Package: osmo-sip-connector
|
||||||
Architecture: any
|
Architecture: any
|
||||||
Depends: ${shlibs:Depends}, ${misc:Depends}, adduser
|
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||||
Description: MNCC to SIP bridge for osmo-nitb
|
Description: MNCC to SIP bridge for osmo-nitb
|
||||||
Use the osmo-nitb MNCC interface and bridge it to SIP.
|
Use the osmo-nitb MNCC interface and bridge it to SIP.
|
||||||
|
|
||||||
|
|||||||
43
debian/postinst
vendored
43
debian/postinst
vendored
@@ -1,36 +1,27 @@
|
|||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
# Create 'osmocom' user and group (if it doesn't exist yet) and adjust permissions
|
|
||||||
# of directories which are not automatically adjusted by systemd from previous (root-owned)
|
|
||||||
# install.
|
|
||||||
|
|
||||||
# N. B: the user is intentionally NOT removed during package uninstall:
|
|
||||||
# see https://wiki.debian.org/AccountHandlingInMaintainerScripts for reasoning.
|
|
||||||
chperms() {
|
|
||||||
# chperms <user> <group> <perms> <file>
|
|
||||||
if ! OVERRIDE=`dpkg-statoverride --list $4 2>&1`; then
|
|
||||||
if [ -e $4 ]; then
|
|
||||||
chown $1:$2 $4
|
|
||||||
chmod $3 $4
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
configure)
|
configure)
|
||||||
if ! getent passwd osmocom > /dev/null; then
|
# Create the osmocom group and user (if it doesn't exist yet)
|
||||||
adduser --quiet \
|
if ! getent group osmocom >/dev/null; then
|
||||||
|
groupadd --system osmocom
|
||||||
|
fi
|
||||||
|
if ! getent passwd osmocom >/dev/null; then
|
||||||
|
useradd \
|
||||||
--system \
|
--system \
|
||||||
--group \
|
--gid osmocom \
|
||||||
--no-create-home \
|
--home-dir /var/lib/osmocom \
|
||||||
--disabled-password \
|
--shell /sbin/nologin \
|
||||||
--home /var/lib/osmocom \
|
--comment "Open Source Mobile Communications" \
|
||||||
--gecos "Open Source Mobile Communications" \
|
|
||||||
osmocom
|
osmocom
|
||||||
fi
|
fi
|
||||||
# Set permissions according to https://www.debian.org/doc/debian-policy/ch-files.html#s-permissions-owners
|
|
||||||
chperms osmocom osmocom 0660 /etc/osmocom/osmo-sip-connector.cfg
|
|
||||||
chperms root osmocom 2775 /etc/osmocom
|
|
||||||
|
|
||||||
|
# Fix permissions of previous (root-owned) install (OS#4107)
|
||||||
|
chown osmocom:osmocom /etc/osmocom/osmo-sip-connector.cfg
|
||||||
|
chmod 0660 /etc/osmocom/osmo-sip-connector.cfg
|
||||||
|
chown root:osmocom /etc/osmocom
|
||||||
|
chmod 2775 /etc/osmocom
|
||||||
|
mkdir -p /var/lib/osmocom
|
||||||
|
chown -R osmocom:osmocom /var/lib/osmocom
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user