summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoranonym <anonym@riseup.net>2016-02-04 05:06:39 +0100
committeranonym <anonym@riseup.net>2016-02-04 05:06:39 +0100
commit1bdb7ae8b6672be359a0b14484558d23d65f8b50 (patch)
treede106847be30aced2bce222d3c9d42edaa70ac99
parent5053c1d2ab824d903c17e72d639bc8a0aa13d5e3 (diff)
More wip on chutney.test/9521-chutney-wip
-rw-r--r--features/chutney.feature13
-rw-r--r--features/step_definitions/chutney.rb71
-rw-r--r--features/step_definitions/common_steps.rb7
-rw-r--r--features/torified_browsing.feature6
4 files changed, 48 insertions, 49 deletions
diff --git a/features/chutney.feature b/features/chutney.feature
index 1695263..b804810 100644
--- a/features/chutney.feature
+++ b/features/chutney.feature
@@ -1,17 +1,8 @@
-@product
+@product @check_tor_leaks
Feature: Simulate the Tor network with chutney
- Background:
- Given a computer
- And I start Tails from DVD with network unplugged and I login
- And Tails is using a simulated Tor network
- And the network is plugged
- And Tor is ready
- And available upgrades have been checked
- And all notifications have disappeared
- And I save the state so the background can be restored next scenario
-
Scenario: We're not using the real Tor network
+ Given I have started Tails from DVD and logged in and the network is connected
When I start the Tor Browser
And the Tor Browser has started and loaded the startup page
And I open the address "https://check.torproject.org" in the Tor Browser
diff --git a/features/step_definitions/chutney.rb b/features/step_definitions/chutney.rb
index 1cad6a6..b294cae 100644
--- a/features/step_definitions/chutney.rb
+++ b/features/step_definitions/chutney.rb
@@ -1,36 +1,5 @@
-When /^Tails is using a simulated Tor network$/ do
- next if @skip_steps_while_restoring_background
-
- # At the moment this step essentially assumes that we boot with 'the
- # network is unplugged', run this step, and then 'the network is
- # plugged'. I believe we can make this pretty transparent without
- # the need of a dedicated step by using tags (e.g. @fake_tor or
- # whatever -- possibly we want the opposite, @real_tor,
- # instead).
- #
- # There are two time points where we for a scenario must ensure that
- # the client configuration below is enabled if and only if the
- # scenario is tagged, and that is:
- #
- # 1. During a proper boot, as soon as the remote shell is up in the
- # 'the computer boots Tails' step.
- #
- # 2. When restoring a snapshot, in restore_background().
- #
- # If we do this, it doesn't even matter if a snapshot is made of an
- # untagged scenario (without the conf), and we later restore it with
- # a tagged scenario.
- #
- # Note: We probably have to clear the /var/lib/tor data dir when we
- # switch mode. Possibly there are other such problems that make this
- # abstraction impractical and it's better that we avoid it an go
- # with the more explicit, step-based approach.
-
- assert(not(@vm.execute('service tor status').success?),
- "Running this step when Tor is running is probably not intentional")
-
+def ensure_chutney_is_running
chutney_src_dir = $config["Chutney"]["src_dir"]
-
# Ensure that a fresh chutney instnace is running, and that it will
# be cleaned upon exit. We only do it once, though, since the same
# setup can be used throughout the same test suite run.
@@ -42,7 +11,6 @@ When /^Tails is using a simulated Tor network$/ do
chutney_cleanup_hook = Proc.new do
Dir.chdir(chutney_src_dir) do
cmd_helper([chutney_script, "stop", network_definition], env)
- FileUtils.rm_r("#{chutney_src_dir}/net")
end
end
Dir.chdir(chutney_src_dir) do
@@ -65,7 +33,37 @@ When /^Tails is using a simulated Tor network$/ do
end
$chutney_initialized = true
end
+end
+
+When /^Tails is using a simulated Tor network$/ do
+ # At the moment this step essentially assumes that we boot with 'the
+ # network is unplugged', run this step, and then 'the network is
+ # plugged'. I believe we can make this pretty transparent without
+ # the need of a dedicated step by using tags (e.g. @fake_tor or
+ # whatever -- possibly we want the opposite, @real_tor,
+ # instead).
+ #
+ # There are two time points where we for a scenario must ensure that
+ # the client configuration below is enabled if and only if the
+ # scenario is tagged, and that is:
+ #
+ # 1. During a proper boot, as soon as the remote shell is up in the
+ # 'the computer boots Tails' step.
+ #
+ # 2. When restoring a snapshot, in restore_background().
+ #
+ # If we do this, it doesn't even matter if a snapshot is made of an
+ # untagged scenario (without the conf), and we later restore it with
+ # a tagged scenario.
+ #
+ # Note: We probably have to clear the /var/lib/tor data dir when we
+ # switch mode. Possibly there are other such problems that make this
+ # abstraction impractical and it's better that we avoid it an go
+ # with the more explicit, step-based approach.
+ assert(not($vm.execute('service tor status').success?),
+ "Running this step when Tor is running is probably not intentional")
+ ensure_chutney_is_running
# Most of these lines are taken from chutney's client template.
client_torrc_lines = [
'TestingTorNetwork 1',
@@ -81,11 +79,12 @@ When /^Tails is using a simulated Tor network$/ do
]
# We run one client in chutney so we easily can grep the generated
# DirAuthority lines and use them.
+ chutney_src_dir = $config["Chutney"]["src_dir"]
dir_auth_lines = open("#{chutney_src_dir}/net/nodes/035c/torrc") do |f|
f.grep(/^DirAuthority\s/)
end
client_torrc_lines.concat(dir_auth_lines)
- client_torrc_lines.each do |line|
- @vm.file_append('/etc/tor/torrc', line)
- end
+ $vm.file_append('/etc/tor/torrc', client_torrc_lines)
+ $vm.execute_successfully('sed "s/Sandbox 1/Sandbox 0/" ' +
+ '/etc/NetworkManager/dispatcher.d/10-tor.sh')
end
diff --git a/features/step_definitions/common_steps.rb b/features/step_definitions/common_steps.rb
index 5b7a144..10a7f24 100644
--- a/features/step_definitions/common_steps.rb
+++ b/features/step_definitions/common_steps.rb
@@ -106,6 +106,9 @@ def post_snapshot_restore_hook
$vm.execute("rm -f /var/log/tor/log")
$vm.execute("systemctl --no-block restart tails-tor-has-bootstrapped.target")
$vm.host_to_guest_time_sync
+ if $config["Chutney"] && $config["Chutney"]["src_dir"]
+ ensure_chutney_is_running
+ end
$vm.spawn("restart-tor")
wait_until_tor_is_working
if $vm.file_content('/proc/cmdline').include?(' i2p')
@@ -290,6 +293,10 @@ Given /^the computer (re)?boots Tails$/ do |reboot|
@screen.wait('TailsGreeter.png', 30*60)
$vm.wait_until_remote_shell_is_up
activate_filesystem_shares
+
+ if $config["Chutney"] && $config["Chutney"]["src_dir"]
+ step 'Tails is using a simulated Tor network'
+ end
end
Given /^I log in to a new session(?: in )?(|German)$/ do |lang|
diff --git a/features/torified_browsing.feature b/features/torified_browsing.feature
index 78a4013..fada176 100644
--- a/features/torified_browsing.feature
+++ b/features/torified_browsing.feature
@@ -115,7 +115,8 @@ Feature: Browsing the web using the Tor Browser
When I start the Tor Browser
And the Tor Browser has started and loaded the startup page
And I open the address "https://check.torproject.org" in the Tor Browser
- Then I see "TorBrowserTorCheck.png" after at most 180 seconds
+# Then I see "TorBrowserTorCheck.png" after at most 180 seconds
+ Then I see "UnsafeBrowserTorCheckFail.png" after at most 180 seconds
@check_tor_leaks @fragile
Scenario: The Tor Browser's "New identity" feature works as expected
@@ -123,7 +124,8 @@ Feature: Browsing the web using the Tor Browser
When I start the Tor Browser
And the Tor Browser has started and loaded the startup page
And I open the address "https://check.torproject.org" in the Tor Browser
- Then I see "TorBrowserTorCheck.png" after at most 180 seconds
+# Then I see "TorBrowserTorCheck.png" after at most 180 seconds
+ Then I see "UnsafeBrowserTorCheckFail.png" after at most 180 seconds
When I request a new identity using Torbutton
And I acknowledge Torbutton's New Identity confirmation prompt
Then the Tor Browser loads the startup page