Blame SPECS/fapolicyd.spec

037a42
%global selinuxtype targeted
037a42
%global moduletype contrib
037a42
%define semodule_version 0.2
037a42
037a42
714ab2
Summary: Application Whitelisting Daemon
714ab2
Name: fapolicyd
037a42
Version: 1.0
037a42
Release: 3%{?dist}
714ab2
License: GPLv3+
714ab2
URL: http://people.redhat.com/sgrubb/fapolicyd
714ab2
Source0: https://people.redhat.com/sgrubb/fapolicyd/%{name}-%{version}.tar.gz
037a42
Source1: https://github.com/linux-application-whitelisting/%{name}-selinux/releases/download/v%{semodule_version}/%{name}-selinux-%{semodule_version}.tar.gz
037a42
BuildRequires: gcc
714ab2
BuildRequires: kernel-headers
714ab2
BuildRequires: autoconf automake make gcc libtool
714ab2
BuildRequires: systemd-devel libgcrypt-devel rpm-devel file-devel
714ab2
BuildRequires: libcap-ng-devel libseccomp-devel lmdb-devel
714ab2
BuildRequires: python3-devel
714ab2
BuildRequires: python2-devel
037a42
Recommends: %{name}-selinux
714ab2
Requires(pre): shadow-utils
714ab2
Requires(post): systemd-units
714ab2
Requires(preun): systemd-units
714ab2
Requires(postun): systemd-units
714ab2
037a42
Patch1: selinux.patch
037a42
Patch2: fapolicyd-0.9.5-integrity.patch
037a42
Patch3: selinux-pid.patch
037a42
Patch4: fapolicyd-cli-args.patch
037a42
Patch5: fapolicyd-magic-override.patch
037a42
Patch6: fapolicyd-magic-override2.patch
037a42
Patch7: fapolicyd-man-page.patch
037a42
037a42
Patch8: fapolicyd-trust.patch
037a42
Patch9: fapolicyd-cli-empty-db.patch
037a42
Patch10: fapolicyd-cli-big-buffer.patch
037a42
Patch11: fapolicyd-get-line.patch
037a42
Patch12: fapolicyd-man-page-trust.patch
714ab2
714ab2
%description
714ab2
Fapolicyd (File Access Policy Daemon) implements application whitelisting
714ab2
to decide file access rights. Applications that are known via a reputation
714ab2
source are allowed access while unknown applications are not. The daemon
714ab2
makes use of the kernel's fanotify interface to determine file access rights.
714ab2
037a42
%package        selinux
037a42
Summary:        Fapolicyd selinux
037a42
Group:          Applications/System
037a42
Requires:       %{name} = %{version}-%{release}
037a42
BuildRequires:  selinux-policy
037a42
BuildRequires:  selinux-policy-devel
037a42
BuildArch: noarch
037a42
%{?selinux_requires}
037a42
037a42
%description    selinux
037a42
The %{name}-selinux package contains selinux policy for the %{name} daemon.
714ab2
714ab2
%prep
037a42
714ab2
%setup -q
714ab2
037a42
# selinux
037a42
%setup -q -D -T -a 1
714ab2
714ab2
# generate rules for python
037a42
sed -i "s/%python2_path%/`readlink -f %{__python2} | sed 's/\//\\\\\//g'`/g" init/%{name}.rules.*
037a42
sed -i "s/%python3_path%/`readlink -f %{__python3} | sed 's/\//\\\\\//g'`/g" init/%{name}.rules.*
037a42
sed -i "s/%ld_so_path%/`find /usr/lib64/ -type f -name 'ld-2\.*.so' | sed 's/\//\\\\\//g'`/g" init/%{name}.rules.*
037a42
037a42
%patch1 -p1 -b .selinux
037a42
%patch2 -p1 -b .integrity
037a42
%patch3 -p1 -b .pid
037a42
%patch4 -p1 -b .args
037a42
%patch5 -p1
037a42
%patch6 -p1
037a42
%patch7 -p1 -b .man-page
037a42
037a42
%patch8 -p1 -b .trust
037a42
%patch9 -p1 -b .cli-empty-db
037a42
%patch10 -p1 -b .cli-big-buffer
037a42
%patch11 -p1 -b .get-line
037a42
%patch12 -p1 -b .man-page-trust
714ab2
714ab2
%build
714ab2
./autogen.sh
037a42
%configure \
037a42
    --with-audit \
037a42
    --with-rpm \
037a42
    --disable-shared
