]> git.sur5r.net Git - bacula/bacula/commitdiff
Use start-stop-daemon handler to run daemons as bacula:bacula
authorEric Bollengier <eric@eb.homelinux.org>
Wed, 6 Oct 2010 15:57:10 +0000 (17:57 +0200)
committerEric Bollengier <eric@eb.homelinux.org>
Wed, 6 Oct 2010 15:58:57 +0000 (17:58 +0200)
When the program is started as root, and we call setuid/setgid,
we can no longer call ptrace to get some backtrace.

Using debian/ubuntu start-stop-daemon permits to run directly the
director/sd as bacula:bacula.

bacula/platforms/debian/bacula-dir.in
bacula/platforms/debian/bacula-fd.in
bacula/platforms/debian/bacula-sd.in
bacula/platforms/ubuntu/bacula-dir.in
bacula/platforms/ubuntu/bacula-fd.in
bacula/platforms/ubuntu/bacula-sd.in

index 1ad675c96341bd24edd6cec4454523265e9cf5a0..5764f8d214503a8fd130a648b39142c6d10cdb79 100644 (file)
@@ -24,7 +24,7 @@ DESC="@BACULA@ Director"
 DAEMON=@sbindir@/${NAME}
 BUSER=@dir_user@
 BGROUP=@dir_group@
-BOPTIONS="-c @sysconfdir@/${NAME}.conf"
+USERGRP="-c @sysconfdir@/${NAME}.conf"
 BPORT=@dir_port@
 
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
@@ -38,22 +38,22 @@ fi
 PIDFILE=@piddir@/${NAME}.${BPORT}.pid
 
 if [ "x${BUSER}" != "x" ]; then
-   BOPTIONS="${BOPTIONS} -u ${BUSER}"
-fi
-if [ "x${BGROUP}" != "x" ]; then
-   BOPTIONS="${BOPTIONS} -g ${BGROUP}"
+   USERGRP="--chuid ${BUSER}"
+   if [ "x${BGROUP}" != "x" ]; then
+      USERGRP="${BOPTIONS}:${BGROUP}"
+   fi
 fi
 
 case "$1" in
    start)
       echo -n "Starting ${DESC}: "
-      start-stop-daemon --start --quiet --pidfile ${PIDFILE} --exec ${DAEMON} -- ${BOPTIONS}
+      start-stop-daemon --start --quiet --pidfile ${PIDFILE} ${USERGRP} --exec ${DAEMON}
       RETVAL=$?
       echo "${NAME}"
       ;;
    stop)
       echo -n "Stopping ${DESC}: "
-      start-stop-daemon --oknodo --stop --quiet --exec ${DAEMON} -- ${BOPTIONS}
+      start-stop-daemon --oknodo --stop --quiet ${USERGRP} --exec ${DAEMON} 
       RETVAL=$?
       echo "${NAME}"
       ;;
index 100e6a6817be3408e434d5306bc6e214c35217d9..8f81442337cf67540b8d3cfe781b98e13232e818 100644 (file)
@@ -24,7 +24,7 @@ DESC="@BACULA@ File Daemon"
 DAEMON=@sbindir@/${NAME}
 BUSER=@fd_user@
 BGROUP=@fd_group@
-BOPTIONS="-c @sysconfdir@/${NAME}.conf"
+USERGRP="-c @sysconfdir@/${NAME}.conf"
 BPORT=@fd_port@
 
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
@@ -38,22 +38,22 @@ fi
 PIDFILE=@piddir@/${NAME}.${BPORT}.pid
 
 if [ "x${BUSER}" != "x" ]; then
-   BOPTIONS="${BOPTIONS} -u ${BUSER}"
-fi
-if [ "x${BGROUP}" != "x" ]; then
-   BOPTIONS="${BOPTIONS} -g ${BGROUP}"
+   USERGRP="--chuid ${BUSER}"
+   if [ "x${BGROUP}" != "x" ]; then
+      USERGRP="${BOPTIONS}:${BGROUP}"
+   fi
 fi
 
 case "$1" in
    start)
       echo -n "Starting ${DESC}: "
