I have to 'chattr +i /etc/init.d/asterisk' for new updates
don´t change it ...
and if you instead
* chkconfig asterisk off
* create a native systemd-unit
* systemctl enable asterisk.service
you are clean and done
running here since F15 in 2011
[root@asterisk:~]$ cat /etc/systemd/system/asterisk.service
[Unit]
Description=asterisk
After=network.target
Before=hylafax.service iaxmodem.service
[Service]
Type=forking
ExecStart=/usr/sbin/asterisk
User=asterisk
Group=asterisk
Restart=always
RestartSec=2
[Install]
WantedBy=multi-user.target
Am 27.02.2013 15:59, schrieb Alexandre Correa:
This bug can compromise a server. Always asterisk run as
'root', even changing variables in /etc/sysconfig/asterisk
... below, the diff from init script:
--- asterisk;50fdeddb 2013-01-21 23:39:41.894337146 -0200
+++ asterisk 2013-01-03 14:34:12.393338897 -0200
@@ -53,7 +53,7 @@
# group, set AST_GROUP to the group that Asterisk should run as. Note
# that this may break DAHDI devices as supplementary groups will not
# be initialized.
-#AST_GROUP="asterisk"
+AST_GROUP="asterisk"
# Allow configuration overrides in /etc/sysconfig/asterisk
CONFIG0=`readlink $0`
@@ -101,35 +101,35 @@
AST_ARGS="$AST_ARGS -G $AST_GROUP"
fi
if [ $AST_CONFIG ]; then
- ASTARGS="$ASTARGS -C $AST_CONFIG"
+ AST_ARGS="$AST_ARGS -C $AST_CONFIG"
elif [ $ALTCONF ]; then
- ASTARGS="$ASTARGS -C $ALTCONF"
+ AST_ARGS="$AST_ARGS -C $ALTCONF"
fi
if [ "x$COREDUMP" = "xyes" ]; then
- ASTARGS="$ASTARGS -g"
+ AST_ARGS="$AST_ARGS -g"
fi
if [ "0$MAXLOAD" -gt "0" ]; then
- ASTARGS="$ASTARGS -L $MAXLOAD"
+ AST_ARGS="$AST_ARGS -L $MAXLOAD"
fi
if [ "0$MAXCALLS" -gt "0" ]; then
- ASTARGS="$ASTARGS -M $MAXCALLS"
+ AST_ARGS="$AST_ARGS -M $MAXCALLS"
fi
if [ "0$VERBOSITY" -gt "0" ]; then
for i in `seq 1 $VERBOSITY`; do
- ASTARGS="$ASTARGS -v"
+ AST_ARGS="$AST_ARGS -v"
done
fi
if [ "x$INTERNALTIMING" = "xyes" ]; then
- ASTARGS="$ASTARGS -I"
+ AST_ARGS="$AST_ARGS -I"
fi
if [ "x$TEMPRECORDINGLOCATION" = "xyes" -o
"x$TMPRECORDINGLOCATION" = "xyes" ]; then
- ASTARGS="$ASTARGS -t"
+ AST_ARGS="$AST_ARGS -t"
fi
if [ "x$COLOR" = "xyes" ]; then
export TERM=linux
- daemon sh -c "$DAEMON $ASTARGS $AST_EXTRA_ARGS -c"
>/dev/null </dev/null 2>&1 &
+ daemon sh -c "$DAEMON $AST_ARGS $AST_EXTRA_ARGS -c"
>/dev/null </dev/null 2>&1 &
else
- daemon $DAEMON $ASTARGS $AST_EXTRA_ARGS
+ daemon $DAEMON $AST_ARGS $AST_EXTRA_ARGS
fi
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/asterisk