037a42
714ab2
make CFLAGS="%{optflags}" %{?_smp_mflags}
714ab2
037a42
# selinux
037a42
pushd %{name}-selinux-%{semodule_version}
037a42
make
037a42
popd
037a42
037a42
# selinux
037a42
%pre selinux
037a42
%selinux_relabel_pre -s %{selinuxtype}
037a42
714ab2
%install
714ab2
make DESTDIR="%{buildroot}" INSTALL='install -p' install
714ab2
mkdir -p %{buildroot}/%{python3_sitelib}/dnf-plugins/
714ab2
install -p -m 644 dnf/%{name}-dnf-plugin.py %{buildroot}/%{python3_sitelib}/dnf-plugins/
714ab2
install -p -m 644 -D init/%{name}-tmpfiles.conf %{buildroot}/%{_tmpfilesdir}/%{name}.conf
037a42
install -p -m 644 init/%{name}.rules.known-libs %{buildroot}/%{_sysconfdir}/%{name}/%{name}.rules
714ab2
mkdir -p %{buildroot}/%{_localstatedir}/lib/%{name}
714ab2
mkdir -p %{buildroot}/run/%{name}
714ab2
037a42
# selinux
037a42
install -d %{buildroot}%{_datadir}/selinux/packages/%{selinuxtype}
037a42
install -m 0644 %{name}-selinux-%{semodule_version}/%{name}.pp.bz2 %{buildroot}%{_datadir}/selinux/packages/%{selinuxtype}
037a42
install -d -p %{buildroot}%{_datadir}/selinux/devel/include/%{moduletype}
037a42
install -p -m 644 %{name}-selinux-%{semodule_version}/%{name}.if %{buildroot}%{_datadir}/selinux/devel/include/%{moduletype}/ipp-%{name}.if
037a42
037a42
#cleanup
037a42
find %{buildroot} \( -name '*.la' -o -name '*.a' \) -exec rm -f {} ';'
037a42
714ab2
%pre
714ab2
getent passwd %{name} >/dev/null || useradd -r -M -d %{_localstatedir}/lib/%{name} -s /sbin/nologin -c "Application Whitelisting Daemon" %{name}
714ab2
714ab2
%post
714ab2
%systemd_post %{name}.service
714ab2
714ab2
%preun
714ab2
%systemd_preun %{name}.service
714ab2
714ab2
%postun
714ab2
%systemd_postun_with_restart %{name}.service
714ab2
714ab2
%files
714ab2
%doc README.md
714ab2
%{!?_licensedir:%global license %%doc}
714ab2
%license COPYING
037a42
%attr(755,root,%{name}) %dir %{_datadir}/%{name}
037a42
%attr(644,root,%{name}) %{_datadir}/%{name}/%{name}.rules.*
714ab2
%attr(750,root,%{name}) %dir %{_sysconfdir}/%{name}
714ab2
%config(noreplace) %attr(644,root,%{name}) %{_sysconfdir}/%{name}/%{name}.conf
037a42
%config(noreplace) %attr(644,root,%{name}) %{_sysconfdir}/%{name}/%{name}.trust
037a42
%config(noreplace) %attr(644,root,%{name}) %{_sysconfdir}/%{name}/%{name}.rules
714ab2
%attr(644,root,root) %{_unitdir}/%{name}.service
714ab2
%attr(644,root,root) %{_tmpfilesdir}/%{name}.conf
714ab2
%attr(755,root,root) %{_sbindir}/%{name}
714ab2
%attr(755,root,root) %{_sbindir}/%{name}-cli
714ab2
%attr(644,root,root) %{_mandir}/man8/*
714ab2
%attr(644,root,root) %{_mandir}/man5/*
714ab2
%attr(644,root,root) %{_mandir}/man1/*
037a42
%attr(644,root,root) %{_datadir}/%{name}/*
714ab2
%ghost %{_localstatedir}/log/%{name}-access.log
714ab2
%attr(770,root,%{name}) %dir %{_localstatedir}/lib/%{name}
714ab2
%attr(770,root,%{name}) %dir /run/%{name}
714ab2
%ghost %{_localstatedir}/run/%{name}/%{name}.fifo
714ab2
%ghost %{_localstatedir}/lib/%{name}/data.mdb
714ab2
%ghost %{_localstatedir}/lib/%{name}/lock.mdb
714ab2
%{python3_sitelib}/dnf-plugins/%{name}-dnf-plugin.py
714ab2
%{python3_sitelib}/dnf-plugins/__pycache__/%{name}-dnf-plugin.*.pyc
714ab2
037a42
# selinux
037a42
%files selinux
037a42
%{_datadir}/selinux/packages/%{selinuxtype}/%{name}.pp.bz2
037a42
%ghost %{_sharedstatedir}/selinux/%{selinuxtype}/active/modules/200/%{name}
037a42
%{_datadir}/selinux/devel/include/%{moduletype}/ipp-%{name}.if
037a42
037a42
%post selinux
037a42
%selinux_modules_install -s %{selinuxtype} %{_datadir}/selinux/packages/%{selinuxtype}/%{name}.pp.bz2
037a42
037a42
%postun selinux
037a42
if [ $1 -eq 0 ]; then
037a42
    %selinux_modules_uninstall -s %{selinuxtype} %{name}
037a42
fi
037a42
037a42
%posttrans selinux
037a42
%selinux_relabel_post -s %{selinuxtype}
037a42
714ab2
%changelog
037a42
* Tue Jun 30 2020 Radovan Sroka <rsroka@redhat.com> - 1.0-3
037a42
RHEL 8.3 ERRATUM
037a42
- fixed manpage fapolicyd-conf
037a42
Resolves: rhbz#1817413
037a42
037a42
* Mon May 25 2020 Radovan Sroka <rsroka@redhat.com> - 1.0-2
037a42
RHEL 8.3 ERRATUM
037a42
- rebase to v1.0
037a42
- installed multiple policies to /usr/share/fapolicyd
037a42
  - known-libs (default)
037a42
  - restrictive
037a42
- installed fapolicyd.trust file
037a42
- enhanced fapolicyd-cli
037a42
Resolves: rhbz#1817413
037a42
- introduced fapolicyd-selinux that provides SELinux policy module
037a42
Resolves: rhbz#1714529
037a42
714ab2
* Tue Mar 03 2020 Radovan Sroka <rsroka@redhat.com> - 0.9.1-4
714ab2
RHEL 8.2 ERRATUM
714ab2
- fixed possible heap buffer overflow in elf parser
714ab2
Resolves: rhbz#1807912
714ab2
714ab2
* Tue Feb 11 2020 Radovan Sroka <rsroka@redhat.com> - 0.9.1-3
714ab2
RHEL 8.2 ERRATUM
714ab2
- fixed build time python interpreter detection (spec)
714ab2
- added python2-devel as a BuildRequires (spec)
714ab2
- allow running bash scripts in home directories
714ab2
Resolves: rhbz#1801872
714ab2
714ab2
* Wed Nov 20 2019 Radovan Sroka <rsroka@redhat.com> - 0.9.1-2
714ab2
RHEL 8.2 ERRATUM
714ab2
- rebase to v0.9.1
714ab2
- updated default configuration with new syntax
714ab2
- removed daemon mounts configuration
714ab2
Resolves: rhbz#1759895
714ab2
- default fapolicyd policy prevents Ansible from running
714ab2
- added ansible rule to default ruleset
714ab2
Resolves: rhbz#1746464
714ab2
- suspicious logs on service start
714ab2
Resolves: rhbz#1747494
714ab2
- fapolicyd blocks dracut from generating initramfs
714ab2
- added dracut rule to default configuration
714ab2
Resolves: rhbz#1757736
714ab2
- fapolicyd fails to identify perl interpreter
714ab2
Resolves: rhbz#1765039
714ab2
714ab2
* Wed Jul 24 2019 Radovan Sroka <rsroka@redhat.com> - 0.8.10-3
714ab2
- added missing manpage for fapolicyd-cli
714ab2
Resolves: rhbz#1708015
714ab2
714ab2
* Mon Jul 22 2019 Radovan Sroka <rsroka@redhat.com> - 0.8.10-2
714ab2
- Convert hashes to lowercase like sha256sum outputs
714ab2
- Stop littering STDOUT output for dnf plugin in fapolicyd
714ab2
Resolves: rhbz#1721496
714ab2
714ab2
* Tue Jun 18 2019 Radovan Sroka <rsroka@redhat.com> - 0.8.10-1
714ab2
- new upstream release
714ab2
Resolves: rhbz#1673323
714ab2
714ab2
* Mon May 06 2019 Radovan Sroka <rsroka@redhat.com> - 0.8.9-1
714ab2
- New upstream release
714ab2
- imported from fedora30
714ab2
  resolves: rhbz#1673323
714ab2
714ab2
* Wed Mar 13 2019 Radovan Sroka <rsroka@redhat.com> - 0.8.8-2
714ab2
- backport some patches to resolve dac_override for fapolicyd
714ab2
714ab2
* Mon Mar 11 2019 Radovan Sroka <rsroka@redhat.com> - 0.8.8-1
714ab2
- New upstream release
714ab2
- Added new DNF plugin that can update the trust database when rpms are installed
714ab2
- Added support for FAN_OPEN_EXEC_PERM
714ab2
714ab2
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.8.7-3
714ab2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
714ab2
714ab2
714ab2
* Wed Oct 03 2018 Steve Grubb <sgrubb@redhat.com> 0.8.7-1
714ab2
- New upstream bugfix release
714ab2
714ab2
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.8.6-2
714ab2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
714ab2
714ab2
* Thu Jun 07 2018 Steve Grubb <sgrubb@redhat.com> 0.8.6-1
714ab2
- New upstream feature release
714ab2
714ab2
* Fri May 18 2018 Steve Grubb <sgrubb@redhat.com> 0.8.5-2
714ab2
- Add dist tag (#1579362)
714ab2
714ab2
* Fri Feb 16 2018 Steve Grubb <sgrubb@redhat.com> 0.8.5-1
714ab2
- New release