-      start-stop-daemon --start --quiet --pidfile ${PIDFILE} --exec ${DAEMON} -- ${BOPTIONS}
+      start-stop-daemon --start --quiet --pidfile ${PIDFILE} ${USERGRP} --exec ${DAEMON} 
       RETVAL=$?
       echo "${NAME}"
       ;;
    stop)
       echo -n "Stopping ${DESC}: "
-      start-stop-daemon --oknodo --stop --quiet --exec ${DAEMON} -- ${BOPTIONS}
+      start-stop-daemon --oknodo --stop --quiet ${USERGRP} --exec ${DAEMON} 
       RETVAL=$?
       echo "${NAME}"
       ;;
index 62aa4c4d2fea0730af976deb337e8a454978ab62..0f2ab9b5f69e60a8254478291bed0c4749f38188 100644 (file)
@@ -24,7 +24,7 @@ DESC="@BACULA@ Storage Daemon"
 DAEMON=@sbindir@/${NAME}
 BUSER=@sd_user@
 BGROUP=@sd_group@
-BOPTIONS="-c @sysconfdir@/${NAME}.conf"
+USERGRP="-c @sysconfdir@/${NAME}.conf"
 BPORT=@sd_port@
 
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
@@ -38,22 +38,22 @@ fi
 PIDFILE=@piddir@/${NAME}.${BPORT}.pid
 
 if [ "x${BUSER}" != "x" ]; then
-   BOPTIONS="${BOPTIONS} -u ${BUSER}"
-fi
-if [ "x${BGROUP}" != "x" ]; then
-   BOPTIONS="${BOPTIONS} -g ${BGROUP}"
+   USERGRP="--chuid ${BUSER}"
+   if [ "x${BGROUP}" != "x" ]; then
+      USERGRP="${BOPTIONS}:${BGROUP}"
+   fi
 fi
 
 case "$1" in
    start)
       echo -n "Starting ${DESC}: "
-      start-stop-daemon --start --quiet --pidfile ${PIDFILE} --exec ${DAEMON} -- ${BOPTIONS}
+      start-stop-daemon --start --quiet --pidfile ${PIDFILE} ${USERGRP} --exec ${DAEMON} 
       RETVAL=$?
       echo "${NAME}"
       ;;
    stop)
       echo -n "Stopping ${DESC}: "
-      start-stop-daemon --oknodo --stop --quiet --exec ${DAEMON} -- ${BOPTIONS}
+      start-stop-daemon --oknodo --stop --quiet ${USERGRP}  --exec ${DAEMON}
       RETVAL=$?
       echo "${NAME}"
       ;;
index d4bbc404c5bb7c01cacf222599383f52eed654eb..5c9ac5f40be14b8fa4fe4e06edea48fac94d2975 100644 (file)
@@ -25,7 +25,7 @@ DESC="Bacula Director"
 DAEMON=@sbindir@/${NAME}
 BUSER=@dir_user@
 BGROUP=@dir_group@
-BOPTIONS="-c @sysconfdir@/${NAME}.conf"
+USERGRP="-c @sysconfdir@/${NAME}.conf"
 BPORT=@dir_port@
 
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
@@ -46,22 +46,22 @@ mkdir -p @piddir@
 PIDFILE=@piddir@/${NAME}.${BPORT}.pid
 
 if [ "x${BUSER}" != "x" ]; then
-   BOPTIONS="${BOPTIONS} -u ${BUSER}"
-fi
-if [ "x${BGROUP}" != "x" ]; then
-   BOPTIONS="${BOPTIONS} -g ${BGROUP}"
+   USERGRP="--chuid ${BUSER}"
+   if [ "x${BGROUP}" != "x" ]; then
+      USERGRP="${BOPTIONS}:${BGROUP}"
+   fi
 fi
 
 case "$1" in
    start)
       echo -n "Starting ${DESC}: "
-      start-stop-daemon --start --quiet --pidfile ${PIDFILE} --exec ${DAEMON} -- ${BOPTIONS}
+      start-stop-daemon --start --quiet --pidfile ${PIDFILE} ${USERGRP} --exec ${DAEMON} 
       RETVAL=$?
       echo "${NAME}"
       ;;
    stop)
       echo -n "Stopping ${DESC}: "
