Pārlūkot izejas kodu

Move tor logging control to its own file

Bob Mottram 6 gadus atpakaļ
vecāks
revīzija
dce5921d5d
2 mainītis faili ar 5 papildinājumiem un 12 dzēšanām
  1. 2
    4
      src/freedombone-logging
  2. 3
    8
      src/freedombone-utils-onion

+ 2
- 4
src/freedombone-logging Parādīt failu

@@ -158,8 +158,7 @@ if [[ "$1" == "on" || "$1" == "On" || "$1" == "ON" ]]; then
158 158
             touch /var/log/tor/notices.log
159 159
             chown debian-tor:adm /var/log/tor/notices.log
160 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 162
     fi
164 163
     if [ -f /etc/php/7.0/fpm/php-fpm.conf ]; then
165 164
         sed -i 's|error_log =.*|error_log = /var/log/php-fpm.log|g' /etc/php/7.0/fpm/php-fpm.conf
@@ -206,8 +205,7 @@ else
206 205
     turn_logging_off
207 206
 
208 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 209
         rm /var/log/tor/*
212 210
     fi
213 211
     if [ -d /var/log/radicale ]; then

+ 3
- 8
src/freedombone-utils-onion Parādīt failu

@@ -323,14 +323,6 @@ function install_tor {
323 323
     # For torify
324 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 326
     if [ ! -d /etc/torrc.d ]; then
335 327
         mkdir /etc/torrc.d
336 328
     fi
@@ -339,6 +331,9 @@ function install_tor {
339 331
         echo '%include /etc/torrc.d' >> /etc/tor/torrc
340 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 337
     mark_completed "${FUNCNAME[0]}"
343 338
 }
344 339