1 Then(/^the firewall leak detector has detected (.*?) leaks$/) do |type|
2 next if @skip_steps_while_restoring_background
3 leaks = FirewallLeakCheck.new(@sniffer.pcap_file, get_tor_relays)
6 if leaks.ipv4_tcp_leaks.empty?
8 raise "Couldn't detect any IPv4 TCP leaks"
11 if leaks.ipv4_nontcp_leaks.empty?
13 raise "Couldn't detect any IPv4 non-TCP leaks"
16 if leaks.ipv6_leaks.empty?
18 raise "Couldn't detect any IPv6 leaks"
21 if leaks.nonip_leaks.empty?
23 raise "Couldn't detect any non-IP leaks"
26 raise "Incorrect packet type '#{type}'"
30 Given(/^I disable Tails' firewall$/) do
31 next if @skip_steps_while_restoring_background
32 @vm.execute("/usr/local/sbin/do_not_ever_run_me")
33 iptables = @vm.execute("iptables -L -n -v").stdout.chomp.split("\n")
34 for line in iptables do
35 if !line[/Chain (INPUT|OUTPUT|FORWARD) \(policy ACCEPT/] and
36 !line[/pkts[[:blank:]]+bytes[[:blank:]]+target/] and
38 raise "The Tails firewall was not successfully disabled:\n#{iptables}"
43 When(/^I do a TCP DNS lookup of "(.*?)"$/) do |host|
44 next if @skip_steps_while_restoring_background
45 lookup = @vm.execute("host -T #{host} #{$some_dns_server}", $live_user)
46 assert(lookup.success?, "Failed to resolve #{host}:\n#{lookup.stdout}")
49 When(/^I do a UDP DNS lookup of "(.*?)"$/) do |host|
50 next if @skip_steps_while_restoring_background
51 lookup = @vm.execute("host #{host} #{$some_dns_server}", $live_user)
52 assert(lookup.success?, "Failed to resolve #{host}:\n#{lookup.stdout}")
55 When(/^I send some ICMP pings$/) do
56 next if @skip_steps_while_restoring_background
57 # We ping an IP address to avoid a DNS lookup
58 ping = @vm.execute("ping -c 5 #{$some_dns_server}", $live_user)
59 assert(ping.success?, "Failed to ping #{$some_dns_server}:\n#{ping.stderr}")