-      start-stop-daemon --oknodo --stop --quiet --exec ${DAEMON} -- ${BOPTIONS}
+      start-stop-daemon --oknodo --stop --quiet --exec ${DAEMON} ${USERGRP}
       RETVAL=$?
       echo "${NAME}"
       ;;
index 17d3d04dbbbea2243e3cfd6f7b9cd0d586fb5bf4..1f260c7a104d35e4ad0f3b6870f34bc505a7e09c 100644 (file)
@@ -25,7 +25,7 @@ DESC="Bacula File Daemon"
 DAEMON=@sbindir@/${NAME}
 BUSER=@fd_user@
 BGROUP=@fd_group@
-BOPTIONS="-c @sysconfdir@/${NAME}.conf"
+USERGRP="-c @sysconfdir@/${NAME}.conf"
 BPORT=@fd_port@
 
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
@@ -46,22 +46,22 @@ mkdir -p @piddir@
 PIDFILE=@piddir@/${NAME}.${BPORT}.pid
 
 if [ "x${BUSER}" != "x" ]; then
-   BOPTIONS="${BOPTIONS} -u ${BUSER}"
-fi
-if [ "x${BGROUP}" != "x" ]; then
-   BOPTIONS="${BOPTIONS} -g ${BGROUP}"
+   USERGRP="--chuid ${BUSER}"
+   if [ "x${BGROUP}" != "x" ]; then
+      USERGRP="${BOPTIONS}:${BGROUP}"
+   fi
 fi
 
 case "$1" in
    start)
       echo -n "Starting ${DESC}: "
-      start-stop-daemon --start --quiet --pidfile ${PIDFILE} --exec ${DAEMON} -- ${BOPTIONS}
+      start-stop-daemon --start --quiet --pidfile ${PIDFILE} ${USERGRP} --exec ${DAEMON}
       RETVAL=$?
       echo "${NAME}"
       ;;
    stop)
       echo -n "Stopping ${DESC}: "
-      start-stop-daemon --oknodo --stop --quiet --exec ${DAEMON} -- ${BOPTIONS}
+      start-stop-daemon --oknodo --stop --quiet ${USERGRP} --exec ${DAEMON} 
       RETVAL=$?
       echo "${NAME}"
       ;;
index e8c5e6c7317f48ea97ecb962d471783ce4174ea7..ff1de0a7b7236fda4dfd503ff29cb921088c4488 100644 (file)
@@ -25,7 +25,7 @@ DESC="Bacula Storage Daemon"
 DAEMON=@sbindir@/${NAME}
 BUSER=@sd_user@
 BGROUP=@sd_group@
-BOPTIONS="-c @sysconfdir@/${NAME}.conf"
+USERGRP="-c @sysconfdir@/${NAME}.conf"
 BPORT=@sd_port@
 
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
@@ -46,22 +46,22 @@ mkdir -p @piddir@
 PIDFILE=@piddir@/${NAME}.${BPORT}.pid
 
 if [ "x${BUSER}" != "x" ]; then
-   BOPTIONS="${BOPTIONS} -u ${BUSER}"
-fi
-if [ "x${BGROUP}" != "x" ]; then
-   BOPTIONS="${BOPTIONS} -g ${BGROUP}"
+   USERGRP="--chuid ${BUSER}"
+   if [ "x${BGROUP}" != "x" ]; then
+      USERGRP="${BOPTIONS}:${BGROUP}"
+   fi
 fi
 
 case "$1" in
    start)
       echo -n "Starting ${DESC}: "
-      start-stop-daemon --start --quiet --pidfile ${PIDFILE} --exec ${DAEMON} -- ${BOPTIONS}
+      start-stop-daemon --start --quiet --pidfile ${PIDFILE} ${USERGRP} --exec ${DAEMON}
       RETVAL=$?
       echo "${NAME}"
       ;;
    stop)
       echo -n "Stopping ${DESC}: "
-      start-stop-daemon --oknodo --stop --quiet --exec ${DAEMON} -- ${BOPTIONS}
+      start-stop-daemon --oknodo --stop --quiet ${USERGRP} --exec ${DAEMON} 
       RETVAL=$?
       echo "${NAME}"
       ;;