%global duo_unix_version 1.11.5 %if 0%(grep -q Tikanga /etc/redhat-release 2>/dev/null && echo 1 || echo 0) > 0 %global rhel 5 %endif %if 0%{?rhel} > 0 && 0%{?rhel} < 7 %global pam_security_dir /%{_lib}/security %else %global pam_security_dir %{_libdir}/security %endif Name: duo_unix Version: %{duo_unix_version} Release: 1%{?dist} Summary: Duo two-factor authentication for Unix systems %if 0%{?rhel} > 0 && 0%{?rhel} < 7 Group: Applications/System %endif License: GPLv2 URL: https://duo.com/docs/duounix Source0: https://github.com/duosecurity/duo_unix/archive/refs/tags/duo_unix-%{version}.tar.gz %if 0%{?rhel} > 0 && 0%{?rhel} < 6 Buildroot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) %endif %if ! (0%{?rhel} > 0 && 0%{?rhel} < 7) BuildRequires: autoconf BuildRequires: automake BuildRequires: libtool %endif BuildRequires: openssl-devel BuildRequires: pam-devel BuildRequires: selinux-policy-devel Requires(post): selinux-policy Requires(preun): selinux-policy %description duo_unix implements Duo two-factor authentication for Unix systems. %package devel Summary: Development files needed to compile Duo programs %if 0%{?rhel} > 0 && 0%{?rhel} < 7 Group: Applications/System %endif %description devel duo_unix implements Duo two-factor authentication for Unix systems. The duo_unix-devel package contains the header files and libraries needed for compiling Duo programs. If you want to develop Duo-aware programs, you need to install this package. %prep %setup -q -n %{name}-%{name}-%{version} %if 0%{?rhel} > 0 && 0%{?rhel} < 7 %patch0 -p1 -b .include-autotools-files %{__chmod} 0755 \ configure \ autotools/compile \ autotools/config.guess \ autotools/config.rpath \ autotools/config.sub \ autotools/depcomp \ autotools/install-sh \ autotools/missing %else autoreconf -vfi -I autotools %endif %build ls %{configure} \ --sysconfdir=%{_sysconfdir}/duo \ --with-pam=%{pam_security_dir} %{__make} %{?_smp_mflags} %{__make} -C pam_duo semodule %install rm -rf $RPM_BUILD_ROOT %if 0%{?rhel} > 0 && 0%{?rhel} < 6 %{__make} DESTDIR=${RPM_BUILD_ROOT} install %else %{make_install} %endif %{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_datadir}/selinux/packages %{__install} -m 0644 pam_duo/authlogin_duo.pp ${RPM_BUILD_ROOT}%{_datadir}/selinux/packages/authlogin_duo.pp %{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_includedir}/duo %{__mv} ${RPM_BUILD_ROOT}%{_includedir}/*.h ${RPM_BUILD_ROOT}%{_includedir}/duo/ %{__rm} ${RPM_BUILD_ROOT}%{_includedir}/duo/common_ini_test.h %{__rm} ${RPM_BUILD_ROOT}%{_includedir}/duo/duo_private.h %{__rm} ${RPM_BUILD_ROOT}%{_includedir}/duo/unity.h %{__rm} -r ${RPM_BUILD_ROOT}%{_defaultdocdir} %if ! (0%{?rhel} > 0 && 0%{?rhel} < 7) %clean %{__rm} -rf ${RPM_BUILD_ROOT} %endif %post %if 0%{?rhel} > 0 && 0%{?rhel} < 7 . /etc/selinux/config _policytype= if [ -z "${_policytype}" ]; then _policytype="targeted" fi /usr/sbin/semodule -n -s ${_policytype} -X 200 -i %{_datadir}/selinux/packages/authlogin_duo.pp if /usr/sbin/selinuxenabled && [ "${SELINUXTYPE}" = "${_policytype}" ]; then /usr/sbin/load_policy fi %else %selinux_modules_install %{_datadir}/selinux/packages/authlogin_duo.pp %endif %preun %if 0%{?rhel} > 0 && 0%{?rhel} < 7 . /etc/selinux/config _policytype= if [ -z "${_policytype}" ]; then _policytype="targeted" fi if [ $1 -eq 0 ]; then /usr/sbin/semodule -n -X 200 -r authlogin_duo &> /dev/null || : if /usr/sbin/selinuxenabled && [ "${SELINUXTYPE}" = "${_policytype}" ]; then /usr/sbin/load_policy fi fi %else %selinux_modules_uninstall authlogin_duo %endif %files %defattr(-,root,root,-) %doc AUTHORS CHANGES LICENSE %dir %attr(0700,root,root) %{_sysconfdir}/duo %config(noreplace) %{_sysconfdir}/duo/login_duo.conf %config(noreplace) %{_sysconfdir}/duo/pam_duo.conf %{pam_security_dir}/pam_duo.so %attr(4755,root,root) %{_sbindir}/login_duo %{_mandir}/man8/login_duo.8* %{_mandir}/man8/pam_duo.8* %{_datadir}/selinux/packages/authlogin_duo.pp %{_sbindir}/duo_unix_support.sh %files devel %defattr(-,root,root,-) %doc AUTHORS CHANGES LICENSE README.md %{_includedir}/duo/duo.h %{_includedir}/duo/shell.h %{_includedir}/duo/util.h %{_mandir}/man3/duo.3* %{_libdir}/pkgconfig/libduo.pc %{pam_security_dir}/pam_duo.la %changelog * Tue Jan 4 2022 Matthew Roth - 1.11.5-1 - update the version * Mon Apr 12 2021 Matthew Roth - 1.11.4-1 - update spec file to work with new duo_unix code. * Thu Jan 25 2018 James Ralston - 1.10.2-1 - create spec file