|
James Hogarth |
a5d690 |
#!/bin/bash
|
|
James Hogarth |
a5d690 |
# Author: James Hogarth <james.hogarth@gmail.com>
|
|
James Hogarth |
a5d690 |
#
|
|
|
88f3cf |
if [ "$PRE_UPDATES" == "1" ]; then
|
|
|
88f3cf |
t_Log "skipping $0 for pre update testing"
|
|
|
88f3cf |
exit 0
|
|
|
88f3cf |
fi
|
|
James Hogarth |
a5d690 |
|
|
|
c1e011 |
if (t_GetPkgRel basesystem | grep -qE 'el(6|7)') && !(t_GetArch | grep -qE 'aarch64')
|
|
James Hogarth |
acc301 |
then
|
|
James Hogarth |
acc301 |
|
|
James Hogarth |
a5d690 |
# Need admin credentials
|
|
James Hogarth |
a5d690 |
kdestroy &> /dev/null
|
|
James Hogarth |
a5d690 |
|
|
James Hogarth |
6c929b |
klist 2>&1 | grep -E "(No credentials|Credentials cache .* not found)" &> /dev/null
|
|
James Hogarth |
a5d690 |
|
|
James Hogarth |
a5d690 |
t_CheckExitStatus $?
|
|
James Hogarth |
a5d690 |
|
|
James Hogarth |
19cf3b |
expect -f - <
|
|
James Hogarth |
a5d690 |
set send_human {.1 .3 1 .05 2}
|
|
James Hogarth |
a5d690 |
spawn kinit admin
|
|
James Hogarth |
a5d690 |
sleep 1
|
|
James Hogarth |
a5d690 |
expect "Password for admin@C6IPA.LOCAL:"
|
|
James Hogarth |
a5d690 |
send -h "p455w0rd\r"
|
|
James Hogarth |
8030de |
sleep 5
|
|
James Hogarth |
a5d690 |
close
|
|
James Hogarth |
a5d690 |
EOF
|
|
James Hogarth |
a5d690 |
|
|
James Hogarth |
a5d690 |
klist | grep "admin@C6IPA.LOCAL" &> /dev/null
|
|
James Hogarth |
a5d690 |
|
|
James Hogarth |
a5d690 |
t_CheckExitStatus $?
|
|
James Hogarth |
a5d690 |
|
|
James Hogarth |
a5d690 |
|
|
James Hogarth |
a5d690 |
|
|
James Hogarth |
a5d690 |
t_Log "Running $0 - test adding user"
|
|
James Hogarth |
0a8a3f |
userdetails="$(ipa user-add --first=test --last=user --random ipatestuser)"
|
|
James Hogarth |
0a8a3f |
echo "$userdetails" | grep 'Added user "ipatestuser"' &> /dev/null
|
|
James Hogarth |
a5d690 |
|
|
James Hogarth |
a5d690 |
t_CheckExitStatus $?
|
|
James Hogarth |
a5d690 |
|
|
James Hogarth |
a5d690 |
t_Log "Running $0 - verify details of user"
|
|
James Hogarth |
a5d690 |
|
|
James Hogarth |
a5d690 |
echo "$userdetails" | grep ' First name: test' &> /dev/null
|
|
James Hogarth |
a5d690 |
|
|
James Hogarth |
a5d690 |
t_CheckExitStatus $?
|
|
James Hogarth |
a5d690 |
|
|
James Hogarth |
a5d690 |
echo "$userdetails" | grep 'Last name: user' &> /dev/null
|
|
James Hogarth |
a5d690 |
|
|
James Hogarth |
a5d690 |
t_CheckExitStatus $?
|
|
James Hogarth |
a5d690 |
|
|
James Hogarth |
a5d690 |
echo "$userdetails" | grep 'Full name: test user' &> /dev/null
|
|
James Hogarth |
a5d690 |
|
|
James Hogarth |
a5d690 |
t_CheckExitStatus $?
|
|
James Hogarth |
a5d690 |
|
|
James Hogarth |
0a8a3f |
echo "$userdetails" | grep 'Home directory: /home/ipatestuser' &> /dev/null
|
|
James Hogarth |
a5d690 |
|
|
James Hogarth |
a5d690 |
t_CheckExitStatus $?
|
|
James Hogarth |
a5d690 |
|
|
James Hogarth |
a5d690 |
t_Log "Running $0 - testing initial password change of user"
|
|
James Hogarth |
a5d690 |
kdestroy &> /dev/null
|
|
James Hogarth |
a5d690 |
|
|
James Hogarth |
19cf3b |
expect -f - <
|
|
James Hogarth |
a5d690 |
set send_human {.1 .3 1 .05 2}
|
|
James Hogarth |
0a8a3f |
spawn kinit ipatestuser
|
|
James Hogarth |
a5d690 |
sleep 1
|
|
James Hogarth |
0a8a3f |
expect "Password for ipatestuser@C6IPA.LOCAL: "
|
|
James Hogarth |
a5d690 |
send -h -- "$(echo "$userdetails" | awk '$0 ~ /Random password/ {print $3}')\r"
|
|
James Hogarth |
a5d690 |
sleep 1
|
|
James Hogarth |
a5d690 |
expect "Enter new password: "
|
|
James Hogarth |
a5d690 |
send -h -- "newp455w0rd\r"
|
|
James Hogarth |
a5d690 |
sleep 1
|
|
James Hogarth |
a5d690 |
expect "Enter it again: "
|
|
James Hogarth |
a5d690 |
send -h -- "newp455w0rd\r"
|
|
James Hogarth |
8030de |
sleep 5
|
|
James Hogarth |
a5d690 |
close
|
|
James Hogarth |
a5d690 |
EOF
|
|
James Hogarth |
a5d690 |
|
|
James Hogarth |
19cf3b |
# Change in behaviour appears from C6.5 to C6.6 and kinit with expiry no longer results in kerberos ticket right away
|
|
James Hogarth |
19cf3b |
|
|
James Hogarth |
19cf3b |
expect -f - <
|
|
James Hogarth |
19cf3b |
set send_human {.1 .3 1 .05 2}
|
|
James Hogarth |
19cf3b |
spawn kinit ipatestuser
|
|
James Hogarth |
19cf3b |
sleep 1
|
|
James Hogarth |
19cf3b |
expect "Password for ipatestuser@C6IPA.LOCAL:"
|
|
James Hogarth |
19cf3b |
send -h "newp455w0rd\r"
|
|
James Hogarth |
19cf3b |
sleep 1
|
|
James Hogarth |
19cf3b |
close
|
|
James Hogarth |
19cf3b |
EOF
|
|
James Hogarth |
19cf3b |
|
|
James Hogarth |
19cf3b |
|
|
James Hogarth |
0a8a3f |
klist | grep "ipatestuser@C6IPA.LOCAL" &> /dev/null
|
|
James Hogarth |
a5d690 |
|
|
James Hogarth |
a5d690 |
t_CheckExitStatus $?
|
|
James Hogarth |
a5d690 |
|
|
James Hogarth |
a5d690 |
kdestroy &> /dev/null
|
|
James Hogarth |
a5d690 |
|
|
James Hogarth |
689957 |
|
|
James Hogarth |
689957 |
t_Log "Running $0 - testing ipatestuser is in getent"
|
|
James Hogarth |
689957 |
getent passwd ipatestuser &> /dev/null
|
|
James Hogarth |
689957 |
t_CheckExitStatus $?
|
|
James Hogarth |
689957 |
|
|
James Hogarth |
acc301 |
else
|
|
|
c1e011 |
echo "Skipped on CentOS 5 and AArch64"
|
|
James Hogarth |
acc301 |
fi
|
|
James Hogarth |
a5d690 |
|
|
James Hogarth |
a5d690 |
|