Fixes for locked root account test

Fixes related to a few issues in the locked root account test I somehow
managed to overlook in the initial commit.

(cherry picked from commit 209bdd6911)
(cherry picked from commit 08ae3613fe)
This commit is contained in:
Jiri Kortus 2019-04-08 09:32:19 +02:00 committed by Brian C. Lane
parent 56699c4818
commit 33451f0a60
2 changed files with 3 additions and 2 deletions

View File

@ -10,6 +10,7 @@ check_root_account() {
local ssh_opts="-o StrictHostKeyChecking=no $3" local ssh_opts="-o StrictHostKeyChecking=no $3"
local user="$1" local user="$1"
local machine="$2" local machine="$2"
ROOT_ACCOUNT_LOCKED=${ROOT_ACCOUNT_LOCKED:-1}
if [[ "$user" == "" || "$machine" == "" ]]; then if [[ "$user" == "" || "$machine" == "" ]]; then
rlFail "check_root_account: Missing user or machine parameter." rlFail "check_root_account: Missing user or machine parameter."
return 1 return 1
@ -28,7 +29,7 @@ check_root_account() {
0 "audit.log contains entry about unsuccessful root login" 0 "audit.log contains entry about unsuccessful root login"
# We modify the default sshd settings on live ISO, so we can only check the default empty password setting # We modify the default sshd settings on live ISO, so we can only check the default empty password setting
# outside of live ISO # outside of live ISO
rlRun -t -c "ssh $ssh_opts ${user}@${machine} 'grep -E \"^[[:blank:]]*PermitEmptyPasswords[[:blank:]]*yes\" /etc/ssh/sshd_config'" 1 \ rlRun -t -c "ssh $ssh_opts ${user}@${machine} 'sudo grep -E \"^[[:blank:]]*PermitEmptyPasswords[[:blank:]]*yes\" /etc/ssh/sshd_config'" 1 \
"Login with empty passwords is disabled in sshd config file" "Login with empty passwords is disabled in sshd config file"
fi fi
rlRun -t -c "ssh $ssh_opts ${user}@${machine} 'cat /etc/redhat-release'" rlRun -t -c "ssh $ssh_opts ${user}@${machine} 'cat /etc/redhat-release'"

View File

@ -75,7 +75,7 @@ __EOF__
rlPhaseStartTest "Verify VM instance" rlPhaseStartTest "Verify VM instance"
# verify we can login into that instance and root account is disabled # verify we can login into that instance and root account is disabled
. ./tests/cli/lib/root_account.sh . ./tests/cli/lib/root_account.sh
check_root_account $CLOUD_USER $IP_ADDRESS "-i $SSH_KEY_DIR/id_rsa -p 2222" check_root_account root localhost "-i $SSH_KEY_DIR/id_rsa -p 2222"
rlPhaseEnd rlPhaseEnd
rlPhaseStartCleanup rlPhaseStartCleanup