1 Then /^I should be able to run administration commands as the live user$/ do
2 next if @skip_steps_while_restoring_background
3 stdout = @vm.execute("echo #{@sudo_password} | sudo -S whoami", $live_user).stdout
4 assert(stdout.sub(/^\[sudo\] password for #{$live_user}: /, "") == "root\n",
8 Then /^I should not be able to run administration commands as the live user with the "([^"]*)" password$/ do |password|
9 next if @skip_steps_while_restoring_background
10 stderr = @vm.execute("echo #{password} | sudo -S whoami", $live_user).stderr
11 sudo_failed = stderr.include?("The administration password is disabled") || stderr.include?("is not allowed to execute")
12 assert(sudo_failed, "The administration password is not disabled:" + stderr)
15 When /^running a command as root with pkexec requires PolicyKit administrator privileges$/ do
16 next if @skip_steps_while_restoring_background
17 action = 'org.freedesktop.policykit.exec'
18 action_details = @vm.execute("pkaction --verbose --action-id #{action}").stdout
19 assert(action_details[/\s+implicit any:\s+auth_admin$/],
20 "Expected 'auth_admin' for 'any':\n#{action_details}")
21 assert(action_details[/\s+implicit inactive:\s+auth_admin$/],
22 "Expected 'auth_admin' for 'inactive':\n#{action_details}")
23 assert(action_details[/\s+implicit active:\s+auth_admin$/],
24 "Expected 'auth_admin' for 'active':\n#{action_details}")
27 Then /^I should be able to run a command as root with pkexec$/ do
28 next if @skip_steps_while_restoring_background
29 step 'I run "gnome-terminal"'
30 @screen.wait_and_click('GnomeTerminalWindow.png', 20)
31 @screen.type('pkexec touch /root/pkexec-test' + Sikuli::Key.ENTER)
32 step 'I enter the sudo password in the pkexec prompt'
33 try_for(10, :msg => 'The /root/pkexec-test file was not created.') {
34 @vm.execute('ls /root/pkexec-test').success?
38 Then /^I should not be able to run a command as root with pkexec and the standard passwords$/ do
39 next if @skip_steps_while_restoring_background
40 step 'I run "gnome-terminal"'
41 @screen.wait_and_click('GnomeTerminalWindow.png', 20)
42 @screen.type('pkexec touch /root/pkexec-test' + Sikuli::Key.ENTER)
43 ['', 'live'].each do |password|
44 step "I enter the \"#{password}\" password in the pkexec prompt"
45 @screen.wait('PolicyKitAuthFailure.png', 20)
47 step "I enter the \"amnesia\" password in the pkexec prompt"
48 @screen.wait('PolicyKitAuthCompleteFailure.png', 20)