@@ -29,7 +29,7 @@ DAEMON_USER=tor2web
29
29
30
30
DAEMON_ARGS=" --pidfile ${DAEMON_PIDFILE} --uid ${DAEMON_USER} --gid ${DAEMON_USER} "
31
31
32
- DAEMON_CMD =" $DAEMON $DAEMON_ARGS "
32
+ STARTCMD =" $DAEMON $DAEMON_ARGS "
33
33
34
34
SCRIPTNAME=$0
35
35
98
98
fi
99
99
100
100
if [ -d " /etc/letsencrypt/live" ] && [ -d " /etc/letsencrypt/archive" ]; then
101
- echo " Letsencrypt detected, fixing permission for /etc/letsencrypt/{live,archive} for $DAEMON_USER user"
102
- chgrp $DAEMON_USER /etc/letsencrypt/live/
103
- chgrp $DAEMON_USER /etc/letsencrypt/archive
104
- chmod g+rx /etc/letsencrypt/archive
105
- chmod g+rx /etc/letsencrypt/live
101
+ echo " Letsencrypt detected, fixing permission for /etc/letsencrypt/{live,archive} for $DAEMON_USER user"
102
+ chgrp $DAEMON_USER /etc/letsencrypt/live/
103
+ chgrp $DAEMON_USER /etc/letsencrypt/archive
104
+ chmod g+rx /etc/letsencrypt/archive
105
+ chmod g+rx /etc/letsencrypt/live
106
+ fi
107
+
108
+ if [[ " $APPARMOR_SANDBOXING " -eq " 1" && " $( cat /sys/module/apparmor/parameters/enabled 2> /dev/null) " != ' Y' ]]; then
109
+ echo " WARNING: Missing Apparmor Sandboxing support"
110
+ APPARMOR_SANDBOXING=0
106
111
fi
107
112
108
113
if [ " ${APPARMOR_SANDBOXING} " -eq " 1" ]; then
109
- APPARMOR_STARTED=0
110
-
111
- log_action_begin_msg " Enabling Tor2web Apparmor Sandboxing"
112
-
113
- test -x /usr/sbin/aa-status \
114
- && test -x /usr/sbin/aa-exec \
115
- && test -e /etc/apparmor.d/usr.bin.tor2web \
116
- && /usr/sbin/aa-status --enabled \
117
- && DAEMON_CMD=" /usr/sbin/aa-exec --profile=usr.bin.tor2web -- ${DAEMON_CMD} " \
118
- && APPARMOR_STARTED=1
119
-
120
- if [ " ${APPARMOR_STARTED} " -eq " 0" ]; then
121
- log_action_end_msg 1 " Unable to initialize AppArmor!"
122
- echo " Unable to initialize AppArmor!"
123
- echo " AppArmor is probably disabled; please enable it by following instructions at https://wiki.debian.org/AppArmor/HowToUse"
124
- echo " If you understand the risks involved and you know what you are doing, you can disable Tor2web's Apparmor support by editing /etc/default/tor2web and configuring APPARMOR_SANDBOXING=0"
125
- exit 1
126
- fi
114
+ STARTCMD=" aa-exec --profile=usr.bin.tor2web -- $STARTCMD "
127
115
fi
128
116
129
117
do_t2w_start ()
@@ -133,14 +121,14 @@ do_t2w_start()
133
121
fi
134
122
135
123
# Check to see if the daemon is already running.
136
- $DAEMON_CMD --command=status
124
+ $STARTCMD --command=status
137
125
RETVAL=$?
138
126
if [ $RETVAL -eq 0 ]; then
139
127
log_end_msg 0 " already running"
140
128
exit 0
141
129
fi
142
130
143
- $DAEMON_CMD --command=start
131
+ $STARTCMD --command=start
144
132
RETVAL=$?
145
133
if [ $RETVAL -ne 0 ]; then
146
134
log_end_msg 1 " couldn't start"
@@ -150,17 +138,17 @@ do_t2w_start()
150
138
151
139
do_t2w_stop ()
152
140
{
153
- $DAEMON_CMD --command=stop
141
+ $STARTCMD --command=stop
154
142
}
155
143
156
144
do_t2w_reload ()
157
145
{
158
- $DAEMON_CMD --command=reload
146
+ $STARTCMD --command=reload
159
147
}
160
148
161
149
do_t2w_status ()
162
150
{
163
- $DAEMON_CMD --command=status
151
+ $STARTCMD --command=status
164
152
RETVAL=$?
165
153
if [ $RETVAL -eq 1 ]; then
166
154
log_failure_msg " Tor2web is not running"
0 commit comments