Move tor logging control to its own file

This commit is contained in:
Bob Mottram 2018-04-20 13:02:44 +01:00
parent f3033b4d5c
commit dce5921d5d
2 changed files with 5 additions and 12 deletions

View File

@ -158,8 +158,7 @@ if [[ "$1" == "on" || "$1" == "On" || "$1" == "ON" ]]; then
touch /var/log/tor/notices.log
chown debian-tor:adm /var/log/tor/notices.log
fi
sed -i 's|#Log notice file.*|Log notice file /var/log/tor/notices.log|g' /etc/tor/torrc
sed -i 's|Log notice file.*|Log notice file /var/log/tor/notices.log|g' /etc/tor/torrc
echo 'Log notice file /var/log/tor/notices.log' > /etc/torrc.d/logging
fi
if [ -f /etc/php/7.0/fpm/php-fpm.conf ]; then
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
turn_logging_off
if [ -d /etc/tor ]; then
sed -i 's|#Log notice file.*|Log notice file /dev/null|g' /etc/tor/torrc
sed -i 's|Log notice file.*|Log notice file /dev/null|g' /etc/tor/torrc
echo 'Log notice file /dev/null' > /etc/torrc.d/logging
rm /var/log/tor/*
fi
if [ -d /var/log/radicale ]; then

View File

@ -323,14 +323,6 @@ function install_tor {
# For torify
apt-get -yq install torsocks
# turn off logging
sed -i 's|#Log notice file.*|Log notice file /dev/null|g' /etc/tor/torrc
sed -i 's|Log notice file.*|Log notice file /dev/null|g' /etc/tor/torrc
# Restrict traffic
sed -i "s|#AccountingMax.*|AccountingMax $TOR_MAX_TRAFFIC_PER_MONTH_GB GBytes|g" /etc/tor/torrc
sed -i "s|AccountingMax.*|AccountingMax $TOR_MAX_TRAFFIC_PER_MONTH_GB GBytes|g" /etc/tor/torrc
if [ ! -d /etc/torrc.d ]; then
mkdir /etc/torrc.d
fi
@ -339,6 +331,9 @@ function install_tor {
echo '%include /etc/torrc.d' >> /etc/tor/torrc
fi
echo 'Log notice file /dev/null' > /etc/torrc.d/logging
echo "AccountingMax $TOR_MAX_TRAFFIC_PER_MONTH_GB GBytes" > /etc/torrc.d/maxtraffic
mark_completed "${FUNCNAME[0]}"
}