From abada88a7061e2abaea2fdc13652223ad40eac946b2ae8edc9c84a4ebd96041c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=C4=9Bzslav=20=C4=8C=C3=AD=C5=BEek?= Date: Mon, 5 Oct 2015 10:47:37 +0000 Subject: [PATCH] Accepting request 335936 from home:pgajdos:apache2 - test module with %apache_test_module_curl OBS-URL: https://build.opensuse.org/request/show/335936 OBS-URL: https://build.opensuse.org/package/show/Apache:Modules/apache2-mod_nss?expand=0&rev=15 --- apache2-mod_nss.changes | 5 +++++ apache2-mod_nss.spec | 48 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/apache2-mod_nss.changes b/apache2-mod_nss.changes index bdcb413..c702caa 100644 --- a/apache2-mod_nss.changes +++ b/apache2-mod_nss.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Fri Oct 2 14:35:41 UTC 2015 - pgajdos@suse.com + +- test module with %apache_test_module_curl + ------------------------------------------------------------------- Mon Sep 7 08:25:03 UTC 2015 - vcizek@suse.com diff --git a/apache2-mod_nss.spec b/apache2-mod_nss.spec index 2e07f11..f0af8e6 100644 --- a/apache2-mod_nss.spec +++ b/apache2-mod_nss.spec @@ -39,6 +39,7 @@ PreReq: mozilla-nss-tools BuildRequires: apache-rpm-macros BuildRequires: apache2-devel >= 2.2.12 BuildRequires: bison +BuildRequires: curl BuildRequires: findutils BuildRequires: flex BuildRequires: gcc-c++ @@ -189,8 +190,51 @@ touch $RPM_BUILD_ROOT%{apache_sysconf_nssdir}/key3.db touch $RPM_BUILD_ROOT%{apache_sysconf_nssdir}/install.log perl -pi -e "s:$NSS_LIB_DIR:$NSS_BIN:" $RPM_BUILD_ROOT%{_sbindir}/gencert -%clean -rm -rf $RPM_BUILD_ROOT +%check +set +x +mkdir -p %{apache_test_module_dir} +# create test configuration +cat << EOF > %{apache_test_module_dir}/mod_nss-test.conf +NSSEngine on +NSSNickname Server-Cert +NSSCertificateDatabase %{apache_test_module_dir}/mod_nss.d +NSSPassPhraseHelper %{buildroot}/usr/sbin/nss_pcache +NSSCipherSuite +ecdhe_ecdsa_aes_128_gcm_sha,+ecdh_ecdsa_aes_128_gcm_sha,+ecdhe_rsa_aes_256_sha,+ecdh_rsa_aes_256_sha,+ecdhe_rsa_aes_128_gcm_sha,+ecdh_rsa_aes_128_gcm_sha,+ecdhe_rsa_aes_128_sha,+ecdh_rsa_aes_128_sha,+rsa_aes_128_gcm_sha,+rsa_aes_256_sha,+rsa_aes_128_sha,+rsa_aes_128_sha256,+rsa_aes_256_sha256 +NSSProtocol TLSv1.0,TLSv1.1,TLSv1.2 + + Require local + +EOF +# create test certificate +mkdir -p %{apache_test_module_dir}/mod_nss.d +# bend gencert to use ServerName of apache test instance +cp %{buildroot}%{_sbindir}/gencert . +sed -i 's:FQDN=`getFQDN`:FQDN=test:' gencert +./gencert %{apache_test_module_dir}/mod_nss.d > %{apache_test_module_dir}/mod_nss.d/LOG 2>&1 +# create test document +mkdir -p %{apache_test_module_dir}/htdocs +cat << EOF > %{apache_test_module_dir}/htdocs/index.html +HTTPS HELLO +EOF +exit_code=0 +# run apache test instance +%apache_test_module_start_apache -m nss -i mod_nss-test.conf +# get test document +%apache_test_module_curl -r https -d /index.html -o %{apache_test_module_dir}/output.txt +echo +echo 'Testing /index.html output' +grep 'HTTPS HELLO' %{apache_test_module_dir}/output.txt || exit_code=1 +if [ $exit_code -eq 0 ]; then + echo 'SUCCESS' +else + echo 'FAILED, error_log:' + cat %{apache_test_module_dir}/error_log +fi +echo +# stop apache test instance +%apache_test_module_stop_apache +set -x +exit $exit_code %post umask 077