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
%define soname  libduo3
%define develname duo_unix-devel

Name:           duo_unix
Version:        1.9.18
Release:        0
Summary:        Duo two-factor authentication for Unix systems
License:        GPL-2.0
Group:          Productivity/Security
Url:            http://www.duosecurity.com/
Source0:        https://dl.duosecurity.com/%{name}-%{version}.tar.gz
Source1:        permissions.login_duo
Source2:        %{name}-rpmlintrc
BuildRequires:  openssh
BuildRequires:  openssl-devel
BuildRequires:  pam-devel
BuildRequires:  pkgconfig
Requires:       %{libname} = %{version}
Requires:       openssl
Requires:       pam
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
PreReq:         permissions

%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

%package -n pam_duo
Summary:        A PAM module for duo authentication
Group:          System/Libraries
Requires:       %{libname} = %{version}

%description -n pam_duo
A PAM module for duo authentication

%package -n %{develname}
Summary:        Development files and documentation for duo_unix
Group:          Development/Libraries
Requires:       %{libname} = %{version}

%description -n %{develname}
Development files and documentation for duo_unix

%prep
%setup -q

%build
%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 LICENSE README
%dir %{_sysconfdir}/duo
%attr(0600, sshd, root) %config(noreplace) %{_sysconfdir}/duo/login_duo.conf
%attr(0755, root, root) %{_sbindir}/login_duo
%config(noreplace) %{_sysconfdir}/permissions.d/%{name}
%{_mandir}/man8/login_duo.8.gz

%files -n pam_duo
%defattr(-,root,root)
%dir %{_sysconfdir}/duo
/%{_lib}/security/pam_duo.so
%config(noreplace) %attr(640, root, root) %{_sysconfdir}/duo/pam_duo.conf
%{_mandir}/man8/pam_duo.8.gz

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

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

%changelog