From da080c472fc415b0ce918f4dd4a1ab143bb1bca4 Mon Sep 17 00:00:00 2001 From: Philip Hands Date: Mon, 14 Mar 2016 15:36:16 +0100 Subject: rough attempt to grab the good cucumber bits from recent tails --- features/step_definitions/root_access_control.rb | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'features/step_definitions/root_access_control.rb') diff --git a/features/step_definitions/root_access_control.rb b/features/step_definitions/root_access_control.rb index aaebb0df..ff1bdfcc 100644 --- a/features/step_definitions/root_access_control.rb +++ b/features/step_definitions/root_access_control.rb @@ -1,21 +1,20 @@ Then /^I should be able to run administration commands as the live user$/ do - next if @skip_steps_while_restoring_background - stdout = @vm.execute("echo #{@sudo_password} | sudo -S whoami", $live_user).stdout - actual_user = stdout.sub(/^\[sudo\] password for #{$live_user}: /, "").chomp + stdout = $vm.execute("echo #{@sudo_password} | sudo -S whoami", + :user => LIVE_USER).stdout + actual_user = stdout.sub(/^\[sudo\] password for #{LIVE_USER}: /, "").chomp assert_equal("root", actual_user, "Could not use sudo") end Then /^I should not be able to run administration commands as the live user with the "([^"]*)" password$/ do |password| - next if @skip_steps_while_restoring_background - stderr = @vm.execute("echo #{password} | sudo -S whoami", $live_user).stderr + stderr = $vm.execute("echo #{password} | sudo -S whoami", + :user => LIVE_USER).stderr sudo_failed = stderr.include?("The administration password is disabled") || stderr.include?("is not allowed to execute") assert(sudo_failed, "The administration password is not disabled:" + stderr) end When /^running a command as root with pkexec requires PolicyKit administrator privileges$/ do - next if @skip_steps_while_restoring_background action = 'org.freedesktop.policykit.exec' - action_details = @vm.execute("pkaction --verbose --action-id #{action}").stdout + action_details = $vm.execute("pkaction --verbose --action-id #{action}").stdout assert(action_details[/\s+implicit any:\s+auth_admin$/], "Expected 'auth_admin' for 'any':\n#{action_details}") assert(action_details[/\s+implicit inactive:\s+auth_admin$/], @@ -25,21 +24,19 @@ When /^running a command as root with pkexec requires PolicyKit administrator pr end Then /^I should be able to run a command as root with pkexec$/ do - next if @skip_steps_while_restoring_background step "I run \"pkexec touch /root/pkexec-test\" in GNOME Terminal" step 'I enter the sudo password in the pkexec prompt' try_for(10, :msg => 'The /root/pkexec-test file was not created.') { - @vm.execute('ls /root/pkexec-test').success? + $vm.execute('ls /root/pkexec-test').success? } end Then /^I should not be able to run a command as root with pkexec and the standard passwords$/ do - next if @skip_steps_while_restoring_background step "I run \"pkexec touch /root/pkexec-test\" in GNOME Terminal" - ['', 'live'].each do |password| + ['', 'live', 'amnesia'].each do |password| step "I enter the \"#{password}\" password in the pkexec prompt" @screen.wait('PolicyKitAuthFailure.png', 20) end - step "I enter the \"amnesia\" password in the pkexec prompt" + @screen.type(Sikuli::Key.ESC) @screen.wait('PolicyKitAuthCompleteFailure.png', 20) end -- cgit v1.2.3-70-g09d2