Commit c9b58900 authored by anonym's avatar anonym Committed by kytv

Fix indentation.

parent d30225ff
......@@ -5,12 +5,12 @@
# Run only when the interface is not "lo":
if [ $1 = "lo" ]; then
exit 0
exit 0
fi
# Run whenever an interface gets "up", not otherwise:
if [ $2 != "up" ]; then
exit 0
exit 0
fi
# Import tor_control_setconf(), TOR_LOG
......@@ -35,7 +35,7 @@ rm -f "${TOR_LOG}"
# a HTTP proxy or allowed firewall ports won't get the sandboxing, but
# much better than nothing.
if [ "$(tails_netconf)" = "direct" ]; then
tor_set_in_torrc Sandbox 1
tor_set_in_torrc Sandbox 1
fi
# We would like Tor to be started during init time, even before the
......@@ -47,29 +47,29 @@ fi
# To work around this we restart Tor, in various ways, not matter the
# case below.
if [ "$(tails_netconf)" = "obstacle" ]; then
# We do not use retart-tor since it validates that bootstraping
# succeeds. That cannot happen until Tor Launcher has started
# (below) and the user is done configuring it.
service tor restart
# We do not use retart-tor since it validates that bootstraping
# succeeds. That cannot happen until Tor Launcher has started
# (below) and the user is done configuring it.
service tor restart
# When using a bridge Tor reports TLS cert lifetime errors
# (e.g. when the system clock is way off) with severity "info", but
# when no bridge is used the severity is "warn". tordate/20-time.sh
# depends on grepping these error messages, so we temporarily
# increase Tor's logging severity.
tor_control_setconf "Log=\"info file ${TOR_LOG}\""
# When using a bridge Tor reports TLS cert lifetime errors
# (e.g. when the system clock is way off) with severity "info", but
# when no bridge is used the severity is "warn". tordate/20-time.sh
# depends on grepping these error messages, so we temporarily
# increase Tor's logging severity.
tor_control_setconf "Log=\"info file ${TOR_LOG}\""
# Enable the transports we support. We cannot do this in general,
# when bridge mode is not enabled, since we then use seccomp
# sandboxing.
tor_control_setconf 'ClientTransportPlugin="obfs2,obfs3,obfs4 exec /usr/bin/obfs4proxy managed"'
# Enable the transports we support. We cannot do this in general,
# when bridge mode is not enabled, since we then use seccomp
# sandboxing.
tor_control_setconf 'ClientTransportPlugin="obfs2,obfs3,obfs4 exec /usr/bin/obfs4proxy managed"'
/usr/local/sbin/tails-tor-launcher &
/usr/local/sbin/tails-tor-launcher &
# Wait until the user has done the Tor Launcher configuration.
until [ "$(tor_control_getconf DisableNetwork)" = 0 ]; do
sleep 1
done
# Wait until the user has done the Tor Launcher configuration.
until [ "$(tor_control_getconf DisableNetwork)" = 0 ]; do
sleep 1
done
else
( restart-tor ) &
fi
......@@ -28,22 +28,22 @@ bootstrap_progress=0
last_bootstrap_change=$(date +%s)
maybe_restart_tor() {
local new_bootstrap_progress=$(tor_bootstrap_progress)
if [ $new_bootstrap_progress -eq 100 ]; then
return 0
elif [ $new_bootstrap_progress -gt $bootstrap_progress ]; then
bootstrap_progress=$new_bootstrap_progress
last_bootstrap_change=$(date +%s)
return 1
elif [ $(expr $(date +%s) - $last_bootstrap_change) -ge 20 ]; then
clear_tor_log
service tor restart
bootstrap_progress=0
last_bootstrap_change=$(date +%s)
return 1
else
return 1
fi
local new_bootstrap_progress=$(tor_bootstrap_progress)
if [ $new_bootstrap_progress -eq 100 ]; then
return 0
elif [ $new_bootstrap_progress -gt $bootstrap_progress ]; then
bootstrap_progress=$new_bootstrap_progress
last_bootstrap_change=$(date +%s)
return 1
elif [ $(expr $(date +%s) - $last_bootstrap_change) -ge 20 ]; then
clear_tor_log
service tor restart
bootstrap_progress=0
last_bootstrap_change=$(date +%s)
return 1
else
return 1
fi
}
try_for 270 maybe_restart_tor
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment