tests: Use journalctl -g to check for failed login

/var/log/audit/audit.log isn't always available (eg. tar liveimg
install), but it is logged to the journal, which can be grepped with
'journalctl -g' so use that instead.

Cherry-picked from 89539a7bf4

Related: rhbz#1769525
This commit is contained in:
Brian C. Lane 2019-10-31 14:14:29 -07:00 committed by Alexander Todorov
parent a7c9c049eb
commit bb4b6b7059

View File

@ -137,7 +137,7 @@ check_root_account() {
0 "Can't ssh to '$SSH_MACHINE' as root using password-based auth" 0 "Can't ssh to '$SSH_MACHINE' as root using password-based auth"
rlRun -t -c "ssh $SSH_OPTS ${SSH_USER}@${SSH_MACHINE} \"$SUDO passwd --status root | grep -E '^root\s+LK?'\"" \ rlRun -t -c "ssh $SSH_OPTS ${SSH_USER}@${SSH_MACHINE} \"$SUDO passwd --status root | grep -E '^root\s+LK?'\"" \
0 "root account is disabled in /etc/shadow" 0 "root account is disabled in /etc/shadow"
rlRun -t -c "ssh $SSH_OPTS ${SSH_USER}@${SSH_MACHINE} \"$SUDO grep 'USER_LOGIN.*acct=\\\"root\\\".*terminal=ssh.*res=failed' /var/log/audit/audit.log\"" \ rlRun -t -c "ssh $SSH_OPTS ${SSH_USER}@${SSH_MACHINE} \"$SUDO journalctl -g 'USER_LOGIN.*acct=\\\"root\\\".*terminal=ssh.*res=failed'\"" \
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