1 Given /^I2P is running$/ do
2 next if @skip_steps_while_restoring_background
4 @vm.execute('service i2p status').success?
8 Given /^the I2P router console is ready$/ do
9 next if @skip_steps_while_restoring_background
11 @vm.execute('. /usr/local/lib/tails-shell-library/i2p.sh; ' +
12 'i2p_router_console_is_ready').success?
16 When /^I start the I2P Browser through the GNOME menu$/ do
17 next if @skip_steps_while_restoring_background
18 step 'I start "I2PBrowser" via the GNOME "Internet" applications menu'
21 Then /^the I2P Browser desktop file is (|not )present$/ do |mode|
22 next if @skip_steps_while_restoring_background
23 file = '/usr/share/applications/i2p-browser.desktop'
25 assert(@vm.execute("test -e #{file}").success?)
27 assert(@vm.execute("! test -e #{file}").success?)
29 raise "Unsupported mode passed: '#{mode}'"
33 Then /^the I2P Browser sudo rules are (enabled|not present)$/ do |mode|
34 next if @skip_steps_while_restoring_background
35 file = '/etc/sudoers.d/zzz_i2pbrowser'
37 assert(@vm.execute("test -e #{file}").success?)
38 elsif mode == 'not present'
39 assert(@vm.execute("! test -e #{file}").success?)
41 raise "Unsupported mode passed: '#{mode}'"
45 Then /^the I2P firewall rules are (enabled|disabled)$/ do |mode|
46 next if @skip_steps_while_restoring_background
47 i2p_username = 'i2psvc'
48 i2p_uid = @vm.execute("getent passwd #{i2p_username} | awk -F ':' '{print $3}'").stdout.chomp
49 accept_rules = @vm.execute("iptables -L -n -v | grep -E '^\s+[0-9]+\s+[0-9]+\s+ACCEPT.*owner UID match #{i2p_uid}$'").stdout
50 accept_rules_count = accept_rules.lines.count
52 assert_equal(13, accept_rules_count)
53 elsif mode == 'disabled'
54 assert_equal(0, accept_rules_count)
56 raise "Unsupported mode passed: '#{mode}'"