8c02ed
%{!?_httpd_mmn: %{expand: %%global _httpd_mmn %%(cat %{_includedir}/httpd/.mmn || echo 0-0)}}
8c02ed
%{!?_httpd_moddir: %{expand: %%global _httpd_moddir %%{_libdir}/httpd/modules}}
8c02ed
%{!?_httpd_confdir: %{expand: %%global _httpd_confdir %{_sysconfdir}/httpd/conf.d}}
8c02ed
8c02ed
# Optionally build with hiredis if --with hiredis is passed
8c02ed
%{!?_with_hiredis: %{!?_without_hiredis: %global _without_hiredis --without-hiredis}}
8c02ed
# It is an error if both or neither required options exist.
8c02ed
%{?_with_hiredis: %{?_without_hiredis: %{error: both _with_hiredis and _without_hiredis}}}
8c02ed
%{!?_with_hiredis: %{!?_without_hiredis: %{error: neither _with_hiredis nor _without_hiredis}}}
8c02ed
8c02ed
# /etc/httpd/conf.d with httpd < 2.4 and defined as /etc/httpd/conf.modules.d with httpd >= 2.4
8c02ed
%{!?_httpd_modconfdir: %{expand: %%global _httpd_modconfdir %%{_sysconfdir}/httpd/conf.d}}
8c02ed
8c02ed
%global httpd_pkg_cache_dir /var/cache/httpd/mod_auth_openidc
8c02ed
8c02ed
Name:		mod_auth_openidc
8c02ed
Version:	1.8.8
8911f3
Release:	6%{?dist}
8c02ed
Summary:	OpenID Connect auth module for Apache HTTP Server
8c02ed
8c02ed
Group:		System Environment/Daemons
8c02ed
License:	ASL 2.0
8c02ed
URL:		https://github.com/pingidentity/mod_auth_openidc
8c02ed
Source0:	https://github.com/pingidentity/mod_auth_openidc/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
8c02ed
8c02ed
Patch0: decrypt_aesgcm.patch
8c02ed
Patch1: 0001-don-t-echo-query-params-on-invalid-requests-to-redir.patch
8c02ed
Patch2: 0002-Backport-security-fix-scrub-headers-on-OIDCUnAuthAct.patch
8c02ed
Patch3: 0003-Backport-security-fix-scrub-headers-for-AuthType-oau.patch
8911f3
Patch4: 0004-Backport-of-improve-validation-of-the-post-logout-UR.patch
8911f3
Patch5: 0005-Backport-of-Fix-open-redirect-starting-with-a-slash.patch
8911f3
Patch6: 0006-Backport-of-Fix-open-redirect-starting-with-a-slash-.patch
8c02ed
8c02ed
BuildRequires:	httpd-devel
8c02ed
BuildRequires:	openssl-devel
8c02ed
BuildRequires:	curl-devel
8c02ed
BuildRequires:	jansson-devel
8c02ed
BuildRequires:	pcre-devel
8c02ed
BuildRequires:	autoconf
8c02ed
BuildRequires:	automake
8c02ed
%{?_with_hiresdis:BuildRequires: hiresdis-devel}
8c02ed
Requires:	httpd-mmn = %{_httpd_mmn}
8c02ed
8c02ed
%description
8c02ed
This module enables an Apache 2.x web server to operate as
8c02ed
an OpenID Connect Relying Party and/or OAuth 2.0 Resource Server.
8c02ed
8c02ed
%prep
8c02ed
%setup -q
8c02ed
%patch0 -p1 -b decrypt_aesgcm
8c02ed
%patch1 -p1 -b echo_req
8c02ed
%patch2 -p1 -b scrub_headers
8c02ed
%patch3 -p1 -b scrub_headers_oauth
8911f3
%patch4 -p1 -b improve_logout_validation
8911f3
%patch5 -p1 -b logout_slash
8911f3
%patch6 -p1 -b logout_backslash
8c02ed
8c02ed
%build
8c02ed
# workaround rpm-buildroot-usage
8c02ed
export MODULES_DIR=%{_httpd_moddir}
8c02ed
export APXS2_OPTS='-S LIBEXECDIR=${MODULES_DIR}'
8c02ed
autoreconf
8c02ed
%configure \
8c02ed
  %{?_with_hiredis} \
8c02ed
  %{?_without_hiredis}
8c02ed
8c02ed
make %{?_smp_mflags}
8c02ed
8c02ed
%check
8c02ed
export MODULES_DIR=%{_httpd_moddir}
8c02ed
make %{?_smp_mflags} test
8c02ed
8c02ed
%install
8c02ed
mkdir -p $RPM_BUILD_ROOT%{_httpd_moddir}
8c02ed
make install MODULES_DIR=$RPM_BUILD_ROOT%{_httpd_moddir}
8c02ed
8c02ed
install -m 755 -d $RPM_BUILD_ROOT%{_httpd_modconfdir}
8c02ed
echo 'LoadModule auth_openidc_module modules/mod_auth_openidc.so' > \
8c02ed
	$RPM_BUILD_ROOT%{_httpd_modconfdir}/10-auth_openidc.conf
8c02ed
8c02ed
install -m 755 -d $RPM_BUILD_ROOT%{_httpd_confdir}
8c02ed
install -m 644 auth_openidc.conf $RPM_BUILD_ROOT%{_httpd_confdir}
8c02ed
# Adjust httpd cache location in install config file
8c02ed
sed -i 's!/var/cache/apache2/!/var/cache/httpd/!' $RPM_BUILD_ROOT%{_httpd_confdir}/auth_openidc.conf
8c02ed
install -m 700 -d $RPM_BUILD_ROOT%{httpd_pkg_cache_dir}
8c02ed
install -m 700 -d $RPM_BUILD_ROOT%{httpd_pkg_cache_dir}/metadata
8c02ed
install -m 700 -d $RPM_BUILD_ROOT%{httpd_pkg_cache_dir}/cache
8c02ed
8c02ed
8c02ed
%files
8c02ed
%if 0%{?rhel} && 0%{?rhel} < 7
8c02ed
%doc LICENSE.txt
8c02ed
%else
8c02ed
%license LICENSE.txt
8c02ed
%endif
8c02ed
%doc ChangeLog
8c02ed
%doc AUTHORS
8c02ed
%doc DISCLAIMER
8c02ed
%doc README.md
8c02ed
%{_httpd_moddir}/mod_auth_openidc.so
8c02ed
%config(noreplace) %{_httpd_modconfdir}/10-auth_openidc.conf
8c02ed
%config(noreplace) %{_httpd_confdir}/auth_openidc.conf
8c02ed
%dir %attr(0700, apache, apache) %{httpd_pkg_cache_dir}
8c02ed
%dir %attr(0700, apache, apache) %{httpd_pkg_cache_dir}/metadata
8c02ed
%dir %attr(0700, apache, apache) %{httpd_pkg_cache_dir}/cache
8c02ed
8c02ed
%changelog
8911f3
* Mon Mar 16 2020 Jakub Hrozek <jhrozek@redhat.com> - 1.8.8-6
8911f3
- Resolves: rhbz#1805748 - CVE-2019-20479 mod_auth_openidc: open redirect
8911f3
                           issue exists in URLs with slash and backslash [rhel-7]
8911f3
- Resolves: rhbz#1805067 - CVE-2019-14857 mod_auth_openidc: Open redirect
8911f3
                           in logout url when using URLs with leading slashes
8911f3
                           [rhel-7]
8911f3
8c02ed
* Tue Jan 29 2019 Jakub Hrozek <jhrozek@redhat.com> - 1.8.8-5
8c02ed
- Resolves: rhbz#1626297 - CVE-2017-6413 mod_auth_openidc: OIDC_CLAIM and
8c02ed
                           OIDCAuthNHeader not skipped in an "AuthType oauth20"
8c02ed
                           configuration [rhel-7]
8c02ed
8c02ed
* Tue Jan 29 2019 Jakub Hrozek <jhrozek@redhat.com> - 1.8.8-4
8c02ed
- Resolves: rhbz#1626299 - CVE-2017-6059 mod_auth_openidc: Shows
8c02ed
                           user-supplied content on error pages [rhel-7]
8c02ed
8c02ed
* Thu Mar 31 2016 John Dennis <jdennis@redhat.com> - 1.8.8-3
8c02ed
- fix unit test failure caused by apr_jwe_decrypt_content_aesgcm()
8c02ed
  failing to null terminate decrypted string
8c02ed
  Resolves: bug#1292561 New package: mod_auth_openidc
8c02ed
8c02ed
* Tue Mar 29 2016 John Dennis <jdennis@redhat.com> - 1.8.8-2
8c02ed
- Add %check to run test
8c02ed
  Resolves: bug#1292561 New package: mod_auth_openidc
8c02ed
8c02ed
* Tue Mar 29 2016 John Dennis <jdennis@redhat.com> - 1.8.8-1
8c02ed
- Initial import
8c02ed
  Resolves: bug#1292561 New package: mod_auth_openidc
8c02ed