pam/pam.spec

352 lines
11 KiB
RPMSpec
Raw Normal View History

%define major 0
2012-03-22 01:18:54 +04:00
%define libname %mklibname %{name} %{major}
%define libnamec %mklibname %{name}c %{major}
%define libname_misc %mklibname %{name}_misc %{major}
%define devname %mklibname %{name} -d
2012-02-01 15:16:30 +04:00
%bcond_with prelude
2012-02-01 15:16:30 +04:00
2015-02-16 00:08:16 +03:00
%bcond_with bootstrap
2012-03-22 01:18:54 +04:00
2015-04-23 12:05:35 +03:00
%bcond_without selinux
2024-03-15 14:39:38 +09:00
%define pam_redhat_version 1.2.0
2012-02-01 15:16:30 +04:00
2016-09-07 20:02:15 +10:00
Summary: A security tool which provides authentication for applications
Name: pam
2024-04-11 10:45:04 +00:00
Version: 1.6.1
Release: 6
2016-09-07 20:02:15 +10:00
Epoch: 1
2012-02-01 15:16:30 +04:00
# The library is BSD licensed with option to relicense as GPLv2+ - this option is redundant
# as the BSD license allows that anyway. pam_timestamp and pam_console modules are GPLv2+,
2016-09-07 20:02:15 +10:00
License: BSD and GPLv2+
Group: System/Libraries
Url: http://www.kernel.org/pub/linux/libs/pam/index.html
Source0: https://github.com/linux-pam/linux-pam/releases/download/v%{version}/Linux-PAM-%{version}.tar.xz
2024-03-15 14:39:38 +09:00
Source2: https://releases.pagure.org/pam-redhat/pam-redhat-%{pam_redhat_version}.tar.xz
2016-09-07 20:02:15 +10:00
Source5: other.pamd
Source6: system-auth.pamd
Source7: config-util.pamd
Source8: dlopen.sh
Source9: system-auth.5
Source10: config-util.5
Source11: postlogin.pamd
Source12: postlogin.5
Source13: pamtmp.conf
Source14: 90-nproc.conf
Source15: password-auth.pamd
Source16: smartcard-auth.pamd
2012-03-22 01:18:54 +04:00
#add missing documentation
2016-09-07 20:02:15 +10:00
Source501: pam_tty_audit.8
Source502: README
2012-02-01 15:16:30 +04:00
# RedHat patches
2024-03-15 14:37:21 +09:00
Patch1: pam-1.6.0-redhat-modules.patch
2024-04-11 17:35:44 +03:00
Patch9: pam-1.6.1-noflex.patch
# Upstreamed partially
Patch33: https://src.fedoraproject.org/rpms/pam/raw/master/f/pam-1.3.0-unix-nomsg.patch
# OpenMandriva specific sources/patches
2020-11-28 09:17:38 +00:00
2012-02-01 15:16:30 +04:00
# (fc) 0.75-29mdk don't complain when / is owned by root.adm
2016-09-07 20:02:15 +10:00
Patch508: Linux-PAM-0.99.3.0-pamtimestampadm.patch
2012-02-01 15:16:30 +04:00
2012-03-22 01:18:54 +04:00
# (proyvind): add missing constant that went with rpc removal from glibc 2.14
2024-03-15 14:37:21 +09:00
Patch702: Linux-PAM-1.6.0-add-now-missing-nis-constant.patch
# (akdengi> add user to default group users which need for Samba
2016-09-07 20:02:15 +10:00
Patch801: Linux-PAM-1.1.4-group_add_users.patch
2016-09-19 17:31:47 +10:00
%if %{with selinux}
2016-09-07 20:02:15 +10:00
BuildRequires: selinux-devel >= 2.1.6-7
%endif
2016-09-07 20:02:15 +10:00
BuildRequires: bison
BuildRequires: flex
%if %{without bootstrap}
2012-03-22 01:18:54 +04:00
# this pulls in the mega texlive load
2016-09-07 20:02:15 +10:00
BuildRequires: linuxdoc-tools
2012-03-22 01:18:54 +04:00
%endif
2016-09-07 20:02:15 +10:00
BuildRequires: cracklib-devel
BuildRequires: libaudit-devel
BuildRequires: db_nss-devel
BuildRequires: gettext-devel
BuildRequires: pkgconfig(libtirpc)
BuildRequires: db-devel
BuildRequires: html2text
BuildRequires: docbook-dtd412-xml
BuildRequires: docbook-dtd43-xml
BuildRequires: docbook-dtd44-xml
BuildRequires: docbook-style-xsl
2020-11-06 13:59:14 +00:00
BuildRequires: docbook-dtds
2016-09-07 20:02:15 +10:00
BuildRequires: xsltproc
%if %{with prelude}
2016-09-07 20:02:15 +10:00
BuildRequires: prelude-devel >= 0.9.0
2012-02-01 15:16:30 +04:00
%else
2016-09-07 20:02:15 +10:00
BuildConflicts: pkgconfig(libprelude)
2012-02-01 15:16:30 +04:00
%endif
2016-09-07 20:02:15 +10:00
Requires: cracklib-dicts
Requires: setup >= 2.7.12-2
Requires: libpwquality >= 0.9.9
Requires(posttrans): grep sed
2012-02-01 15:16:30 +04:00
%description
PAM (Pluggable Authentication Modules) is a system security tool that
allows system administrators to set authentication policy without
having to recompile programs that handle authentication.
%files -f Linux-PAM.lang
%doc NEWS
%docdir %{_docdir}/%{name}
%attr(0644,root,shadow) %config(noreplace) %{_sysconfdir}/pam.d/system-auth
%attr(0644,root,shadow) %config(noreplace) %{_sysconfdir}/pam.d/system-auth-default
2023-10-25 14:54:19 +03:00
%attr(0700,root,root) %{_sbindir}/unix_update
%attr(0755,root,root) %{_sbindir}/mkhomedir_helper
%attr(0755,root,root) %{_sbindir}/pam_namespace_helper
2023-11-03 13:19:41 +03:00
%attr(0755,root,root) %{_sbindir}/pwhistory_helper
%attr(4755,root,root) %{_sbindir}/pam_timestamp_check
%attr(4755,root,root) %{_sbindir}/unix_chkpwd
%attr(755,root,root) %config(noreplace) %{_sysconfdir}/security/namespace.init
%config(noreplace) %{_sysconfdir}/environment
%config(noreplace) %{_sysconfdir}/security/access.conf
%config(noreplace) %{_sysconfdir}/security/chroot.conf
%config(noreplace) %{_sysconfdir}/security/faillock.conf
%config(noreplace) %{_sysconfdir}/security/group.conf
%config(noreplace) %{_sysconfdir}/security/limits.conf
2023-11-03 13:19:41 +03:00
%config(noreplace) %{_sysconfdir}/security/limits.d/90-nproc.conf
%config(noreplace) %{_sysconfdir}/security/namespace.conf
%config(noreplace) %{_sysconfdir}/security/opasswd
2023-11-03 13:19:41 +03:00
%config(noreplace) %{_sysconfdir}/security/pam_env.conf
%if %{with selinux}
%config(noreplace) %{_sysconfdir}/security/sepermit.conf
%endif
2023-11-03 13:19:41 +03:00
%config(noreplace) %{_sysconfdir}/security/time.conf
2024-03-15 15:17:42 +09:00
%config(noreplace) %{_sysconfdir}/security/pwhistory.conf
%config(noreplace) %{_sysconfdir}/pam.d/config-util
%config(noreplace) %{_sysconfdir}/pam.d/other
%config(noreplace) %{_sysconfdir}/pam.d/password-auth
%config(noreplace) %{_sysconfdir}/pam.d/postlogin
%config(noreplace) %{_sysconfdir}/pam.d/smartcard-auth
2023-11-03 13:19:41 +03:00
%dir %{_libdir}/security
%dir %{_sysconfdir}/pam.d
%dir %{_sysconfdir}/security/limits.d
2015-02-13 15:47:38 +03:00
%ghost %dir /var/run/console
%ghost /var/log/tallylog
2023-11-03 13:19:41 +03:00
%{_libdir}/security/pam_filter
%{_libdir}/security/*.so
%{_mandir}/man5/*
%{_mandir}/man8/*
2023-11-03 13:19:41 +03:00
%{_prefix}/lib/systemd/system/pam_namespace.service
%{_prefix}/lib/tmpfiles.d/pam.conf
%{_sbindir}/faillock
#----------------------------------------------------------------------------
%package doc
2016-09-07 20:02:15 +10:00
Summary: Additional documentation for %{name}
Group: Documentation
Requires: %{name} = %{EVRD}
2012-02-01 15:16:30 +04:00
%description doc
2012-03-22 01:18:54 +04:00
This is the documentation package of %{name}.
2012-02-01 15:16:30 +04:00
%files doc
%doc doc/txts doc/specs/rfc86.0.txt Copyright
2020-02-05 03:14:23 +00:00
%doc %{_docdir}/%{name}/*
#----------------------------------------------------------------------------
%package -n %{libname}
2016-09-07 20:02:15 +10:00
Summary: Library for %{name}
Group: System/Libraries
Conflicts: pam < 1.1.4-5
2012-02-01 15:16:30 +04:00
%description -n %{libname}
2012-03-22 01:18:54 +04:00
This package contains the library libpam for %{name}.
%files -n %{libname}
%{_libdir}/libpam.so.%{major}*
#----------------------------------------------------------------------------
%package -n %{libnamec}
2016-09-07 20:02:15 +10:00
Summary: Library for %{name}
Group: System/Libraries
Conflicts: %{_lib}pam0 < 1.1.4-5
2012-03-22 01:18:54 +04:00
%description -n %{libnamec}
2012-03-22 01:18:54 +04:00
This package contains the library libpamc for %{name}.
%files -n %{libnamec}
%{_libdir}/libpamc.so.%{major}*
#----------------------------------------------------------------------------
%package -n %{libname_misc}
2016-09-07 20:02:15 +10:00
Summary: Library for %{name}
Group: System/Libraries
Conflicts: %{_lib}pam0 < 1.1.4-5
2012-02-01 15:16:30 +04:00
%description -n %{libname_misc}
2012-03-22 01:18:54 +04:00
This package contains the library libpam_misc for %{name}.
2012-02-01 15:16:30 +04:00
%files -n %{libname_misc}
%{_libdir}/libpam_misc.so.%{major}*
#----------------------------------------------------------------------------
%package -n %{devname}
2016-09-07 20:02:15 +10:00
Summary: Development headers and libraries for %{name}
Group: Development/Other
Requires: %{libname} = %{EVRD}
Requires: %{libnamec} = %{EVRD}
Requires: %{libname_misc} = %{EVRD}
Provides: %{name}-devel = %{EVRD}
2012-02-01 15:16:30 +04:00
%description -n %{devname}
2012-02-01 15:16:30 +04:00
PAM (Pluggable Authentication Modules) is a system security tool that
allows system administrators to set authentication policy without
having to recompile programs that handle authentication.
2012-03-22 01:18:54 +04:00
This package contains the development libraries for %{name}.
2012-02-01 15:16:30 +04:00
%files -n %{devname}
%doc Copyright
%{_libdir}/libpam.so
%{_libdir}/libpam_misc.so
%{_libdir}/libpamc.so
%{_includedir}/security/*.h
%{_mandir}/man3/*
2024-03-15 15:17:42 +09:00
%{_libdir}/pkgconfig/pam*.pc
#----------------------------------------------------------------------------
2012-02-01 15:16:30 +04:00
%prep
%setup -q -n Linux-PAM-%{version} -a 2
# Add custom modules.
mv pam-redhat-%{pam_redhat_version}/* modules
%autopatch -p1
2023-11-03 13:19:41 +03:00
sed -i 's!$(prefix)/lib/systemd/system!%{_prefix}/lib/systemd/system!g' modules/pam_namespace/Makefile.*
2020-11-06 13:59:14 +00:00
# replace /var/run with /run
find . -type f -exec sed -i 's!/var/run!/run!g' {} \;
2012-02-01 15:16:30 +04:00
install -m644 %{SOURCE501} %{SOURCE502} modules/pam_tty_audit/
# We have non upstream translation for version 1.3.0
# Replace original po/ru.po with our fork.
# Ported to upstream git master:
# https://github.com/linux-pam/linux-pam/pull/152
rm -rf doc/txts/README.pam_tally*
rm -rf doc/sag/html/*pam_tally*
touch ChangeLog # to make autoreconf happy
autoreconf -fi -I m4
2019-11-03 18:53:34 +00:00
2012-02-01 15:16:30 +04:00
%build
autoreconf -fi
2020-11-06 13:59:14 +00:00
export BROWSER=""
2023-11-03 13:19:41 +03:00
%configure \
--disable-static \
--docdir=%{_docdir}/%{name} \
--enable-audit \
--enable-cracklib \
--enable-docu --enable-regenerate-docu \
%if %{with prelude}
2023-11-03 13:19:41 +03:00
--enable-prelude \
%else
2023-11-03 13:19:41 +03:00
--disable-prelude \
%endif
%if %{with selinux}
2023-11-03 13:19:41 +03:00
--enable-selinux \
2015-02-16 02:53:12 +03:00
%else
2023-11-03 13:19:41 +03:00
--disable-selinux \
%endif
2023-11-03 13:19:41 +03:00
--includedir=%{_includedir}/security \
--libdir=%{_libdir} \
--sbindir=%{_sbindir} \
--with-db-uniquename=_nss
%make_build
2012-02-01 15:16:30 +04:00
%install
mkdir -p doc/txts
for readme in modules/pam_*/README ; do
2023-11-03 13:19:41 +03:00
cp -f ${readme} doc/txts/README.`dirname ${readme} | sed -e 's|^modules/||'`
done
2012-03-21 21:50:51 +04:00
mkdir -p %{buildroot}%{_includedir}/security
mkdir -p %{buildroot}%{_libdir}/security
2020-11-06 13:59:14 +00:00
%make_install LDCONFIG=:
2012-03-21 21:50:51 +04:00
install -d -m 755 %{buildroot}/etc/pam.d
install -m 644 %{SOURCE5} %{buildroot}/etc/pam.d/other
install -m 644 %{SOURCE6} %{buildroot}/etc/pam.d/system-auth
install -m 644 %{SOURCE7} %{buildroot}/etc/pam.d/config-util
2013-11-18 11:00:12 +04:00
install -m 644 %{SOURCE11} %{buildroot}/etc/pam.d/postlogin
install -m 644 %{SOURCE15} %{buildroot}/etc/pam.d/password-auth
install -m 644 %{SOURCE16} %{buildroot}/etc/pam.d/smartcard-auth
2012-03-21 21:50:51 +04:00
install -m 600 /dev/null %{buildroot}%{_sysconfdir}/security/opasswd
install -d -m 755 %{buildroot}/var/log
install -m 600 /dev/null %{buildroot}/var/log/tallylog
2014-01-21 14:49:16 +04:00
install -m 644 %{SOURCE14} %{buildroot}%{_sysconfdir}/security/limits.d/90-nproc.conf
2012-02-01 15:16:30 +04:00
# Install man pages.
2013-11-18 11:00:12 +04:00
install -m 644 %{SOURCE9} %{SOURCE10} %{SOURCE12} %{buildroot}%{_mandir}/man5/
2012-02-01 15:16:30 +04:00
# no longer needed, handled by ACL in udev
2012-03-22 01:18:54 +04:00
for phase in auth acct passwd session ; do
2023-11-03 13:19:41 +03:00
ln -sf pam_unix.so %{buildroot}%{_libdir}/security/pam_unix_${phase}.so
2012-02-01 15:16:30 +04:00
done
2012-03-22 01:18:54 +04:00
# cleanup
rm -f %{buildroot}%{_libdir}/security/*.la
rm -f %{buildroot}%{_libdir}/*.la
2012-03-22 01:18:54 +04:00
2023-11-03 13:19:41 +03:00
#Set suid bit for /usr/sbin/unix_chkpwd (bug #3169)
chmod u+s %{buildroot}%{_sbindir}/unix_chkpwd
# Install the file for autocreation of /var/run subdirectories on boot
mkdir -p %{buildroot}%{_prefix}/lib/tmfiles.d/
install -m644 -D %{SOURCE13} %{buildroot}%{_prefix}/lib/tmpfiles.d/pam.conf
# For drakauth copy system-auth to system-auth-default
cp -f %{buildroot}/etc/pam.d/system-auth %{buildroot}/etc/pam.d/system-auth-default
# Localize format of last login time (shown by pam_latslog in e.g. gdm)
2023-11-03 13:19:41 +03:00
# These are arguements of strftime(). Here "Пт дек 9 11:31:43 MSK 2022"
# is changed to "Пт, 9 декабря 11:32" (ask Survolog@, I (mikhailnov@) do not understand)
# https://bugzilla.rosalinux.ru/show_bug.cgi?id=13004
pushd %{buildroot}%{_datadir}/locale/ru/LC_MESSAGES
msgunfmt Linux-PAM.mo -o Linux-PAM.po
rm -f Linux-PAM.mo
2022-12-09 07:39:26 +00:00
# \x25 - symbol %%, info about %%a, %%e, %%B etc. in man date.
sed -i "/msgstr/ s/ \x25a \x25b \x25e \x25H:\x25M:\x25S \x25Z \x25Y/ \x25a, \x25e \x25B \x25H:\x25M/" Linux-PAM.po
sed -i "/msgstr/ s/Последний вход в систему:/Последний вход:/" Linux-PAM.po
msgfmt Linux-PAM.po -o Linux-PAM.mo
rm -f Linux-PAM.po
popd
2012-02-01 15:16:30 +04:00
%find_lang Linux-PAM
%check
2015-02-16 02:53:12 +03:00
EXCEPT=''
%if %{without selinux}
2023-11-03 13:19:41 +03:00
EXCEPT='pam_selinux'
%endif
2012-02-01 15:16:30 +04:00
for dir in modules/pam_* ; do
2023-11-03 13:19:41 +03:00
if ! [[ ${dir} =~ "${except}" ]]; then
if ! ls -1 %{buildroot}%{_libdir}/security/`basename ${dir}`*.so ; then
echo ERROR `basename ${dir}` did not build a module.
exit 1
fi
fi
2012-02-01 15:16:30 +04:00
done
2023-11-03 13:19:41 +03:00
# Check for module problems. Specifically, check that every module we just
2012-02-01 15:16:30 +04:00
# installed can actually be loaded by a minimal PAM-aware application.
2023-12-24 12:34:10 +10:00
%{_sbindir}/ldconfig -n %{buildroot}%{_libdir}
for module in %{buildroot}%{_libdir}/security/pam*.so ; do
2023-11-03 13:19:41 +03:00
if ! env LD_LIBRARY_PATH=%{buildroot}%{_libdir} \
sh %{SOURCE8} -ldb -ldl -lpam -L%{buildroot}%{_libdir} ${module} ; then
echo ERROR module: ${module} cannot be loaded.
exit 1
fi
2012-02-01 15:16:30 +04:00
done