Folgende Lösung funktioniert bisher sehr gut bei mir:
Anders als bei einer chroot Umgebung für ein isoliertes Build- oder Testsystem sollen in diesem Fall nur die Ressourcen und Binaries, die für die Ausführung des zu isolierenden Dienstes zwingend notwendig sind, verfügbar sein. Darüber hinaus soll kein Arbeiten in der chroot möglich sein. Sollte es einem Angreifer gelingen z.B. einen noch unbekannten Exploit des Dienstes auszunutzen und sich unerlaubten Zugriff zu verschaffen, sollen seine weiteren Handlungsmöglichkeiten so weit es geht eingeschränkt werden.
Generell ist eine chroot Umgebung noch kein Sicherheitsmerkmal. Mit ein paar Hilfsmitteln ist es für einen Angreifer sehr leicht möglich aus einer solchen auszubrechen. Daher sollte das Ziel sein, das Erlangen dieser Hilfsmittel so weit wie möglich zu erschweren. Wie überall in der realen Welt gilt natürlich auch hier, dass es so etwas wie absolute Sicherheit nicht geben kann. Es ist aber möglich, den für einen erfolgreichen Angriff benötigten Aufwand deutlich zu erhöhen und damit auch die Wahrscheinlichkeit dass ein potentieller Angreifer die Motivation verliert.
Für alle anzulegenden Verzeichnisse gilt wenn nicht anders angegeben folgendes:
Besitzer: root
Gruppe: root
Modus: 755
-
Devices:
Der /dev Ordner sollte auf gar keinen Fall mit mount bind eingebunden werden. Das ist für eine Entwicklungs- oder Testumgebung völlig legitim, wäre hier aber ein fataler Fehler. Es werden ausschließlich die Random-Devices für die Verschlüsselungs-Mechanismen benötigt.
| mkdir /path/to/chroot/dev/
mknod -m 644 /path/to/chroot/dev/random c 1 8
mknod -m 644 /path/to/chroot/dev/urandom c 1 9
|
-
Konfigurationsdateien:
Die Konfigurationsdateien habe ich schreibgeschützt per Mount eingebunden. Auf diese Art können sie wie bisher gepflegt werden und es kann nicht passieren, dass zwei verschiedene Konfigurationen existieren.
| mkdir /path/to/chroot/etc/
touch /path/to/chroot/etc/mumble-server.ini
|
Wenn man ein letsencrypt Zertifikat verwenden möchte, macht es Sinn dieses auch mounten, um keinen Wartungsaufwand bei Zertifikat-Aktualisierungen zu haben. Da letsencrypt im Live-Verzeichnis relative Links setzt, muss nur der relative Pfad vom Live- zum Archiv-Verzeichnis gleich sein. Ich habe mich aber entschieden, den kompletten Pfad abzubilden.
| mkdir -p /path/to/chroot/etc/letsencrypt/live/servername.tld
mkdir -p /path/to/chroot/etc/letsencrypt/archive/servername.tld
|
Hier sind die bisherigen notwendigen Einträge in der Datei /etc/fstab (letsencrypt ist optional)
| /etc/mumble-server.ini /home/mumble/etc/mumble-server.ini none defaults,bind,ro
/etc/letsencrypt/live/servername.tld /path/to/chroot/etc/letsencrypt/live/servername.tld none defaults,bind,ro
/etc/letsencrypt/archive/servername.tld /path/to/chroot/etc/letsencrypt/archive/servername.tld none defaults,bind,ro
|
-
Prozessinformationen
Das Verzeichnis proc wird in dieser chroot Umgebung zum Glück nicht benötigt. Besonders dann, wenn man es ohne die Option hidepid=2 mountet, bietet es sehr viel Angriffsfläche. Hinweis für andere chroot Umgebungen: wenn man auf das proc Verzeichnis nicht verzichten kann (z.B. weil man in einer chroot-Umgebung für einen Webdienst Java benötigt) dann muss die Option hidepid=2 auch für das proc Verzeichnis im Hauptsystem gesetzt sein. Alle später gemounteten proc Verzeichnisse erben dessen Optionen. Wenn man das proc Verzeichnis in einer chroot Umgebung schreibgeschützt haben möchte muss man es mit der Option ro binden. Bei einem normalen Mount würden wieder die Optionen des zuerst gemounteten proc Verzeichnisses einschließlich des Schreibrechts übernommen.
-
Verzeichnis für die pid-Datei
| mkdir -p /path/to/chroot/run/mumble-server
chown mumble-server.mumble-server /path/to/chroot/run/mumble-server
|
-
Temp-Verzeichnis (kann gut sein, dass das nicht notwendig ist):
| mkdir /path/to/chroot/tmp
chmod 777 /path/to/chroot/tmp
|
Eintrag in /etc/fstab für Temp-Verzeichnis
| tmpfs_mumble /path/to/chroot/tmp tmpfs defaults
|
-
Arbeitsverzeichnis
Das Arbeitsverzeichnis habe ich auch eingehängt. Dieses mal ist aber Schreibrecht erforderlich. Dadurch war es nicht notwendig die bisherige Datenbank in die chroot Umgebung zu importieren und es ist ebenso leicht möglich, wieder in den normalen Betrieb zu wechseln ohne in der Zwischenzeit angemeldete Benutzer oder erstellte Kanäle zu verlieren.
| mkdir -p /path/to/chroot/var/lib/mumble-server
chown mumble-server.mumble-server /path/to/chroot/var/lib/mumble-server
|
Eintrag in /etc/fstab für Arbeitsverzeichnis
| /var/lib/mumble-server /path/to/chroot/var/lib/mumble-server none defaults,bind
|
-
Log Verzeichnis
| mkdir -p /path/to/chroot/var/log/mumble-server
chown mumble-server.mumble-server /path/to/chroot/var/log/mumble-server
|
-
Binaries
Bei einer Software-Aktualisierung können sich unter Umständen Abhängigkeiten ändern. Es wäre nicht wünschenswert, bei jeder Software-Aktualisierung alle Abhängigkeiten neu zu kontrollieren und die Binaries wieder einzeln in die chroot Umgebung zu kopieren. Natürlich möchte man auch nicht auf Aktualisierungen verzichten. Ich habe vor ein paar Jahren, nach einem Beispiel das ich hier (https://www.cyberciti.biz/faq/bash-scripting-using-awk/) gefunden habe, folgendes Shellscript erstellt, das mir seitdem unzählige unbezahlbare Dienste erwiesen hat.
cmd2chroot.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83 | #!/bin/bash
[[ $(id -u) -eq 0 ]] || { echo >&2 "Error: Must be root to run $0"; exit 1; }
if [ $# -lt 2 ]; then
echo "Syntax : $0 /path/to/jail /path/to/executable [/path/to/executable [...]]"
echo "Example: $0 /var/jail /bin/bash /bin/ls"
exit 1
fi
if [ ! -d $1 ]; then
echo "Error: Directory $1 does not exist"
exit 1;
fi
# dependencies
ALL_DEPS=()
# ld-linux
ALL_LDLS=()
for FILE in "${@:2}"
do
if [ -f $FILE ]; then
DIR="$(dirname $FILE)"
if [ ! -d "$1""$DIR" ]; then
echo creating dir "$1""$DIR"
mkdir -p "$1""$DIR"
chown root.root "$1""$DIR"
chmod 755 "$1""$DIR"
fi
echo copying file "$FILE" to "$1""$FILE"
cp -f -L --preserve=mode,timestamps "$FILE" "$1""$FILE"
# get shared library dependencies
DEPS="$(ldd $FILE | awk '{ print $3 }' | egrep -v ^'\(')"
for DEP in $DEPS
do
ALL_DEPS+=("$DEP")
done
# get ld-linux
ALL_LDLS+=("$(ldd $FILE | grep 'ld-linux' | awk '{ print $1}')")
else
echo "Error: File $FILE does not exist"
fi
done
echo preparing dependencies
# get unique array from all dependencies
DEPS=$(echo "${ALL_DEPS[@]}" | tr ' ' '\n' | sort -u)
# copy all dependencies to chroot
for DEP in $DEPS
do
if [ -f $DEP ]; then
DIR="$(dirname $DEP)"
if [ ! -d "$1""$DIR" ]; then
echo creating dir "$1""$DIR"
mkdir -p "$1""$DIR"
chown root.root "$1""$DIR"
chmod 755 "$1""$DIR"
fi
echo copying file "$DEP" to "$1""$DEP"
cp -f -L --preserve=mode,timestamps "$DEP" "$1""$DEP"
fi
done
echo preparing ld-linux
LDLS=$(echo "${ALL_LDLS[@]}" | tr ' ' '\n' | sort -u)
for LDL in $LDLS
do
if [ -f $LDL ]; then
DIR="$(dirname $LDL)"
if [ ! -d "$1""$DIR" ]; then
echo creating dir "$1""$DIR"
mkdir -p "$1""$DIR"
chown root.root "$1""$DIR"
chmod 755 "$1""$DIR"
fi
echo copying file "$LDL" to "$1""$LDL"
cp -f -L --preserve=mode,timestamps "$LDL" "$1""$LDL"
fi
done
|
Mit Hilfe dieses Shellscriptes können jetzt die benötigten Binaries einschließlich ihrer Abhängigkeiten in die chroot Umgebung kopiert werden.
| BINARIES=(
/usr/sbin/murmurd
/usr/bin/openssl
/usr/bin/iconv
)
cmd2chroot.sh /path/to/chroot "${BINARIES[@]}"
|
Wenn man das lieber ohne das Script machen möchte, geht das natürlich auch manuell:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41 | PATHTOCHROOT=/path/to/chroot
cp -f -L -p --preserve=mode,timestamps /usr/sbin/murmurd $PATHTOCHROOT/usr/sbin/murmurd
cp -f -L -p --preserve=mode,timestamps /usr/bin/openssl $PATHTOCHROOT/usr/bin/openssl
cp -f -L -p --preserve=mode,timestamps /usr/bin/iconv $PATHTOCHROOT/usr/bin/iconv
cp -f -L -p --preserve=mode,timestamps /lib64/ld-linux-x86-64.so.2 $PATHTOCHROOT/lib64/ld-linux-x86-64.so.2
cp -f -L -p --preserve=mode,timestamps /lib/x86_64-linux-gnu/libbz2.so.1.0 $PATHTOCHROOT/lib/x86_64-linux-gnu/libbz2.so.1.0
cp -f -L -p --preserve=mode,timestamps /lib/x86_64-linux-gnu/libcap.so.2 $PATHTOCHROOT/lib/x86_64-linux-gnu/libcap.so.2
cp -f -L -p --preserve=mode,timestamps /lib/x86_64-linux-gnu/libc.so.6 $PATHTOCHROOT/lib/x86_64-linux-gnu/libc.so.6
cp -f -L -p --preserve=mode,timestamps /lib/x86_64-linux-gnu/libdbus-1.so.3 $PATHTOCHROOT/lib/x86_64-linux-gnu/libdbus-1.so.3
cp -f -L -p --preserve=mode,timestamps /lib/x86_64-linux-gnu/libdl.so.2 $PATHTOCHROOT/lib/x86_64-linux-gnu/libdl.so.2
cp -f -L -p --preserve=mode,timestamps /lib/x86_64-linux-gnu/libgcc_s.so.1 $PATHTOCHROOT/lib/x86_64-linux-gnu/libgcc_s.so.1
cp -f -L -p --preserve=mode,timestamps /lib/x86_64-linux-gnu/libgcrypt.so.20 $PATHTOCHROOT/lib/x86_64-linux-gnu/libgcrypt.so.20
cp -f -L -p --preserve=mode,timestamps /lib/x86_64-linux-gnu/libgpg-error.so.0 $PATHTOCHROOT/lib/x86_64-linux-gnu/libgpg-error.so.0
cp -f -L -p --preserve=mode,timestamps /lib/x86_64-linux-gnu/liblzma.so.5 $PATHTOCHROOT/lib/x86_64-linux-gnu/liblzma.so.5
cp -f -L -p --preserve=mode,timestamps /lib/x86_64-linux-gnu/libm.so.6 $PATHTOCHROOT/lib/x86_64-linux-gnu/libm.so.6
cp -f -L -p --preserve=mode,timestamps /lib/x86_64-linux-gnu/libpcre.so.3 $PATHTOCHROOT/lib/x86_64-linux-gnu/libpcre.so.3
cp -f -L -p --preserve=mode,timestamps /lib/x86_64-linux-gnu/libpthread.so.0 $PATHTOCHROOT/lib/x86_64-linux-gnu/libpthread.so.0
cp -f -L -p --preserve=mode,timestamps /lib/x86_64-linux-gnu/librt.so.1 $PATHTOCHROOT/lib/x86_64-linux-gnu/librt.so.1
cp -f -L -p --preserve=mode,timestamps /lib/x86_64-linux-gnu/libsystemd.so.0 $PATHTOCHROOT/lib/x86_64-linux-gnu/libsystemd.so.0
cp -f -L -p --preserve=mode,timestamps /lib/x86_64-linux-gnu/libtinfo.so.5 $PATHTOCHROOT/lib/x86_64-linux-gnu/libtinfo.so.5
cp -f -L -p --preserve=mode,timestamps /lib/x86_64-linux-gnu/libz.so.1 $PATHTOCHROOT/lib/x86_64-linux-gnu/libz.so.1
cp -f -L -p --preserve=mode,timestamps /usr/lib/x86_64-linux-gnu/libIce.so.37 $PATHTOCHROOT/usr/lib/x86_64-linux-gnu/libIce.so.37
cp -f -L -p --preserve=mode,timestamps /usr/lib/x86_64-linux-gnu/libnss3.so $PATHTOCHROOT/usr/lib/x86_64-linux-gnu/libnss3.so
cp -f -L -p --preserve=mode,timestamps /usr/lib/x86_64-linux-gnu/libQtCore.so.4 $PATHTOCHROOT/usr/lib/x86_64-linux-gnu/libQtCore.so.4
cp -f -L -p --preserve=mode,timestamps /usr/lib/x86_64-linux-gnu/libavahi-client.so.3 $PATHTOCHROOT/usr/lib/x86_64-linux-gnu/libavahi-client.so.3
cp -f -L -p --preserve=mode,timestamps /usr/lib/x86_64-linux-gnu/libdns_sd.so.1 $PATHTOCHROOT/usr/lib/x86_64-linux-gnu/libdns_sd.so.1
cp -f -L -p --preserve=mode,timestamps /usr/lib/x86_64-linux-gnu/libnssutil3.so $PATHTOCHROOT/usr/lib/x86_64-linux-gnu/libnssutil3.so
cp -f -L -p --preserve=mode,timestamps /usr/lib/x86_64-linux-gnu/libQtDBus.so.4 $PATHTOCHROOT/usr/lib/x86_64-linux-gnu/libQtDBus.so.4
cp -f -L -p --preserve=mode,timestamps /usr/lib/x86_64-linux-gnu/libstdc++.so.6 $PATHTOCHROOT/usr/lib/x86_64-linux-gnu/libstdc++.so.6
cp -f -L -p --preserve=mode,timestamps /usr/lib/x86_64-linux-gnu/libavahi-common.so.3 $PATHTOCHROOT/usr/lib/x86_64-linux-gnu/libavahi-common.so.3
cp -f -L -p --preserve=mode,timestamps /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 $PATHTOCHROOT/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
cp -f -L -p --preserve=mode,timestamps /usr/lib/x86_64-linux-gnu/libplc4.so $PATHTOCHROOT/usr/lib/x86_64-linux-gnu/libplc4.so
cp -f -L -p --preserve=mode,timestamps /usr/lib/x86_64-linux-gnu/libQtNetwork.so.4 $PATHTOCHROOT/usr/lib/x86_64-linux-gnu/libQtNetwork.so.4
cp -f -L -p --preserve=mode,timestamps /usr/lib/x86_64-linux-gnu/liblz4.so.1 $PATHTOCHROOT/usr/lib/x86_64-linux-gnu/liblz4.so.1
cp -f -L -p --preserve=mode,timestamps /usr/lib/x86_64-linux-gnu/libplds4.so $PATHTOCHROOT/usr/lib/x86_64-linux-gnu/libplds4.so
cp -f -L -p --preserve=mode,timestamps /usr/lib/x86_64-linux-gnu/libQtSql.so.4 $PATHTOCHROOT/usr/lib/x86_64-linux-gnu/libQtSql.so.4
cp -f -L -p --preserve=mode,timestamps /usr/lib/x86_64-linux-gnu/libnspr4.so $PATHTOCHROOT/usr/lib/x86_64-linux-gnu/libnspr4.so
cp -f -L -p --preserve=mode,timestamps /usr/lib/x86_64-linux-gnu/libprotobuf.so.10 $PATHTOCHROOT/usr/lib/x86_64-linux-gnu/libprotobuf.so.10
cp -f -L -p --preserve=mode,timestamps /usr/lib/x86_64-linux-gnu/libQtXml.so.4 $PATHTOCHROOT/usr/lib/x86_64-linux-gnu/libQtXml.so.4
|
Jetzt fehlen noch die benötigten Bibliotheken, die zur Laufzeit geladen werden und deswegen nicht von dem Shellscript gefunden werden können.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 | PATHTOCHROOT=/path/to/chroot
cp -av /usr/lib/x86_64-linux-gnu/libcrypto.so $PATHTOCHROOT/usr/lib/x86_64-linux-gnu/libcrypto.so
cp -av /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0 $PATHTOCHROOT/usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
cp -av /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 $PATHTOCHROOT/usr/lib/x86_64-linux-gnu/libcrypto.so.1.1
cp -av /usr/lib/x86_64-linux-gnu/libhcrypto.so.4 $PATHTOCHROOT/usr/lib/x86_64-linux-gnu/libhcrypto.so.4
cp -av /usr/lib/x86_64-linux-gnu/libhcrypto.so.4.1.0 $PATHTOCHROOT/usr/lib/x86_64-linux-gnu/libhcrypto.so.4.1.0
cp -av /usr/lib/x86_64-linux-gnu/libk5crypto.so.3 $PATHTOCHROOT/usr/lib/x86_64-linux-gnu/libk5crypto.so.3
cp -av /usr/lib/x86_64-linux-gnu/libk5crypto.so.3.1 $PATHTOCHROOT/usr/lib/x86_64-linux-gnu/libk5crypto.so.3.1
cp -av /usr/lib/x86_64-linux-gnu/libssl.so $PATHTOCHROOT/usr/lib/x86_64-linux-gnu/libssl.so
cp -av /usr/lib/x86_64-linux-gnu/libssl.so.1.0.0 $PATHTOCHROOT/usr/lib/x86_64-linux-gnu/libssl.so.1.0.0
cp -av /usr/lib/x86_64-linux-gnu/libssl.so.1.1 $PATHTOCHROOT/usr/lib/x86_64-linux-gnu/libssl.so.1.1
cp -av /usr/lib/x86_64-linux-gnu/libssl3.so $PATHTOCHROOT/usr/lib/x86_64-linux-gnu/libssl3.so
cp -av /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 $PATHTOCHROOT/usr/lib/x86_64-linux-gnu/libsqlite3.so.0
cp -av /usr/lib/x86_64-linux-gnu/libsqlite3.so.0.8.6 $PATHTOCHROOT/usr/lib/x86_64-linux-gnu/libsqlite3.so.0.8.6
cp -av /usr/lib/x86_64-linux-gnu/qt4/plugins/sqldrivers/libqsqlite.so $PATHTOCHROOT/usr/lib/x86_64-linux-gnu/qt4/plugins/sqldrivers/libqsqlite.so
cp -av -p -r /usr/lib/x86_64-linux-gnu/gconv $PATHTOCHROOT/usr/lib/x86_64-linux-gnu/gconv
|
-
Jetzt muss noch das Start-Script für den Dienst angepasst werden
/etc/init.d/mumble-server
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144 | #! /bin/sh
#
### BEGIN INIT INFO
# Provides: mumble-server
# Required-Start: $network $local_fs $remote_fs
# Required-Stop: $network $local_fs $remote_fs
# Should-Start: $mysql dbus
# Should-Stop: $mysql dbus
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Mumble VoIP Server
# Description: init script for the Mumble VoIP Server murmurd.
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin
NAME=mumble-server
DESC="Mumble VoIP Server"
PIDDIR=/run/$NAME
PIDFILE=$PIDDIR/$NAME.pid
DAEMON=/usr/sbin/murmurd
USER=mumble-server
GROUP=mumble-server
CHROOT=/home/mumble
test -x $DAEMON || exit 0
INIFILE=/etc/mumble-server.ini
DAEMON_OPTS="-ini $INIFILE"
MURMUR_DAEMON_START=0
MURMUR_USE_CAPABILITIES=0
MURMUR_LIMIT_NOFILE=0
# Include murmur defaults if available
if [ -f /etc/default/$NAME ] ; then
. /etc/default/$NAME
fi
. /lib/init/vars.sh
. /lib/lsb/init-functions
if [ "$MURMUR_LIMIT_NOFILE" -gt 0 ] ; then
ulimit -n $MURMUR_LIMIT_NOFILE
fi
case "$1" in
start)
if [ "$MURMUR_DAEMON_START" != "1" ] ; then
log_warning_msg "Not starting $DESC $NAME, disabled via /etc/default/$NAME"
exit 0
fi
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
[ -d $PIDDIR ] || install -o $USER -d $PIDDIR
if [ "$MURMUR_USE_CAPABILITIES" != "1" ] ; then
start-stop-daemon --start --quiet --chroot $CHROOT \
--pidfile $PIDFILE \
--chuid $USER:$GROUP \
--exec $DAEMON \
-- $DAEMON_OPTS
else
start-stop-daemon --start --quiet --chroot $CHROOT \
--pidfile $PIDFILE \
--exec $DAEMON \
-- $DAEMON_OPTS
fi
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
start-stop-daemon --stop --quiet --chroot $CHROOT \
--retry=TERM/30/KILL/5 \
--pidfile $CHROOT/$PIDFILE \
--user $USER \
--exec $DAEMON
case "$?" in
0|1) rm -f $PIDFILE
[ "$VERBOSE" != no ] && log_end_msg 0
;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
status)
if start-stop-daemon --test --stop --quiet --chroot $CHROOT \
--pidfile $CHROOT/$PIDFILE \
--user $USER \
--exec $DAEMON
then
[ "$VERBOSE" != no ] && echo "$DESC is running."
exit 0
else
[ "$VERBOSE" != no ] && echo "$DESC is not running"
exit 3
fi
;;
force-reload)
start-stop-daemon --stop --test --quiet --chroot $CHROOT \
--pidfile $CHROOT/$PIDFILE \
--user $USER \
--exec $DAEMON \
&& $0 restart || exit 0
;;
restart)
[ "$VERBOSE" != no ] && log_daemon_msg "Restarting $DESC" "$NAME"
start-stop-daemon --stop --quiet --chroot $CHROOT \
--retry=TERM/30/KILL/5 \
--pidfile $CHROOT/$PIDFILE \
--user $USER \
--exec $DAEMON
case "$?" in
0|1)
[ -d $PIDDIR ] || install -o $USER -d $PIDDIR
rm -f $PIDFILE
if [ "$MURMUR_USE_CAPABILITIES" != "1" ] ; then
start-stop-daemon --start --quiet --chroot $CHROOT \
--pidfile $PIDFILE \
--chuid $USER:$GROUP \
--exec $DAEMON \
-- $DAEMON_OPTS
else
start-stop-daemon --start --quiet --chroot $CHROOT \
--pidfile $PIDFILE \
--exec $DAEMON \
-- $DAEMON_OPTS
fi
case "$?" in
0) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
*) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
*)
[ "$VERBOSE" != no ] && log_end_msg 0
;;
esac
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|force-reload}" >&2
exit 3
;;
esac
exit 0
|
-
Ich hoffe, dass ich jetzt nichts vergessen habe. Die erstellten Mount-Points müssen natürlich noch gemountet werden.