Blame tests/p_ipa-server/6-dnsdetails.sh

James Hogarth 352003
#!/bin/bash
James Hogarth 352003
# Author: James Hogarth <james.hogarth@gmail.com>
James Hogarth 352003
#
James Hogarth 352003
James Hogarth acc301
if (t_GetPkgRel basesystem | grep -q el6)
James Hogarth acc301
then
James Hogarth acc301
James Hogarth 352003
# Need admin credentials
James Hogarth 352003
kdestroy &> /dev/null
James Hogarth 352003
James Hogarth 352003
klist 2>&1  | grep "No credentials" &> /dev/null
James Hogarth 352003
James Hogarth 352003
t_CheckExitStatus $?
James Hogarth 352003
James Hogarth 352003
expect -f - &> /dev/null <
James Hogarth 352003
set send_human {.1 .3 1 .05 2}
James Hogarth 352003
spawn kinit admin
James Hogarth 352003
sleep 1
James Hogarth 352003
expect "Password for admin@C6IPA.LOCAL:"
James Hogarth 352003
send -h "p455w0rd\r"
James Hogarth 352003
sleep 1
James Hogarth 352003
close
James Hogarth 352003
EOF
James Hogarth 352003
James Hogarth 352003
klist | grep "admin@C6IPA.LOCAL" &> /dev/null
James Hogarth 352003
James Hogarth 352003
t_CheckExitStatus $?
James Hogarth 352003
James Hogarth 352003
#Add zone
James Hogarth 352003
t_Log "Running $0 - Adding a subdomain 'testzone'"
James Hogarth 0a8a3f
ipa dnszone-add --name-server=c6test.c6ipa.local. --admin-email=hostmaster.testzone.c6ipa.local. testzone.c6ipa.local &> /dev/null
James Hogarth 352003
t_CheckExitStatus $?
James Hogarth 352003
James Hogarth 352003
#Can get SOA for new zone from DNS
James Hogarth 352003
James Hogarth 352003
#Add record to standard zone
James Hogarth 352003
t_Log "Running $0 - Adding a testrecord to main domain"
James Hogarth 0a8a3f
ipa dnsrecord-add c6ipa.local testrecord --cname-hostname=c6test &> /dev/null
James Hogarth 352003
t_CheckExitStatus $?
James Hogarth 352003
James Hogarth 352003
#Can get record from DNS
James Hogarth 352003
t_Log "Running $0 - Testing can retrieve record"
James Hogarth 352003
dig @localhost -t CNAME testrecord.c6ipa.local | grep "status: NOERROR" &> /dev/null
James Hogarth 352003
t_CheckExitStatus $?
James Hogarth 352003
James Hogarth 352003
#Add record to new zone
James Hogarth 352003
t_Log "Running $0 - Adding a testrecord to subdomain"
James Hogarth 0a8a3f
ipa dnsrecord-add testzone.c6ipa.local testrecord --cname-hostname=c6test.c6ipa.local. &> /dev/null
James Hogarth 352003
t_CheckExitStatus $?
James Hogarth 352003
James Hogarth 352003
#Can get record from DNS for new zone
James Hogarth 352003
t_Log "Running $0 - Testing can retrieve record from subdomain"
James Hogarth 352003
dig @localhost -t CNAME testrecord.testzone.c6ipa.local | grep "status: NOERROR" &> /dev/null
James Hogarth 352003
t_CheckExitStatus $?
James Hogarth 352003
James Hogarth 352003
#Configure global options instead of named.conf for forwarders - note this is looking for an ipv4 adddress ... there is no testing on ipv6 at this point
James Hogarth 352003
t_Log "Running $0 - Changing configuration to use LDAP for forwarder configuration"
James Hogarth 352003
forwarder="$(sed -n '1,/forwarders/!{ /};/,/forwarders/!s/^//p;}' /etc/named.conf |  sed 's/^[ \t]*\([0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\);$/\1/')"
James Hogarth 352003
sed -i '/forwarders/{N ; s/\n.*// }' /etc/named.conf
James Hogarth 352003
service named restart
James Hogarth 352003
t_CheckExitStatus $?
James Hogarth 0a8a3f
ipa dnsconfig-mod --forwarder=${forwarder} &> /dev/null
James Hogarth 352003
t_CheckExitStatus $?
James Hogarth 352003
James Hogarth 352003
#Regression test of RHBA-2103-0739
James Hogarth 352003
for i in {1..30}
James Hogarth 352003
do
James Hogarth 352003
service named reload &> /dev/null
James Hogarth 352003
service named status &> /dev/null || t_CheckExitStatus $?
James Hogarth 352003
sleep 1
James Hogarth 352003
done
James Hogarth 352003
James Hogarth 352003
t_CheckExitStatus $?
James Hogarth 352003
James Hogarth acc301
else
James Hogarth acc301
    echo "Skipped on CentOS 5"
James Hogarth acc301
fi
James Hogarth acc301