File duo_unix.spec of Package duo_unix

#
# spec file for package duo_unix
#
# Copyright (c) 2016 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define libname libduo3
# Note that upstream since duo_unix-1.9.20 links libduo statically; this is
# reverted in a local patch.

Name:           duo_unix
Version:        2.0.2
Release:        0
Summary:        Duo two-factor authentication for Unix systems
License:        GPL-2.0
Group:          Productivity/Security
Url:            https://duo.com/docs/duounix
Source0:        https://dl.duosecurity.com/%{name}-%{version}.tar.gz
Source1:        permissions.login_duo
Source2:        %{name}-rpmlintrc
Source3:        README.SUSE
Patch1:         duo_unix_support-paths.diff
Patch2:         libduo-no_static.diff
Patch3:         duo_unix-license_path.diff
BuildRequires:  automake
BuildRequires:  openssh
BuildRequires:  openssl-devel
BuildRequires:  pam-devel
BuildRequires:  pkgconfig
Requires:       %{libname} = %{version}
Requires:       openssl
Requires:       pam
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
PreReq:         permissions
Provides:       pam_duo = %{version}-%{release}
Obsoletes:      pam_duo < %{version}-%{release}

%description
Duo provides simple two-factor authentication as a service via:
    1.  Phone callback
    2.  SMS-delivered one-time passcodes
    3.  Duo mobile app to generate one-time passcodes
    4.  Duo mobile app for smartphone push authentication
    5.  Duo hardware token to generate one-time passcodes

This package allows an admin (or ordinary user) to quickly add Duo
authentication to any Unix login without setting up secondary user
accounts, directory synchronization, servers, or hardware.

%package -n %{libname}
Summary:        Shared libraries for Duo authentication
Group:          System/Libraries

%description -n %{libname}
Shared libraries for duo_unix (common functionality to login_duo and pam_duo)

%package devel
Summary:        Development files for duo_unix
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}
Requires:       %{libname} = %{version}

%description devel
Development files and documentation for duo_unix

%prep
%setup -q
%patch1
%patch2
%patch3
cp %{S:3} .	# copy README.SUSE

%build
# apply lib/Makefile.am change from patch2
aclocal
automake lib/Makefile

%configure --with-pam=/%{_lib}/security --sysconfdir=%{_sysconfdir}/duo --with-privsep-user=sshd --includedir=%{_includedir}/duo --docdir=%{_defaultdocdir}/%{name}
make %{?_smp_mflags}

%install
make DESTDIR=%{buildroot} install %{?_smp_mflags}
rm -f %{buildroot}/%{_lib}/security/pam_duo.*a
rm -f %{buildroot}/%{_libdir}/libduo.*a

install -d -m 0755 %{buildroot}%{_sysconfdir}/permissions.d
install -m 0644 %{S:1}  %{buildroot}%{_sysconfdir}/permissions.d/%{name}

%post -n %{libname} -p /sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc AUTHORS CHANGES CONTRIBUTING.md README.md README.SUSE sbom.spdx
%license LICENSES/*
%dir %{_defaultdocdir}/%{name}/duo_unix_support
%doc %{_defaultdocdir}/%{name}/duo_unix_support/*
%dir %{_sysconfdir}/duo
%config(noreplace) %attr(0600, sshd, root) %{_sysconfdir}/duo/login_duo.conf
%config(noreplace) %attr(0600, root, root) %{_sysconfdir}/duo/pam_duo.conf
/%{_lib}/security/pam_duo.so
%verify(not mode) %attr(0755, root, root) %{_sbindir}/login_duo
%config(noreplace) %{_sysconfdir}/permissions.d/%{name}
%{_mandir}/man8/login_duo.8.gz
%{_mandir}/man8/pam_duo.8.gz
%{_sbindir}/duo_unix_support.sh

%files -n %{libname}
%defattr(-,root,root)
%{_libdir}/libduo.so.*.*
%{_libdir}/libduo.so.3

%files devel
%defattr(-,root,root)
%dir %{_includedir}/duo
%{_includedir}/duo/*.h
%{_libdir}/pkgconfig/libduo.pc
%{_mandir}/man3/duo.3.gz
%{_libdir}/libduo.so

%changelog
openSUSE Build Service is sponsored by