Browse Source

Move tor logging control to its own file

Bob Mottram 7 years ago
parent
commit
dce5921d5d
2 changed files with 5 additions and 12 deletions
  1. 2
    4
      src/freedombone-logging
  2. 3
    8
      src/freedombone-utils-onion

+ 2
- 4
src/freedombone-logging View File

158
             touch /var/log/tor/notices.log
158
             touch /var/log/tor/notices.log
159
             chown debian-tor:adm /var/log/tor/notices.log
159
             chown debian-tor:adm /var/log/tor/notices.log
160
         fi
160
         fi
161
-        sed -i 's|#Log notice file.*|Log notice file /var/log/tor/notices.log|g' /etc/tor/torrc
162
-        sed -i 's|Log notice file.*|Log notice file /var/log/tor/notices.log|g' /etc/tor/torrc
161
+        echo 'Log notice file /var/log/tor/notices.log' > /etc/torrc.d/logging
163
     fi
162
     fi
164
     if [ -f /etc/php/7.0/fpm/php-fpm.conf ]; then
163
     if [ -f /etc/php/7.0/fpm/php-fpm.conf ]; then
165
         sed -i 's|error_log =.*|error_log = /var/log/php-fpm.log|g' /etc/php/7.0/fpm/php-fpm.conf
164
         sed -i 's|error_log =.*|error_log = /var/log/php-fpm.log|g' /etc/php/7.0/fpm/php-fpm.conf
206
     turn_logging_off
205
     turn_logging_off
207
 
206
 
208
     if [ -d /etc/tor ]; then
207
     if [ -d /etc/tor ]; then
209
-        sed -i 's|#Log notice file.*|Log notice file /dev/null|g' /etc/tor/torrc
210
-        sed -i 's|Log notice file.*|Log notice file /dev/null|g' /etc/tor/torrc
208
+        echo 'Log notice file /dev/null' > /etc/torrc.d/logging
211
         rm /var/log/tor/*
209
         rm /var/log/tor/*
212
     fi
210
     fi
213
     if [ -d /var/log/radicale ]; then
211
     if [ -d /var/log/radicale ]; then

+ 3
- 8
src/freedombone-utils-onion View File

323
     # For torify
323
     # For torify
324
     apt-get -yq install torsocks
324
     apt-get -yq install torsocks
325
 
325
 
326
-    # turn off logging
327
-    sed -i 's|#Log notice file.*|Log notice file /dev/null|g' /etc/tor/torrc
328
-    sed -i 's|Log notice file.*|Log notice file /dev/null|g' /etc/tor/torrc
329
-
330
-    # Restrict traffic
331
-    sed -i "s|#AccountingMax.*|AccountingMax $TOR_MAX_TRAFFIC_PER_MONTH_GB GBytes|g" /etc/tor/torrc
332
-    sed -i "s|AccountingMax.*|AccountingMax $TOR_MAX_TRAFFIC_PER_MONTH_GB GBytes|g" /etc/tor/torrc
333
-
334
     if [ ! -d /etc/torrc.d ]; then
326
     if [ ! -d /etc/torrc.d ]; then
335
         mkdir /etc/torrc.d
327
         mkdir /etc/torrc.d
336
     fi
328
     fi
339
         echo '%include /etc/torrc.d' >> /etc/tor/torrc
331
         echo '%include /etc/torrc.d' >> /etc/tor/torrc
340
     fi
332
     fi
341
 
333
 
334
+    echo 'Log notice file /dev/null' > /etc/torrc.d/logging
335
+    echo "AccountingMax $TOR_MAX_TRAFFIC_PER_MONTH_GB GBytes" > /etc/torrc.d/maxtraffic
336
+
342
     mark_completed "${FUNCNAME[0]}"
337
     mark_completed "${FUNCNAME[0]}"
343
 }
338
 }
344
 
339