From 5a8f5c3ab010942013a9fef05c4fad81918cf056 Mon Sep 17 00:00:00 2001 From: Camille Oudot Date: Thu, 29 Oct 2015 15:07:45 +0100 Subject: [PATCH] add possibility to choose rtpengine process user use RE_USER parameter of el/rtpengine.sysconfig --- el/rtpengine.init | 14 ++++++++++++-- el/rtpengine.sysconfig | 2 ++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/el/rtpengine.init b/el/rtpengine.init index 7ab49a33e..70e9f9bf3 100644 --- a/el/rtpengine.init +++ b/el/rtpengine.init @@ -180,7 +180,12 @@ start() { then echo "Loading module for in-kernel packet forwarding" rmmod xt_RTPENGINE 2> /dev/null - modprobe xt_RTPENGINE + if [[ -n "$RE_USER" ]] + then + modprobe xt_RTPENGINE set_proc_id=1 proc_uid=$(id $RE_USER -u) proc_gid=$(id $RE_USER -g) + else + modprobe xt_RTPENGINE + fi temp=`firewall-cmd --state 2>/dev/null` if [[ $? == 0 ]] then @@ -212,7 +217,12 @@ CUR_TABLE=$TABLE EOF fi echo -n $"Starting $prog: " - daemon --pidfile=${pidfile} $rtpengine $OPTS + if [[ -n "$RE_USER" ]] + then + daemon --user $RE_USER --pidfile=${pidfile} $rtpengine $OPTS + else + daemon --pidfile=${pidfile} $rtpengine $OPTS + fi RETVAL=$? echo [ $RETVAL = 0 ] && touch ${lockfile} diff --git a/el/rtpengine.sysconfig b/el/rtpengine.sysconfig index 43c2dfaf8..11a7b276d 100644 --- a/el/rtpengine.sysconfig +++ b/el/rtpengine.sysconfig @@ -40,3 +40,5 @@ LISTEN_UDP=127.0.0.1:2222 # IP address and port combination for UDP #REDIS=127.0.0.1:6379 #REDIS_DB=0 #B2B_URL=http://127.0.0.1:8080/xmlrpc + +#RE_USER=rtpengine # Run rtpengine as this specific user