From 9b200c7c728604018bc56638a3d5e86c29d69099 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Tue, 11 Jun 2013 20:25:56 -0400 Subject: Add CA-less install tests Differences from the test plan at http://www.freeipa.org/index.php?title=V3/CA-less_install&oldid=6669 are: - The following tests are included in all applicable positive install tests, rather than being standalone test cases: - Verify CA certificate stored in LDAP - Verify CA PEM file created by IPA server install - Verify that IPA server install does not configure certmonger - Verify CA PEM file created by IPA replica install - Verify that IPA replica install does not configure certmonger - Verify CA PEM file created by IPA client install - PKI setup is done only once for each test class - Master installation is done once for the IPA command tests, and once for the certinstall tests - Certificates are compared after base64 decoding to avoid failures from formatting mismatches - Minor changes necessary for automation (e.g. adding --unattended and --password options, correcting error messages) - Web UI tests are not included here https://fedorahosted.org/freeipa/ticket/3830 --- .../test_integration/scripts/caless-create-pki | 116 +++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 ipatests/test_integration/scripts/caless-create-pki (limited to 'ipatests/test_integration/scripts') diff --git a/ipatests/test_integration/scripts/caless-create-pki b/ipatests/test_integration/scripts/caless-create-pki new file mode 100644 index 00000000..a0b6f13c --- /dev/null +++ b/ipatests/test_integration/scripts/caless-create-pki @@ -0,0 +1,116 @@ +#!/bin/bash -e + +profile_ca=(-t CT,C,C -v 120) +profile_server=(-t ,, -v 12) + +crl_path=${crl_path-$(readlink -f $dbdir)} + +gen_cert() { + local profile="$1" nick="$2" subject="$3" ca options pwfile noise csr crt + shift 3 + + echo "gen_cert(profile=$profile nick=$nick subject=$subject)" + + ca="$(dirname $nick)" + if [ "$ca" = "." ]; then + ca="$nick" + fi + + eval "options=(\"\${profile_$profile[@]}\")" + if [ "$ca" = "$nick" ]; then + options=("${options[@]}" -x -m 1) + else + options=("${options[@]}" -c "$ca") + fi + + pwfile="$(mktemp)" + echo "$dbpassword" >"$pwfile" + + noise="$(mktemp)" + head -c 20 /dev/urandom >"$noise" + + if [ ! -d "$dbdir" ]; then + mkdir "$dbdir" + certutil -N -d "$dbdir" -f "$pwfile" + fi + + csr="$(mktemp)" + crt="$(mktemp)" + certutil -R -d "$dbdir" -s "$subject" -f "$pwfile" -z "$noise" -o "$csr" -4 >/dev/null <"$pwfile" + + if ! crlutil -L -d "$dbdir" -n "$ca" &>/dev/null; then + crlutil -G -d "$dbdir" -n "$ca" -c /dev/null -f "$pwfile" + fi + + sleep 1 + + mkdir -p "$(dirname $dbdir/$ca.crl)" + serial=$(certutil -L -d "$dbdir" -n "$nick" | awk '/^\s+Serial Number: / { print $3 }') + crlutil -M -d "$dbdir" -n "$ca" -c /dev/stdin -f "$pwfile" -o "$dbdir/$ca.crl" <