#ASAN %%global asan_build 1 %global eln_build 1 %if 0%{?fedora} || 0%{?rhel} > 10 %bcond_without rpm_plugin %else %bcond_with rpm_plugin %endif %if %{defined eln_build} %global selinuxtype targeted %global moduletype contrib %define semodule_version main %endif Summary: Application Whitelisting Daemon Name: fapolicyd Version: 2.0.1 Release: 1.20261012100541444804.pr439.26.g105b46c%{?dist} License: GPL-3.0-or-later URL: http://people.redhat.com/sgrubb/fapolicyd Source0: fapolicyd-2.0.1.tar.gz Source1: https://github.com/linux-application-whitelisting/%{name}-selinux/archive/refs/heads/%{semodule_version}.tar.gz#/%{name}-selinux-%{semodule_version}.tar.gz BuildRequires: gcc BuildRequires: kernel-headers BuildRequires: autoconf automake make gcc libtool BuildRequires: systemd systemd-devel openssl-devel rpm-devel file-devel file BuildRequires: libcap-ng-devel libseccomp-devel lmdb-devel BuildRequires: python3-devel BuildRequires: uthash-devel %if %{with rpm_plugin} BuildRequires: pkgconfig(rpm) %endif %if %{defined asan_build} BuildRequires: libasan %endif %if %{defined eln_build} Recommends: %{name}-selinux %endif Requires(pre): shadow-utils Requires(post): systemd-units Requires(preun): systemd-units Requires(postun): systemd-units Requires(posttrans): systemd %if %{with rpm_plugin} Provides: rpm-plugin-fapolicyd = %{version}-%{release} # Current RPM-owned plugin package EVRs are below the next RPM major. Obsoletes: rpm-plugin-fapolicyd < 7 %else Requires: rpm-plugin-fapolicyd %endif %description Fapolicyd (File Access Policy Daemon) implements application whitelisting to decide file access rights. Applications that are known via a reputation source are allowed access while unknown applications are not. The daemon makes use of the kernel's fanotify interface to determine file access rights. %if %{defined eln_build} %package selinux Summary: Fapolicyd selinux Group: Applications/System Requires: %{name} = %{version}-%{release} BuildRequires: selinux-policy %if 0%{?rhel} < 9 BuildRequires: selinux-policy-devel >= 3.14.3-108 %else %if 0%{?rhel} == 9 BuildRequires: selinux-policy-devel >= 38.1.2 %else BuildRequires: selinux-policy-devel >= 38.2 %endif %endif BuildArch: noarch %{?selinux_requires} %description selinux The %{name}-selinux package contains selinux policy for the %{name} daemon. %endif %prep %setup -q -n fapolicyd-2.0.1 %if %{defined eln_build} # selinux %setup -q -D -T -a 1 %endif # generate rules for python sed -i "s|%python3_path%|`readlink -f %{__python3}`|g" rules.d/*.rules %if 0%{?fedora} || 0%{?rhel} > 9 # Create a sysusers.d config file cat >fapolicyd.sysusers.conf < %{buildroot}/%{_datadir}/%{name}/default-ruleset.known-libs chmod 644 %{buildroot}/%{_datadir}/%{name}/default-ruleset.known-libs %if %{defined eln_build} # selinux install -d %{buildroot}%{_datadir}/selinux/packages/%{selinuxtype} install -m 0644 %{name}-selinux-%{semodule_version}/%{name}.pp.bz2 %{buildroot}%{_datadir}/selinux/packages/%{selinuxtype} install -d -p %{buildroot}%{_datadir}/selinux/devel/include/%{moduletype} install -p -m 644 %{name}-selinux-%{semodule_version}/%{name}.if %{buildroot}%{_datadir}/selinux/devel/include/%{moduletype}/ipp-%{name}.if %endif #cleanup find %{buildroot} \( -name '*.la' -o -name '*.a' \) -delete %if 0%{?fedora} || 0%{?rhel} > 9 install -m0644 -D fapolicyd.sysusers.conf %{buildroot}%{_sysusersdir}/fapolicyd.conf %endif %define manage_default_rules default_changed=0 \ # check changed fapolicyd.rules \ if [ -e %{_sysconfdir}/%{name}/%{name}.rules ]; then \ diff %{_sysconfdir}/%{name}/%{name}.rules %{_datadir}/%{name}/%{name}.rules.known-libs >/dev/null 2>&1 || { \ default_changed=1; \ #echo "change detected in fapolicyd.rules"; \ } \ fi \ if [ -e %{_sysconfdir}/%{name}/rules.d ]; then \ default_ruleset=''; \ # get listing of default rule files in known-libs \ [ -e %{_datadir}/%{name}/default-ruleset.known-libs ] && default_ruleset=`cat %{_datadir}/%{name}/default-ruleset.known-libs`; \ # check for removed or added files \ default_count=`echo "$default_ruleset" | wc -l`; \ current_count=`ls -1 %{_sysconfdir}/%{name}/rules.d/*.rules | wc -l`; \ [ $default_count -eq $current_count ] || { \ default_changed=1; \ # echo "change detected in number of rule files d:$default_count vs c:$current_count"; \ }; \ for file in %{_sysconfdir}/%{name}/rules.d/*.rules; do \ if echo "$default_ruleset" | grep -q "`basename $file`"; then \ # compare content of the rule files \ diff $file %{_datadir}/%{name}/sample-rules/`basename $file` >/dev/null 2>&1 || { \ default_changed=1; \ # echo "change detected in `basename $file`"; \ }; \ else \ # added file detected \ default_changed=1; \ # echo "change detected in added rules file `basename $file`"; \ fi; \ done; \ fi; \ # remove files if no change against default rules detected \ [ $default_changed -eq 0 ] && rm -rf %{_sysconfdir}/%{name}/%{name}.rules %{_sysconfdir}/%{name}/rules.d/* || : \ %check make check VERBOSE=yes %pre %if 0%{?rhel} && 0%{?rhel} <= 9 getent passwd %{name} >/dev/null || useradd -r -M -d %{_localstatedir}/lib/%{name} -s /sbin/nologin -c "Application Whitelisting Daemon" %{name} %endif if [ $1 -eq 2 ]; then # detect changed default rules in case of upgrade %manage_default_rules fi %post # if no pre-existing rule file if [ ! -e %{_sysconfdir}/%{name}/%{name}.rules ] ; then files=`ls %{_sysconfdir}/%{name}/rules.d/ 2>/dev/null | wc -w` # Only if no pre-existing component rules if [ "$files" -eq 0 ] ; then ## Install the known libs policy for rulesfile in `cat %{_datadir}/%{name}/default-ruleset.known-libs`; do cp %{_datadir}/%{name}/sample-rules/$rulesfile %{_sysconfdir}/%{name}/rules.d/ done chgrp %{name} %{_sysconfdir}/%{name}/rules.d/* if [ -x /usr/sbin/restorecon ] ; then # restore correct label /usr/sbin/restorecon -F %{_sysconfdir}/%{name}/rules.d/* fi fagenrules >/dev/null fi fi %systemd_post %{name}.service %preun %systemd_preun %{name}.service if [ $1 -eq 0 ]; then # detect changed default rules in case of uninstall %manage_default_rules else [ -e %{_sysconfdir}/%{name}/%{name}.rules ] && rm -rf %{_sysconfdir}/%{name}/rules.d/* || : fi %postun %systemd_postun_with_restart %{name}.service %posttrans %if %{with rpm_plugin} # The old package's postun may have queued a restart before its loaded RPM # plugin reaches tsm_post. Keep the old daemon alive for that one transaction. if [ -p %{_rundir}/%{name}/%{name}.fifo ] && \ [ ! -p %{_rundir}/%{name}/%{name}-update.fifo ]; then systemctl set-property %{name}.service Markers=-needs-restart || : touch %{_rundir}/%{name}/restart-required chown root:%{name} %{_rundir}/%{name}/restart-required chmod 0640 %{_rundir}/%{name}/restart-required echo "fapolicyd is using its legacy RPM plugin endpoint; restart the service or reboot to complete the plugin migration" >&2 fi %endif %files %doc README.md %{!?_licensedir:%global license %%doc} %license COPYING %attr(755,root,root) %dir %{_datadir}/%{name} %attr(755,root,root) %dir %{_datadir}/%{name}/sample-rules %attr(644,root,root) %{_datadir}/%{name}/default-ruleset.known-libs %attr(644,root,root) %{_datadir}/%{name}/sample-rules/* %attr(644,root,root) %{_datadir}/%{name}/fapolicyd-magic.mgc %attr(750,root,%{name}) %dir %{_sysconfdir}/%{name} %attr(750,root,%{name}) %dir %{_sysconfdir}/%{name}/trust.d %attr(750,root,%{name}) %dir %{_sysconfdir}/%{name}/rules.d %attr(644,root,%{name}) %{_sysconfdir}/bash_completion.d/fapolicyd.bash_completion %ghost %verify(not md5 size mtime) %attr(644,root,%{name}) %{_sysconfdir}/%{name}/rules.d/* %ghost %verify(not md5 size mtime) %attr(644,root,%{name}) %{_sysconfdir}/%{name}/%{name}.rules %config(noreplace) %attr(644,root,%{name}) %{_sysconfdir}/%{name}/%{name}.conf %config(noreplace) %attr(644,root,%{name}) %{_sysconfdir}/%{name}/%{name}-filter.conf %config(noreplace) %attr(644,root,%{name}) %{_sysconfdir}/%{name}/%{name}.trust %ghost %attr(644,root,%{name}) %{_sysconfdir}/%{name}/compiled.rules %attr(644,root,root) %{_unitdir}/%{name}.service %attr(644,root,root) %{_tmpfilesdir}/%{name}.conf %attr(755,root,root) %{_sbindir}/%{name} %attr(755,root,root) %{_sbindir}/%{name}-cli %attr(755,root,root) %{_sbindir}/%{name}-perf-test %attr(755,root,root) %{_libexecdir}/%{name}-rpm-loader %attr(755,root,root) %{_sbindir}/fagenrules %attr(644,root,root) %{_mandir}/man8/fagenrules.8* %attr(644,root,root) %{_mandir}/man8/fapolicyd.8* %attr(644,root,root) %{_mandir}/man8/fapolicyd-cli.8* %attr(644,root,root) %{_mandir}/man8/fapolicyd-perf-test.8* %attr(644,root,root) %{_mandir}/man5/* %ghost %attr(440,%{name},%{name}) %verify(not md5 size mtime) %{_localstatedir}/log/%{name}-access.log %attr(770,root,%{name}) %dir %{_localstatedir}/lib/%{name} %attr(770,root,%{name}) %dir /run/%{name} %ghost %attr(600,root,root) %verify(not md5 size mtime) /run/%{name}/%{name}.pid %ghost %attr(660,root,%{name}) /run/%{name}/%{name}.fifo %ghost %attr(660,root,%{name}) /run/%{name}/%{name}-update.fifo %ghost %attr(640,root,%{name}) /run/%{name}/restart-required %ghost %attr(640,%{name},%{name}) %verify(not md5 size mtime) /run/%{name}/%{name}.state %ghost %attr(640,%{name},%{name}) %verify(not md5 size mtime) /run/%{name}/%{name}.metrics %ghost %attr(640,%{name},%{name}) %verify(not md5 size mtime) /run/%{name}/%{name}.timing %ghost %attr(660,%{name},%{name}) %verify(not md5 size mtime) %{_localstatedir}/lib/%{name}/data.mdb %ghost %attr(660,%{name},%{name}) %verify(not md5 size mtime) %{_localstatedir}/lib/%{name}/lock.mdb %if 0%{?fedora} || 0%{?rhel} > 9 %{_sysusersdir}/fapolicyd.conf %endif %if %{with rpm_plugin} %doc src/plugin/rpm-plugin-migration.md %{_libdir}/rpm-plugins/fapolicyd_rpm.so %{_rpmconfigdir}/macros.d/macros.transaction_fapolicyd_rpm %{_mandir}/man8/fapolicyd-rpm-plugin.8* %endif %if %{defined eln_build} %files selinux %{_datadir}/selinux/packages/%{selinuxtype}/%{name}.pp.bz2 %ghost %verify(not md5 size mode mtime) %{_sharedstatedir}/selinux/%{selinuxtype}/active/modules/200/%{name} %{_datadir}/selinux/devel/include/%{moduletype}/ipp-%{name}.if %post selinux %selinux_modules_install -s %{selinuxtype} %{_datadir}/selinux/packages/%{selinuxtype}/%{name}.pp.bz2 %selinux_relabel_post -s %{selinuxtype} %postun selinux if [ $1 -eq 0 ]; then %selinux_modules_uninstall -s %{selinuxtype} %{name} fi %posttrans selinux %selinux_relabel_post -s %{selinuxtype} %endif %changelog * Mon Oct 12 2026 Packit - 2.0.1-1.20261012100541444804.pr439.26.g105b46c - Add systemd-sysusers config (Petr Lautrbach) - drop runtime dir from service (Petr Lautrbach) - install tmpfiles.d conf (Petr Lautrbach) - Create RUN_DIR if it does not exist (Petr Lautrbach) - Update changelog (Steve Grubb) - Add internal runtime linker path rule (Steve Grubb) - drop python2 substitution (Steve Grubb) - rate limit the error logging for bad writes (Steve Grubb) - Update Ubuntu build for new dependency (Steve Grubb) - Add fapolicyd-owned RPM transaction plugin (Steve Grubb) - Preserve the systemd runtime directory after stop (Steve Grubb) - Update Changelog (Steve Grubb) - Change error message (Steve Grubb) - Fix fd_fgets partial-line boundary handling (Steve Grubb) - Add Alpine musl GitHub Actions build (Steve Grubb) - Fix GID negative intersection test (Steve Grubb) - Fix libc portability assumptions (Steve Grubb) - Work around a LTO problem for older gcc (Steve Grubb) - Warn about misleading policy rule fields (Steve Grubb) - Simplify filter traversal after validating and fixing its behavior (Steve Grubb) - Reject excessive filter depth before attaching a child (Steve Grubb) - Normalize repeated slashes before matching trust filter paths (Steve Grubb) - Diagnose suspicious filter refinements when rules are loaded (Steve Grubb) - Repair filter fixtures and expand traversal coverage (Steve Grubb) - Adjust daemon capabilities (Steve Grubb) - Open the 2.0.2 development cycle (Steve Grubb) * Thu Aug 20 2026 Petr Lautrbach - 2.0.2-1 - New release