Make rdcd run as user "rdc"

The rdc account will be created on installation if it does
not already exist. It will be a system account with no
home directory.

rdcd will be started as a systemd service, but change to
user "rdc". The rdc user will drop all priviliges except
CAP_DAC_OVERRIDE, permitted. This means the default mode
will have no special privileges, but have the ability to
gain write access (e.g., to sysfs) when needed.

rdc tests were being inadvertantly added to the
installation. This was adversely impacting the new
functionality, so it was corrected in this commit.

Also included are a few small formatting changes.

Change-Id: I9c6bb132fee28119fd3960594dfb97bd2e7b282a
Cette révision appartient à :
Chris Freehill
2020-01-27 19:08:09 -06:00
Parent 4729c47866
révision 5cc498c6aa
17 fichiers modifiés avec 303 ajouts et 112 suppressions
Fichier exécutable
+33
Voir le fichier
@@ -0,0 +1,33 @@
#/bin/bash
RDC_LIB_DIR=@RDC_CLIENT_ROOT_PATH@rdc/lib
# This will return 0 if an id is created and non-zero if
# it already exists
do_create_rdc_user() {
useradd -r -s /bin/nologin rdc
}
# librdc_client.so
do_ldconfig() {
echo $RDC_LIB_DIR > /etc/ld.so.conf.d/x86_64-librdc_client.conf && ldconfig
do_create_rdc_user
# Make sure this doesn't return non-zero if an id already exists
return 0
}
case "$1" in
configure)
do_ldconfig
exit 0
;;
abort-upgrade|abort-remove|abort-deconfigure)
echo "$1"
;;
*)
exit 0
;;
esac
Fichier exécutable
+10
Voir le fichier
@@ -0,0 +1,10 @@
#!/bin/bash
RDC_LIB_DIR=@RDC_CLIENT_ROOT_PATH@/rdc/lib
do_create_rdc_user() {
useradd -r -s /bin/nologin rdc
}
do_create_rpc_user
echo -e "${RDC_LIB_DIR}\n${RDC_LIB_DIR}64" > /etc/ld.so.conf.d/x86_64-librdc_client.conf && ldconfig