summaryrefslogtreecommitdiffstats
path: root/tests/dogtag/acceptance/install-tests/tks-installer.sh
blob: 654a2a1cd5d2b25357e7abf1449403033a7c8708 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
#   runtest.sh of /CoreOS/rhcs/acceptance/cli-tests/installer-tests/tks-installer.sh
#   Description: PKI TKS Installer Test
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
#   Copyright (c) 2013 Red Hat, Inc. All rights reserved.
#
#   This copyrighted material is made available to anyone wishing
#   to use, modify, copy, or redistribute it subject to the terms
#   and conditions of the GNU General Public License version 2.
#
#   This program is distributed in the hope that it will be
#   useful, but WITHOUT ANY WARRANTY; without even the implied
#   warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
#   PURPOSE. See the GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public
#   License along with this program; if not, write to the Free
#   Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
#   Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include files
. ./acceptance/quickinstall/rhcs-set-time.sh
. ./acceptance/quickinstall/rhcs-install.sh
. ./acceptance/quickinstall/rhcs-install-lib.sh
. /opt/rhqa_pki/env.sh
run_rhcs_tks_installer_tests()
{
	subsystemId=$1
	SUBSYSTEM_TYPE=$2
	MYROLE=$3
	if [ "$TOPO9" = "TRUE" ] ; then
        	ADMIN_CERT_LOCATION=$(eval echo \$${subsystemId}_ADMIN_CERT_LOCATION)
	        prefix=$subsystemId
        	CLIENT_PKCS12_PASSWORD=$(eval echo \$${subsystemId}_CLIENT_PKCS12_PASSWORD)
	elif [ "$MYROLE" = "MASTER" ] ; then
        	if [[ $subsystemId == SUBCA* ]]; then
                	ADMIN_CERT_LOCATION=$(eval echo \$${subsystemId}_ADMIN_CERT_LOCATION)
	                prefix=$subsystemId
        	        CLIENT_PKCS12_PASSWORD=$(eval echo \$${subsystemId}_CLIENT_PKCS12_PASSWORD)	
        	else
                	ADMIN_CERT_LOCATION=$ROOTCA_ADMIN_CERT_LOCATION
	                prefix=ROOTCA
        	        CLIENT_PKCS12_PASSWORD=$ROOTCA_CLIENT_PKCS12_PASSWORD
        	fi
	else
        	ADMIN_CERT_LOCATION=$(eval echo \$${MYROLE}_ADMIN_CERT_LOCATION)
	        prefix=$MYROLE
	        CLIENT_PKCS12_PASSWORD=$(eval echo \$${MYROLE}_CLIENT_PKCS12_PASSWORD)
	fi

	SUBSYSTEM_HOST=$(eval echo \$${MYROLE})
	INSTANCECFG=/tmp/tks_instance.inf
	##### Create a temporary directory to save output files #####
	rlPhaseStartSetup "pki_run_rhcs_tks_installer_tests: Create temporary directory"
        	rlRun "TmpDir=\`mktemp -d\`" 0 "Creating tmp directory"
        	rlRun "pushd $TmpDir"
	rlPhaseEnd
 	rlPhaseStartTest "pki_run_rhcs_tks_installer_tests-001: Installing and Uninstalling TKS"
 		 local number=3
		 local BEAKERMASTER=`hostname`
		 local CA=ROOTCA
                 run_rhcs_install_packages
                 run_install_subsystem_RootCA 
		 run_install_subsystem_TKS $number $BEAKERMASTER $CA
                 rlRun "pkidaemon status tomcat > $TmpDir/tks-install.out"
                 exp_message2_1="PKI Instance Name:   $(eval echo \$${prefix}_TOMCAT_INSTANCE_NAME)"
                 rlAssertGrep "$exp_message2_1" "$TmpDir/tks-install.out"
                 exp_message2_2="PKI Subsystem Type:   (Security Domain)"
                 rlAssertGrep "$exp_message2_2" "$TmpDir/tks-install.out"
                 rlLog "Uninstall TKS tests"
                 rlRun "pkidestroy -s TKS -i $(eval echo \$${prefix}_TOMCAT_INSTANCE_NAME)" > $TmpDir/uninstallKRA.out
                 exp_message2_3 "Uninstallation complete" "$TmpDir/uninstallTKS.out"
                 rlAssertGrep "$exp_message2_3" "$TmpDir/uninstallTKS.out"
 
         rlPhaseEnd
	rlPhaseStartTest "pki_run_rhcs_tks_installer_tests-002: SSL cert parameters"
		cp $INSTANCECFG $TmpDir/tmpconfig1.in
		sed -i -e "/pki_ssl_server_key_type/d" $TmpDir/tmpconfig1.in
		sed -i -e "/pki_ssl_server_token/d" $TmpDir/tmpconfig1.in
		sed -i -e "/pki_ssl_server_signing_algorithm/d" $TmpDir/tmpconfig1.in
		sed -i -e "/pki_ssl_server_key_algorithm/d" $TmpDir/tmpconfig1.in
		sed -i -e "/pki_ssl_server_key_size/d" $TmpDir/tmpconfig1.in
		sed -i -e "/pki_ssl_server_nickname/d" $TmpDir/tmpconfig1.in
		sed -i -e "/pki_ssl_server_subject_dn/d" $TmpDir/tmpconfig1.in
		rlRun "pkispawn -s TKS -f $TmpDir/tmpconfig1.in  > $TmpDir/tks_ssl.out 2>&1" 1 "Should fail"
                exp_messg3="Installation Failed."
                rlAssertGrep "$exp_messg3" "$TmpDir/tks_ssl.out"
	rlPhaseEnd
}