From 71dbe133d9c59ba22da52bfe7f1d416243f9d2ae Mon Sep 17 00:00:00 2001 From: James Hogarth Date: Jul 30 2013 13:34:10 +0000 Subject: added service tests --- diff --git a/tests/p_ipa-server/4-addservice.sh b/tests/p_ipa-server/4-addservice.sh new file mode 100755 index 0000000..4e43eaf --- /dev/null +++ b/tests/p_ipa-server/4-addservice.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# Author: James Hogarth +# + +# Need admin credentials +kdestroy &> /dev/null + +klist 2>&1 | grep "No credentials" &> /dev/null + +t_CheckExitStatus $? + +expect -f - &> /dev/null < /dev/null + +t_CheckExitStatus $? + + +t_Log "Running $0 - Adding test service" +ipa service-add testservice/c6test.c6ipa.local + +t_CheckExitStatus $? + +t_Log "Running $0 - getting keytab for service" +ipa-getkeytab -s c6test.c6ipa.local -p testservice/c6test.c6ipa.local -k /tmp/testservice.keytab +t_CheckExitStatus $? + +t_Log "Running $0 - getting certificate for service" +ipa-getcert request -K testservice/c6test.c6ipa.local -D c6test.c6ipa.local -f /etc/pki/tls/certs/testservice.crt -k /etc/pki/tls/private/testservice.key +t_CheckExitStatus $? + +t_Log "Running $0 - verifying keytab" +klist -k /tmp/testservice.keytab | grep "testservice/c6test.c6ipa.local" &> /dev/null +t_CheckExitStatus $? + +t_Log "Running $0 - verifying key matches certificate" +diff <(openssl x509 -in /etc/pki/tls/certs/testservice.crt -noout -modulus) <(openssl rsa -in /etc/pki/tls/private/testservice.key -noout -modulus) +t_CheckExitStatus $? + +t_Log "Running $0 - verifying certificate against CA" +openssl verify -CAfile /etc/ipa/ca.crt /etc/pki/tls/certs/testservice.crt | grep "/etc/pki/tls/certs/testservice.crt: OK" &> /dev/null +t_CheckExitStatus $? + + +