Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
tails
tails
Commits
1ed0a6a2
Commit
1ed0a6a2
authored
Jun 13, 2015
by
kytv
Committed by
kytv
Oct 03, 2015
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restart Tor if bootstrapping stalls for more than 20 seconds
Will-fix:
#9516
parent
a3f66357
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
6 deletions
+45
-6
config/chroot_local-includes/etc/NetworkManager/dispatcher.d/20-time.sh
...local-includes/etc/NetworkManager/dispatcher.d/20-time.sh
+1
-1
config/chroot_local-includes/usr/local/sbin/restart-tor
config/chroot_local-includes/usr/local/sbin/restart-tor
+44
-5
No files found.
config/chroot_local-includes/etc/NetworkManager/dispatcher.d/20-time.sh
View file @
1ed0a6a2
...
...
@@ -175,7 +175,7 @@ maybe_set_time_from_tor_consensus() {
date
-us
"
${
vmid
}
"
1>/dev/null
# Tor is unreliable with picking a circuit after time change
restart
-tor
service tor
restart
}
tor_cert_valid_after
()
{
...
...
config/chroot_local-includes/usr/local/sbin/restart-tor
View file @
1ed0a6a2
...
...
@@ -2,13 +2,52 @@
set
-e
# Import try_for()
.
/usr/local/lib/tails-shell-library/common.sh
# Import tor_bootstrap_progress()
.
/usr/local/lib/tails-shell-library/tor.sh
# The Tor log is removed to ensure `tor_bootstrap_progress`'s output will be
# accurate.
clear_tor_log
()
{
rm
-f
/var/log/tor/log
}
clear_tor_log
service tor restart
# The main point of this script is to make sure that if vidalia is
# running, and Tor is restarted, then we also restart Vidalia. This is
# because Vidalia doesn't re-connect to Tor automatically, so the user
# has to restart it to be able to control Tor again. Also, any options
# set by Vidalia will be lost since they weren't written to torrc.
# There are two main points to this script:
# * restarting Tor if bootstrapping stalls for more than 20 seconds
# * making sure that if vidalia is running it is restarted if Tor is restarted.
# This is needed because Vidalia doesn't re-connect to Tor automatically,
# so the user has to restart it to be able to control Tor again. Also, any
# options set by Vidalia will be lost since they weren't written to torrc.
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
}
try_for 270 maybe_restart_tor
if
pgrep
"
\<
vidalia
\>
"
>
/dev/null
;
then
killall
-SIGKILL
vidalia
# Since Tor just restarted we wait for a while until the
...
...
kytv
@kytv
mentioned in issue
#9516 (closed)
·
May 14, 2020
mentioned in issue
#9516 (closed)
mentioned in issue #9516
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment