]> git.proxmox.com Git - mirror_frr.git/commitdiff
tools: Enable start of FRR for non-root user
authorMichal Ruprich <michalruprich@gmail.com>
Tue, 22 Nov 2022 11:38:05 +0000 (12:38 +0100)
committerMichal Ruprich <michalruprich@gmail.com>
Wed, 23 Nov 2022 09:19:10 +0000 (10:19 +0100)
There might be use cases when this would make sense, for example
running FRR in a container as a designated user.

Signed-off-by: Michal Ruprich <mruprich@redhat.com>
tools/etc/frr/daemons
tools/frrcommon.sh.in

index 8aa08871e351306b685b78078d7757fd5ec479c1..2427bfff7771fc343f242998f5006e215f5c0084 100644 (file)
@@ -91,6 +91,11 @@ pathd_options="  -A 127.0.0.1"
 #
 #MAX_FDS=1024
 
+# Uncomment this option if you want to run FRR as a non-root user. Note that
+# you should know what you are doing since most of the daemons need root
+# to work. This could be useful if you want to run FRR in a container
+# for instance.
+# FRR_NO_ROOT="yes"
 
 # For any daemon, you can specify a "wrap" command to start instead of starting
 # the daemon directly. This will simply be prepended to the daemon invocation.
index 3c16c27c6dfa135b54f3ab7e25969b32726edc5d..4f095a176e4c6a1af1dc9f9f016484260e91b51d 100755 (executable)
@@ -43,6 +43,10 @@ RELOAD_SCRIPT="$D_PATH/frr-reload.py"
 #
 
 is_user_root () {
+       if [[ ! -z $FRR_NO_ROOT  &&  "${FRR_NO_ROOT}" == "yes" ]]; then
+               return 0
+       fi
+
        [ "${EUID:-$(id -u)}" -eq 0 ] || {
                log_failure_msg "Only users having EUID=0 can start/stop daemons"
                return 1