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

%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
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

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

%setup -q

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

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

%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}

%files -n pam_duo
%dir %{_sysconfdir}/duo
%config(noreplace) %attr(640, root, root) %{_sysconfdir}/duo/pam_duo.conf

%files -n %{libname}

%files -n %{develname}
%dir %{_includedir}/duo