| 1 |
# Do not terminate build if language files are empty. |
| 2 |
%define _empty_manifest_terminate_build 0 |
| 3 |
|
| 4 |
Name: authselect |
| 5 |
Version: @PACKAGE_VERSION@ |
| 6 |
Release: @RELEASE_NUMBER@%{?dist} |
| 7 |
Summary: Configures authentication and identity sources from supported profiles |
| 8 |
URL: https://github.com/authselect/authselect |
| 9 |
|
| 10 |
License: GPL-3.0-or-later |
| 11 |
Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz |
| 12 |
Source1: authselect.conf.fedora |
| 13 |
Source2: authselect.conf.rhel |
| 14 |
|
| 15 |
%global makedir %{_builddir}/%{name}-%{version} |
| 16 |
|
| 17 |
BuildRequires: autoconf |
| 18 |
BuildRequires: automake |
| 19 |
BuildRequires: findutils |
| 20 |
BuildRequires: libtool |
| 21 |
BuildRequires: m4 |
| 22 |
BuildRequires: gcc |
| 23 |
BuildRequires: pkgconfig |
| 24 |
BuildRequires: pkgconfig(popt) |
| 25 |
BuildRequires: pkgconfig(bash-completion) |
| 26 |
BuildRequires: gettext-devel |
| 27 |
BuildRequires: po4a |
| 28 |
BuildRequires: %{_bindir}/a2x |
| 29 |
BuildRequires: libcmocka-devel >= 1.0.0 |
| 30 |
BuildRequires: libselinux-devel |
| 31 |
BuildRequires: systemd-devel |
| 32 |
BuildRequires: systemd-rpm-macros |
| 33 |
Requires: authselect-libs%{?_isa} = %{version}-%{release} |
| 34 |
|
| 35 |
# RHEL does not have meta flag yet |
| 36 |
%if 0%{?rhel} <= 10 |
| 37 |
Suggests: sssd |
| 38 |
Suggests: samba-winbind |
| 39 |
Suggests: fprintd-pam |
| 40 |
Suggests: oddjob-mkhomedir |
| 41 |
%else |
| 42 |
Suggests(meta): sssd |
| 43 |
Suggests(meta): samba-winbind |
| 44 |
Suggests(meta): fprintd-pam |
| 45 |
Suggests(meta): oddjob-mkhomedir |
| 46 |
%endif |
| 47 |
|
| 48 |
# Properly obsolete removed authselect-compat package. |
| 49 |
Obsoletes: authselect-compat < 1.3 |
| 50 |
|
| 51 |
%description |
| 52 |
Authselect is designed to be a replacement for authconfig but it takes |
| 53 |
a different approach to configure the system. Instead of letting |
| 54 |
the administrator build the PAM stack with a tool (which may potentially |
| 55 |
end up with a broken configuration), it would ship several tested stacks |
| 56 |
(profiles) that solve a use-case and are well tested and supported. |
| 57 |
At the same time, some obsolete features of authconfig are not |
| 58 |
supported by authselect. |
| 59 |
|
| 60 |
%package libs |
| 61 |
Summary: Utility library used by the authselect tool |
| 62 |
# Required by scriptlets |
| 63 |
Requires: coreutils |
| 64 |
Requires: sed |
| 65 |
Suggests: systemd |
| 66 |
|
| 67 |
%description libs |
| 68 |
Common library files for authselect. This package is used by the authselect |
| 69 |
command line tool and any other potential front-ends. |
| 70 |
|
| 71 |
%package devel |
| 72 |
Summary: Development libraries and headers for authselect |
| 73 |
Requires: authselect-libs%{?_isa} = %{version}-%{release} |
| 74 |
|
| 75 |
%description devel |
| 76 |
System header files and development libraries for authselect. Useful if |
| 77 |
you develop a front-end for the authselect library. |
| 78 |
|
| 79 |
%prep |
| 80 |
%setup -q |
| 81 |
|
| 82 |
for p in %patches ; do |
| 83 |
%__patch -p1 -i $p |
| 84 |
done |
| 85 |
|
| 86 |
%build |
| 87 |
autoreconf -if |
| 88 |
%configure \ |
| 89 |
%{nil} |
| 90 |
%make_build |
| 91 |
|
| 92 |
%check |
| 93 |
%make_build check |
| 94 |
|
| 95 |
%install |
| 96 |
%make_install |
| 97 |
|
| 98 |
# Install distribution-specific configuration |
| 99 |
%if 0%{?fedora} |
| 100 |
%__install -m 644 -D %{SOURCE1} $RPM_BUILD_ROOT%{_datadir}/authselect/authselect.conf |
| 101 |
%else |
| 102 |
%__install -m 644 -D %{SOURCE2} $RPM_BUILD_ROOT%{_datadir}/authselect/authselect.conf |
| 103 |
%endif |
| 104 |
|
| 105 |
# Find translations |
| 106 |
%find_lang %{name} |
| 107 |
%find_lang %{name} %{name}.8.lang --with-man |
| 108 |
%find_lang %{name}-migration %{name}-migration.7.lang --with-man |
| 109 |
%find_lang %{name}-profiles %{name}-profiles.5.lang --with-man |
| 110 |
|
| 111 |
# We want this file to contain only manual page translations |
| 112 |
%__sed -i '/LC_MESSAGES/d' %{name}.8.lang |
| 113 |
|
| 114 |
# Remove .la and .a files created by libtool |
| 115 |
find $RPM_BUILD_ROOT -name "*.la" -exec %__rm -f {} \; |
| 116 |
find $RPM_BUILD_ROOT -name "*.a" -exec %__rm -f {} \; |
| 117 |
|
| 118 |
%ldconfig_scriptlets libs |
| 119 |
|
| 120 |
%files libs -f %{name}.lang -f %{name}-profiles.5.lang |
| 121 |
%dir %{_sysconfdir}/authselect |
| 122 |
%dir %{_sysconfdir}/authselect/custom |
| 123 |
%ghost %attr(0644,root,root) %{_sysconfdir}/authselect/authselect.conf |
| 124 |
%ghost %attr(0644,root,root) %{_sysconfdir}/authselect/dconf-db |
| 125 |
%ghost %attr(0644,root,root) %{_sysconfdir}/authselect/dconf-locks |
| 126 |
%ghost %attr(0644,root,root) %{_sysconfdir}/authselect/fingerprint-auth |
| 127 |
%ghost %attr(0644,root,root) %{_sysconfdir}/authselect/nsswitch.conf |
| 128 |
%ghost %attr(0644,root,root) %{_sysconfdir}/authselect/password-auth |
| 129 |
%ghost %attr(0644,root,root) %{_sysconfdir}/authselect/postlogin |
| 130 |
%ghost %attr(0644,root,root) %{_sysconfdir}/authselect/smartcard-auth |
| 131 |
%ghost %attr(0644,root,root) %{_sysconfdir}/authselect/system-auth |
| 132 |
%ghost %attr(0644,root,root) %{_sysconfdir}/nsswitch.conf |
| 133 |
%ghost %attr(0644,root,root) %{_sysconfdir}/pam.d/fingerprint-auth |
| 134 |
%ghost %attr(0644,root,root) %{_sysconfdir}/pam.d/password-auth |
| 135 |
%ghost %attr(0644,root,root) %{_sysconfdir}/pam.d/postlogin |
| 136 |
%ghost %attr(0644,root,root) %{_sysconfdir}/pam.d/smartcard-auth |
| 137 |
%ghost %attr(0644,root,root) %{_sysconfdir}/pam.d/system-auth |
| 138 |
%dir %{_localstatedir}/lib/authselect |
| 139 |
%ghost %attr(0755,root,root) %{_localstatedir}/lib/authselect/backups/ |
| 140 |
%dir %{_datadir}/authselect |
| 141 |
%dir %{_datadir}/authselect/vendor |
| 142 |
%dir %{_datadir}/authselect/default |
| 143 |
%dir %{_datadir}/authselect/default/local/ |
| 144 |
%dir %{_datadir}/authselect/default/sssd/ |
| 145 |
%dir %{_datadir}/authselect/default/winbind/ |
| 146 |
%config(noreplace) %{_datadir}/authselect/authselect.conf |
| 147 |
%verify(not md5 size mtime) %{_datadir}/authselect/checksum |
| 148 |
%{_datadir}/authselect/default/local/dconf-db |
| 149 |
%{_datadir}/authselect/default/local/dconf-locks |
| 150 |
%{_datadir}/authselect/default/local/fingerprint-auth |
| 151 |
%{_datadir}/authselect/default/local/nsswitch.conf |
| 152 |
%{_datadir}/authselect/default/local/password-auth |
| 153 |
%{_datadir}/authselect/default/local/postlogin |
| 154 |
%{_datadir}/authselect/default/local/README |
| 155 |
%{_datadir}/authselect/default/local/REQUIREMENTS |
| 156 |
%{_datadir}/authselect/default/local/smartcard-auth |
| 157 |
%{_datadir}/authselect/default/local/switchable-auth |
| 158 |
%{_datadir}/authselect/default/local/system-auth |
| 159 |
%{_datadir}/authselect/default/sssd/dconf-db |
| 160 |
%{_datadir}/authselect/default/sssd/dconf-locks |
| 161 |
%{_datadir}/authselect/default/sssd/fingerprint-auth |
| 162 |
%{_datadir}/authselect/default/sssd/nsswitch.conf |
| 163 |
%{_datadir}/authselect/default/sssd/password-auth |
| 164 |
%{_datadir}/authselect/default/sssd/postlogin |
| 165 |
%{_datadir}/authselect/default/sssd/README |
| 166 |
%{_datadir}/authselect/default/sssd/REQUIREMENTS |
| 167 |
%{_datadir}/authselect/default/sssd/smartcard-auth |
| 168 |
%{_datadir}/authselect/default/sssd/switchable-auth |
| 169 |
%{_datadir}/authselect/default/sssd/system-auth |
| 170 |
%{_datadir}/authselect/default/winbind/dconf-db |
| 171 |
%{_datadir}/authselect/default/winbind/dconf-locks |
| 172 |
%{_datadir}/authselect/default/winbind/fingerprint-auth |
| 173 |
%{_datadir}/authselect/default/winbind/nsswitch.conf |
| 174 |
%{_datadir}/authselect/default/winbind/password-auth |
| 175 |
%{_datadir}/authselect/default/winbind/postlogin |
| 176 |
%{_datadir}/authselect/default/winbind/README |
| 177 |
%{_datadir}/authselect/default/winbind/REQUIREMENTS |
| 178 |
%{_datadir}/authselect/default/winbind/smartcard-auth |
| 179 |
%{_datadir}/authselect/default/winbind/switchable-auth |
| 180 |
%{_datadir}/authselect/default/winbind/system-auth |
| 181 |
%{_libdir}/libauthselect.so.* |
| 182 |
%{_mandir}/man5/authselect-profiles.5* |
| 183 |
%dir %{_datadir}/doc/authselect |
| 184 |
%{_datadir}/doc/authselect/COPYING |
| 185 |
%{_datadir}/doc/authselect/README.md |
| 186 |
%{_unitdir}/authselect-apply-changes.service |
| 187 |
%{_unitdir}/authselect-first-boot.service |
| 188 |
%license COPYING |
| 189 |
%doc README.md |
| 190 |
|
| 191 |
%files devel |
| 192 |
%{_includedir}/authselect.h |
| 193 |
%{_libdir}/libauthselect.so |
| 194 |
%{_libdir}/pkgconfig/authselect.pc |
| 195 |
|
| 196 |
%files -f %{name}.8.lang -f %{name}-migration.7.lang |
| 197 |
%{_bindir}/authselect |
| 198 |
%{_mandir}/man8/authselect.8* |
| 199 |
%{_mandir}/man7/authselect-migration.7* |
| 200 |
%{_datadir}/bash-completion/completions/authselect.bash |
| 201 |
|
| 202 |
%post libs |
| 203 |
%systemd_post authselect-apply-changes.service authselect-first-boot.service |
| 204 |
|
| 205 |
%preun libs |
| 206 |
%systemd_preun authselect-apply-changes.service authselect-first-boot.service |
| 207 |
|
| 208 |
%postun libs |
| 209 |
%systemd_postun authselect-apply-changes.service authselect-first-boot.service |
| 210 |
|
| 211 |
%posttrans libs |
| 212 |
# Keep nss-altfiles for all rpm-ostree based systems. |
| 213 |
# See https://github.com/authselect/authselect/issues/48 |
| 214 |
if test -e /run/ostree-booted; then |
| 215 |
for PROFILE in `ls %{_datadir}/authselect/default`; do |
| 216 |
%{_bindir}/authselect create-profile $PROFILE --vendor --base-on $PROFILE --symlink-pam --symlink-dconf --symlink=REQUIREMENTS --symlink=README &> /dev/null |
| 217 |
%__sed -i -e 's/{if "with-altfiles":\([^}]\+\)}/\1/g' %{_datadir}/authselect/vendor/$PROFILE/nsswitch.conf &> /dev/null |
| 218 |
done |
| 219 |
fi |
| 220 |
|
| 221 |
# If this is a new installation select the default configuration. |
| 222 |
if [ $1 == 1 ] ; then |
| 223 |
%{_bindir}/authselect select @system-default --force --nobackup &> /dev/null |
| 224 |
exit 0 |
| 225 |
fi |
| 226 |
|
| 227 |
# Minimal profile was removed. Switch to local during upgrade. |
| 228 |
%__sed -i '1 s/^minimal$/local/' %{_sysconfdir}/authselect/authselect.conf |
| 229 |
for file in %{_sysconfdir}/authselect/custom/*/*; do |
| 230 |
link=`%{_bindir}/readlink "$file"` |
| 231 |
if [[ "$link" == %{_datadir}/authselect/default/minimal/* ]]; then |
| 232 |
target=`%{_bindir}/basename "$link"` |
| 233 |
%{_bindir}/ln -sfn "%{_datadir}/authselect/default/local/$target" "$file" |
| 234 |
fi |
| 235 |
done |
| 236 |
|
| 237 |
# We might have add vendor profiles, compute new profiles checksum |
| 238 |
%{_bindir}/find "%{_datadir}/authselect" -mindepth 2 -type f \ |
| 239 |
-printf "%%P\n" -exec %{_bindir}/sha256sum {} + | %{_bindir}/sha256sum \ |
| 240 |
> "%{_datadir}/authselect/checksum" |
| 241 |
|
| 242 |
# Apply any changes to profiles (validates configuration first internally) |
| 243 |
%{_bindir}/authselect apply-changes &> /dev/null |
| 244 |
|
| 245 |
exit 0 |
| 246 |
|
| 247 |
%preun |
| 248 |
if [ $1 == 0 ] ; then |
| 249 |
# Remove authselect symbolic links so all authselect files can be |
| 250 |
# deleted safely. If this fail, the uninstallation must fail to avoid |
| 251 |
# breaking the system by removing PAM files. However, the command can |
| 252 |
# only fail if it can not write to the file system. |
| 253 |
%{_bindir}/authselect opt-out |
| 254 |
fi |
| 255 |
|
| 256 |
%autochangelog |