server, service: added running as effective user

This commit is contained in:
2026-03-25 16:53:13 +02:00
parent 1f5b4a71f1
commit 5e7b1f312d
16 changed files with 361 additions and 144 deletions
Vendored
+65 -2
View File
@@ -608,6 +608,8 @@ PACKAGE_URL=''
ac_default_prefix=/usr/local
ac_subst_vars='LTLIBOBJS
LIBOBJS
srv_bindir
srv_sbindir
srv_datadir
srv_libdir
srv_sharedir
@@ -615,6 +617,8 @@ srv_rundir
srv_logdir
srv_confdir
srv_devel_mode
run_user
RUN_USER
SYSTEMD_FALSE
SYSTEMD_TRUE
LINUX_OS_FALSE
@@ -720,6 +724,7 @@ ac_subst_files=''
ac_user_opts='
enable_option_checking
enable_silent_rules
with_user
enable_devel_mode
with_confdir
with_logdir
@@ -1365,6 +1370,7 @@ Optional Features:
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-user=${PACKAGE} set executing user name
--with-confdir=PATH set configuration dir to PATH (default:
$SRV_CONFDIR)
--with-logdir=PATH set path for logdir (default: $SRV_LOGDIR)
@@ -3663,6 +3669,59 @@ test "x$prefix" == "xNONE" && prefix=$ac_default_prefix
test "x$libexecdir" == "xNONE" && libexecdir=${prefix}/lib
case $host_os in
*freebsd* )
default_user="daemon"
default_group="daemon"
;;
*linux* )
default_user="daemon"
default_group="daemon"
;;
esac
# Check whether --with-user was given.
if test ${with_user+y}
then :
withval=$with_user; if test ! -z "$with_user" ; then
case $with_user in
"")
as_fn_error $? "You must specify user name" "$LINENO" 5
;;
*)
RUN_USER="$with_user"
;;
esac
else
RUN_USER="$default_user"
fi
else case e in #(
e) RUN_USER="$default_user" ;;
esac
fi
if test "x$enable_devel_mode" = "xyes"
then :
RUN_USER="`id -un`"
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: run_user set as ${RUN_USER}" >&5
printf "%s\n" "$as_me: run_user set as ${RUN_USER}" >&6;}
printf "%s\n" "#define RUN_USER \"$RUN_USER\"" >>confdefs.h
RUN_USER="$RUN_USER"
printf "%s\n" "#define run_user \"$RUN_USER\"" >>confdefs.h
run_user="$RUN_USER"
# Check whether --enable-devel-mode was given.
if test ${enable_devel_mode+y}
@@ -3706,7 +3765,6 @@ then :
fi
if test "x$enable_devel_mode" = "xyes"
then :
@@ -3914,9 +3972,13 @@ srv_datadir="$SRV_DATADIR"
printf "%s\n" "$as_me: srv_datadir set as ${SRV_DATADIR}" >&6;}
srv_sbindir="${prefix}/sbin"
srv_bindir="${prefix}/bin"
ac_config_files="$ac_config_files Makefile app/config/variant.go initrc/minilbd.service debian/control debian/changelog"
ac_config_files="$ac_config_files Makefile app/config/variant.go initrc/minilbd.service initrc/minilbd debian/control debian/changelog"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -4670,6 +4732,7 @@ do
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"app/config/variant.go") CONFIG_FILES="$CONFIG_FILES app/config/variant.go" ;;
"initrc/minilbd.service") CONFIG_FILES="$CONFIG_FILES initrc/minilbd.service" ;;
"initrc/minilbd") CONFIG_FILES="$CONFIG_FILES initrc/minilbd" ;;
"debian/control") CONFIG_FILES="$CONFIG_FILES debian/control" ;;
"debian/changelog") CONFIG_FILES="$CONFIG_FILES debian/changelog" ;;