Blame SPECS/fapolicyd.spec

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