7acb38
%global debug_package   %{nil}
7acb38
7acb38
# container-selinux
7acb38
%global git0 https://github.com/containers/container-selinux
7acb38
%global commit0 fd55ae0a6a4e879573f9251de2dd6113e842ac0c
7acb38
%global shortcommit0 %(c=%{commit0}; echo ${c:0:7})
7acb38
7acb38
# container-selinux stuff (prefix with ds_ for version/release etc.)
7acb38
# Some bits borrowed from the openstack-selinux package
7acb38
%global selinuxtype targeted
7acb38
%global moduletype services
7acb38
%global modulenames container
7acb38
7acb38
# Usage: _format var format
7acb38
# Expand 'modulenames' into various formats as needed
7acb38
# Format must contain '$x' somewhere to do anything useful
7acb38
%global _format() export %1=""; for x in %{modulenames}; do %1+=%2; %1+=" "; done;
7acb38
7acb38
# Version of SELinux we were using
7acb38
%global selinux_policyver 3.14.3-9.el8
7acb38
7acb38
Epoch: 2
7acb38
Name: container-selinux
7acb38
Version: 2.130.0
7acb38
Release: 1%{?dist}
7acb38
License: GPLv2
7acb38
URL: %{git0}
7acb38
Summary: SELinux policies for container runtimes
7acb38
Source0: %{git0}/archive/%{commit0}/%{name}-%{shortcommit0}.tar.gz
7acb38
BuildArch: noarch
7acb38
BuildRequires: git
7acb38
BuildRequires: pkgconfig(systemd)
7acb38
BuildRequires: selinux-policy >= %{selinux_policyver}
7acb38
BuildRequires: selinux-policy-devel >= %{selinux_policyver}
7acb38
# RE: rhbz#1195804 - ensure min NVR for selinux-policy
7acb38
Requires: selinux-policy >= %{selinux_policyver}
7acb38
Requires(post): selinux-policy-base >= %{selinux_policyver}
7acb38
Requires(post): selinux-policy-targeted >= %{selinux_policyver}
7acb38
Requires(post): policycoreutils >= 2.5-11
7acb38
%if 0%{?rhel} > 7 || 0%{?fedora}
7acb38
Requires(post): policycoreutils-python-utils
7acb38
%else
7acb38
Requires(post): policycoreutils-python
7acb38
%endif
7acb38
Requires(post): libselinux-utils
7acb38
Requires(post): sed
7acb38
Obsoletes: %{name} <= 2:1.12.5-14
7acb38
Obsoletes: docker-selinux <= 2:1.12.4-28
7acb38
Provides: docker-selinux = %{epoch}:%{version}-%{release}
7acb38
Provides: docker-engine-selinux = %{epoch}:%{version}-%{release}
7acb38
7acb38
%description
7acb38
SELinux policy modules for use with container runtimes.
7acb38
7acb38
%prep
7acb38
%autosetup -Sgit -n %{name}-%{commit0}
7acb38
7acb38
%build
7acb38
make
7acb38
7acb38
%install
7acb38
# install policy modules
7acb38
%_format MODULES $x.pp.bz2
7acb38
install -d %{buildroot}%{_datadir}/selinux/packages
7acb38
install -d -p %{buildroot}%{_datadir}/selinux/devel/include/services
7acb38
install -p -m 644 %{modulenames}.if %{buildroot}%{_datadir}/selinux/devel/include/services
7acb38
install -m 0644 $MODULES %{buildroot}%{_datadir}/selinux/packages
7acb38
7acb38
# remove spec file
7acb38
rm -rf %{name}.spec
7acb38
7acb38
%check
7acb38
7acb38
%pre
7acb38
%selinux_relabel_pre -s %{selinuxtype}
7acb38
7acb38
%post
7acb38
# Install all modules in a single transaction
7acb38
if [ $1 -eq 1 ]; then
7acb38
   %{_sbindir}/setsebool -P -N virt_use_nfs=1 virt_sandbox_use_all_caps=1
7acb38
fi
7acb38
%_format MODULES %{_datadir}/selinux/packages/$x.pp.bz2
7acb38
%{_sbindir}/semodule -n -s %{selinuxtype} -r container 2> /dev/null
7acb38
%{_sbindir}/semodule -n -s %{selinuxtype} -d docker 2> /dev/null
7acb38
%{_sbindir}/semodule -n -s %{selinuxtype} -d gear 2> /dev/null
7acb38
%selinux_modules_install -s %{selinuxtype} $MODULES
7acb38
. %{_sysconfdir}/selinux/config
7acb38
sed -e "\|container_file_t|h; \${x;s|container_file_t||;{g;t};a\\" -e "container_file_t" -e "}" -i /etc/selinux/${SELINUXTYPE}/contexts/customizable_types
7acb38
matchpathcon -qV %{_sharedstatedir}/containers || restorecon -R %{_sharedstatedir}/containers &> /dev/null || :
7acb38
7acb38
%postun
7acb38
if [ $1 -eq 0 ]; then
7acb38
%selinux_modules_uninstall -s %{selinuxtype} %{modulenames} docker
7acb38
fi
7acb38
7acb38
%posttrans
7acb38
%selinux_relabel_post -s %{selinuxtype}
7acb38
7acb38
#define license tag if not already defined
7acb38
%{!?_licensedir:%global license %doc}
7acb38
7acb38
%files
7acb38
%doc README.md
7acb38
%{_datadir}/selinux/*
7acb38
7acb38
%changelog
7acb38
* Tue Apr 07 2020 Jindrich Novy <jnovy@redhat.com> - 2:2.130.0-1
7acb38
- update to https://github.com/containers/container-selinux/releases/tag/v2.130.0
7acb38
- don't use macros in changelog
7acb38
- Related: #1821193
7acb38
7acb38
* Wed Dec 11 2019 Jindrich Novy <jnovy@redhat.com> - 2:2.124.0-1
7acb38
- update to 2.124.0
7acb38
- Related: RHELPLAN-25139
7acb38
7acb38
* Mon Dec 09 2019 Jindrich Novy <jnovy@redhat.com> - 2:2.123.0-2
7acb38
- implement spec file refactoring by Zdenek Pytela, namely:
7acb38
  Change the uninstall command in the %%postun section of the specfile
7acb38
  to use the %%selinux_modules_uninstall macro which uses priority 200.
7acb38
  Change the install command in the %post section if the specfile
7acb38
  to use the %%selinux_modules_install macro.
7acb38
  Replace relabel commands with using the %%selinux_relabel_pre and
7acb38
  %%selinux_relabel_post macros.
7acb38
  Change formatting so that the lines are vertically aligned
7acb38
  in the %%postun section.
7acb38
  (https://github.com/containers/container-selinux/pull/85)
7acb38
- Related: RHELPLAN-25139
7acb38
7acb38
* Tue Nov 26 2019 Jindrich Novy <jnovy@redhat.com> - 2:2.123.0-1
7acb38
- update to 2.123.0
7acb38
- Related: RHELPLAN-25139
7acb38
7acb38
* Mon Nov 25 2019 Jindrich Novy <jnovy@redhat.com> - 2:2.122.0-1
7acb38
- update to 2.122.0
7acb38
- Related: RHELPLAN-25139
7acb38
7acb38
* Thu Nov 21 2019 Jindrich Novy <jnovy@redhat.com> - 2:2.119.0-3.gita233788
7acb38
- update to master container-selinux - bug 1769469
7acb38
- Related: RHELPLAN-25139
7acb38
7acb38
* Tue Nov 19 2019 Jindrich Novy <jnovy@redhat.com> - 2:2.119.0-2
7acb38
- fix post scriptlet - fail if semodule fails - bug 1729272
7acb38
- Related: RHELPLAN-25139
7acb38
7acb38
* Fri Nov 08 2019 Jindrich Novy <jnovy@redhat.com> - 2:2.119.0-1
7acb38
- update to 2.119.0
7acb38
- Related: RHELPLAN-25139
7acb38
7acb38
* Thu Oct 17 2019 Jindrich Novy <jnovy@redhat.com> - 2:2.116-1
7acb38
- update to 2.116
7acb38
  Resolves: #1748519
7acb38
7acb38
* Tue Aug 13 2019 Jindrich Novy <jnovy@redhat.com> - 2:2.107-2
7acb38
- Use at least selinux policy 3.14.3-9.el8,
7acb38
  Resolves: #1728700
7acb38
7acb38
* Fri Jun 14 2019 Lokesh Mandvekar <lsm5@redhat.com> - 2:2.107-1
7acb38
- Resolves: #1720654 - rebase to v2.107
7acb38
7acb38
* Mon Mar 11 2019 Lokesh Mandvekar <lsm5@redhat.com> - 2:2.89-1.git2521d0d
7acb38
- bump to v2.89
7acb38
7acb38
* Tue Nov 13 2018 Lokesh Mandvekar <lsm5@redhat.com> - 2:2.75-1.git99e2cfd
7acb38
- bump to v2.75
7acb38
- built commit 99e2cfd
7acb38
7acb38
* Mon Oct 22 2018 Lokesh Mandvekar <lsm5@redhat.com> - 2:2.74-1
7acb38
- Resolves: #1641655 - bump to v2.74
7acb38
- built commit a62c2db
7acb38
7acb38
* Tue Sep 18 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 2:2.73-3
7acb38
- tweak macro for fedora - applies to rhel8 as well
7acb38
7acb38
* Mon Sep 17 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 2:2.73-2
7acb38
- moved changelog entries:
7acb38
- Define spc_t as a container_domain, so that container_runtime will transition
7acb38
to spc_t even when setup with nosuid.
7acb38
- Allow container_runtimes to setattr on callers fifo_files
7acb38
- Fix restorecon to not error on missing directory
7acb38
7acb38
* Thu Sep 6 2018 Dan Walsh <dwalsh@fedoraproject.org> - 2.69-3
7acb38
- Make sure we pull in the latest selinux-policy
7acb38
7acb38
* Wed Jul 25 2018 Dan Walsh <dwalsh@fedoraproject.org> - 2.69-2
7acb38
- Add map support to container-selinux for RHEL 7.5
7acb38
- Dontudit attempts to write to kernel_sysctl_t
7acb38
7acb38
* Mon Jul 16 2018 Dan Walsh <dwalsh@fedoraproject.org> - 2.68-1
7acb38
- Add label for /var/lib/origin
7acb38
- Add customizable_file_t to customizable_types
7acb38
7acb38
* Sun Jul 15 2018 Dan Walsh <dwalsh@fedoraproject.org> - 2.67-1
7acb38
- Add policy for container_logreader_t
7acb38
7acb38
* Thu Jun 14 2018 Dan Walsh <dwalsh@fedoraproject.org> - 2.66-1
7acb38
- Allow dnsmasq to dbus chat with spc_t
7acb38
7acb38
* Sun Jun 3 2018 Dan Walsh <dwalsh@fedoraproject.org> - 2.64-1
7acb38
- Allow containers to create all socket classes
7acb38
7acb38
* Thu May 24 2018 Dan Walsh <dwalsh@fedoraproject.org> - 2.62-1
7acb38
- Label overlay directories under /var/lib/containers/ correctly
7acb38
7acb38
* Mon May 21 2018 Dan Walsh <dwalsh@fedoraproject.org> - 2.61-1
7acb38
- Allow spc_t to load kernel modules from inside of container 
7acb38
7acb38
* Mon May 21 2018 Dan Walsh <dwalsh@fedoraproject.org> - 2.60-1
7acb38
- Allow containers to list cgroup directories
7acb38
- Transition for unconfined_service_t to container_runtime_t when executing container_runtime_exec_t.
7acb38
7acb38
* Mon May 21 2018 Dan Walsh <dwalsh@fedoraproject.org> - 2.58-2
7acb38
- Run restorecon /usr/bin/podman in postinstall
7acb38
7acb38
* Fri May 18 2018 Dan Walsh <dwalsh@fedoraproject.org> - 2.58-1
7acb38
- Add labels to allow podman to be run from a systemd unit file
7acb38
7acb38
* Mon May 7 2018 Dan Walsh <dwalsh@fedoraproject.org> - 2.57-1
7acb38
- Set the version of SELinux policy required to the latest to fix build issues.
7acb38
7acb38
* Wed Apr 11 2018 Dan Walsh <dwalsh@fedoraproject.org> - 2.56-1
7acb38
- Allow container_runtime_t to transition to spc_t over unlabeled files
7acb38
7acb38
* Mon Mar 26 2018 Dan Walsh <dwalsh@fedoraproject.org> - 2.55-1
7acb38
    Allow iptables to read container state
7acb38
    Dontaudit attempts from containers to write to /proc/self
7acb38
    Allow spc_t to change attributes on container_runtime_t fifo files
7acb38
7acb38
* Thu Mar 8 2018 Dan Walsh <dwalsh@fedoraproject.org> - 2.52-1
7acb38
- Add better support for writing custom selinux policy for customer container domains.
7acb38
7acb38
* Thu Mar 8 2018 Dan Walsh <dwalsh@fedoraproject.org> - 2.51-1
7acb38
- Allow shell_exec_t as a container_runtime_t entrypoint
7acb38
7acb38
* Wed Mar 7 2018 Dan Walsh <dwalsh@fedoraproject.org> - 2.50-1
7acb38
- Allow bin_t as a container_runtime_t entrypoint
7acb38
7acb38
* Fri Mar 2 2018 Dan Walsh <dwalsh@fedoraproject.org> - 2.49-1
7acb38
- Add support for MLS running container runtimes
7acb38
- Add missing allow rules for running systemd in a container
7acb38
7acb38
* Wed Feb 21 2018 Dan Walsh <dwalsh@fedoraproject.org> - 2.48-1
7acb38
- Update policy to match master branch
7acb38
- Remove typebounds and replace with nnp_transition and nosuid_transition calls
7acb38
7acb38
* Tue Jan 9 2018 Dan Walsh <dwalsh@fedoraproject.org> - 2.41-1
7acb38
- Add support to nnp_transition for container domains
7acb38
- Eliminates need for typebounds.
7acb38
7acb38
* Tue Jan 9 2018 Dan Walsh <dwalsh@fedoraproject.org> - 2.40-1
7acb38
- Allow container_runtime_t to use user ttys
7acb38
- Fixes bounds check for container_t
7acb38
7acb38
* Mon Jan 8 2018 Dan Walsh <dwalsh@fedoraproject.org> - 2.39-1
7acb38
- Allow container runtimes to use interited terminals.  This helps
7acb38
satisfy the bounds check of container_t versus container_runtime_t.
7acb38
7acb38
* Sat Jan 6 2018 Dan Walsh <dwalsh@fedoraproject.org> - 2.38-1
7acb38
- Allow container runtimes to mmap container_file_t devices
7acb38
- Add labeling for rhel push plugin
7acb38
7acb38
* Tue Dec 12 2017 Dan Walsh <dwalsh@fedoraproject.org> - 2.37-1
7acb38
- Allow containers to use inherited ttys
7acb38
- Allow ostree to handle labels under /var/lib/containers/ostree
7acb38
7acb38
* Mon Nov 27 2017 Dan Walsh <dwalsh@fedoraproject.org> - 2.36-1
7acb38
- Allow containers to relabelto/from all file types to container_file_t
7acb38
7acb38
* Mon Nov 27 2017 Dan Walsh <dwalsh@fedoraproject.org> - 2.35-1
7acb38
- Allow container to map chr_files labeled container_file_t
7acb38
7acb38
* Wed Nov 22 2017 Dan Walsh <dwalsh@fedoraproject.org> - 2.34-1
7acb38
- Dontaudit container processes getattr on kernel file systems
7acb38
7acb38
* Sun Nov 19 2017 Dan Walsh <dwalsh@fedoraproject.org> - 2.33-1
7acb38
- Allow containers to read /etc/resolv.conf and /etc/hosts if volume
7acb38
- mounted into container.
7acb38
7acb38
* Wed Nov 8 2017 Dan Walsh <dwalsh@fedoraproject.org> - 2.32-1
7acb38
- Make sure users creating content in /var/lib with right labels
7acb38
7acb38
* Thu Oct 26 2017 Dan Walsh <dwalsh@fedoraproject.org> - 2.31-1
7acb38
- Allow the container runtime to dbus chat with dnsmasq
7acb38
- add dontaudit rules for container trying to write to /proc
7acb38
7acb38
* Tue Oct 10 2017 Dan Walsh <dwalsh@fedoraproject.org> - 2.29-1
7acb38
- Add support for lxcd
7acb38
- Add support for labeling of tmpfs storage created within a container.
7acb38
7acb38
* Mon Oct 9 2017 Dan Walsh <dwalsh@fedoraproject.org> - 2.28-1
7acb38
- Allow a container to umount a container_file_t filesystem
7acb38
7acb38
* Fri Sep 22 2017 Dan Walsh <dwalsh@fedoraproject.org> - 2.27-1
7acb38
-  Allow container runtimes to work with the netfilter sockets
7acb38
-  Allow container_file_t to be an entrypoint for VM's
7acb38
-  Allow spc_t domains to transition to svirt_t
7acb38
7acb38
* Fri Sep 22 2017 Dan Walsh <dwalsh@fedoraproject.org> - 2.24-1
7acb38
-     Make sure container_runtime_t has all access of container_t
7acb38
7acb38
* Thu Sep 7 2017 Dan Walsh <dwalsh@fedoraproject.org> - 2.23-1
7acb38
- Allow container runtimes to create sockets in tmp dirs
7acb38
7acb38
* Tue Sep 5 2017 Dan Walsh <dwalsh@fedoraproject.org> - 2.22-1
7acb38
- Add additonal support for crio labeling.
7acb38
7acb38
* Mon Aug 14 2017 Troy Dawson <tdawson@redhat.com> - 2.21-3
7acb38
- Fixup spec file conditionals
7acb38
7acb38
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2:2.21-2
7acb38
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
7acb38
7acb38
* Thu Jul 6 2017 Dan Walsh <dwalsh@fedoraproject.org> - 2.21-1
7acb38
- Allow containers to execmod on container_share_t files.
7acb38
7acb38
* Thu Jul 6 2017 Dan Walsh <dwalsh@fedoraproject.org> - 2.20-2
7acb38
- Relabel runc and crio executables
7acb38
7acb38
* Fri Jun 30 2017 Dan Walsh <dwalsh@fedoraproject.org> - 2.20-1
7acb38
- Allow container processes to getsession
7acb38
7acb38
* Wed Jun 14 2017 Lokesh Mandvekar <lsm5@redhat.com> - 2:2.19-2.1
7acb38
- update release tag to isolate from 7.3
7acb38
7acb38
* Wed Jun 14 2017 Dan Walsh <dwalsh@fedoraproject.org> - 2:2.19-1
7acb38
- Fix mcs transition problem on stdin/stdout/stderr
7acb38
- Add labels for CRI-O
7acb38
- Allow containers to use tunnel sockets
7acb38
7acb38
* Tue Jun 06 2017 Lokesh Mandvekar <lsm5@redhat.com> - 2:2.15-1.1
7acb38
- Resolves: #1451289
7acb38
- rebase to v2.15
7acb38
- built @origin/RHEL-1.12 commit 583ca40
7acb38
7acb38
* Mon Mar 20 2017 Dan Walsh <dwalsh@fedoraproject.org> - 2:2.10-2.1
7acb38
- Make sure we have a late enough version of policycoreutils
7acb38
7acb38
* Mon Mar 6 2017 Dan Walsh <dwalsh@fedoraproject.org> - 2:2.10-1
7acb38
- Update to the latest container-selinux patch from upstream
7acb38
- Label files under /usr/libexec/lxc as container_runtime_exec_t
7acb38
- Give container_t access to XFRM sockets
7acb38
- Allow spc_t to dbus chat with init system
7acb38
- Allow containers to read cgroup configuration mounted into a container
7acb38
7acb38
* Tue Feb 21 2017 Lokesh Mandvekar <lsm5@redhat.com> - 2:2.9-4
7acb38
- Resolves: #1425574
7acb38
- built commit 79a6d70
7acb38
7acb38
* Mon Feb 20 2017 Lokesh Mandvekar <lsm5@redhat.com> - 2:2.9-3
7acb38
- Resolves: #1420591
7acb38
- built @origin/RHEL-1.12 commit 8f876c4
7acb38
7acb38
* Mon Feb 13 2017 Lokesh Mandvekar <lsm5@redhat.com> - 2:2.9-2
7acb38
- built @origin/RHEL-1.12 commit 33cb78b
7acb38
7acb38
* Fri Feb 10 2017 Lokesh Mandvekar <lsm5@redhat.com> - 2:2.8-2
7acb38
-
7acb38
7acb38
* Tue Feb 07 2017 Lokesh Mandvekar <lsm5@redhat.com> - 2:2.7-1
7acb38
- built origin/RHEL-1.12 commit 21dd37b
7acb38
7acb38
* Fri Jan 20 2017 Lokesh Mandvekar <lsm5@fedoraproject.org> - 2:2.4-2
7acb38
- correct version-release in changelog entries
7acb38
7acb38
* Thu Jan 19 2017 Dan Walsh <dwalsh@fedoraproject.org> - 2:2.4-1
7acb38
- Add typebounds statement for container_t from container_runtime_t
7acb38
- We should only label runc not runc*
7acb38
7acb38
* Tue Jan 17 2017 Dan Walsh <dwalsh@fedoraproject.org> - 2:2.3-1
7acb38
- Fix labeling on /usr/bin/runc.*
7acb38
- Add sandbox_net_domain access to container.te
7acb38
- Remove containers ability to look at /etc content
7acb38
7acb38
* Wed Jan 11 2017 Lokesh Mandvekar <lsm5@fedoraproject.org> - 2:2.2-4
7acb38
- use upstream's RHEL-1.12 branch, commit 56c32da for CentOS 7
7acb38
7acb38
* Tue Jan 10 2017 Jonathan Lebon <jlebon@redhat.com> - 2:2.2-3
7acb38
- properly disable docker module in %%post
7acb38
7acb38
* Sat Jan 07 2017 Lokesh Mandvekar <lsm5@fedoraproject.org> - 2:2.2-2
7acb38
- depend on selinux-policy-targeted
7acb38
- relabel docker-latest* files as well
7acb38
7acb38
* Fri Jan 06 2017 Lokesh Mandvekar <lsm5@fedoraproject.org> - 2:2.2-1
7acb38
- bump to v2.2
7acb38
- additional labeling for ocid
7acb38
7acb38
* Fri Jan 06 2017 Lokesh Mandvekar <lsm5@fedoraproject.org> - 2:2.0-2
7acb38
- install policy at level 200
7acb38
- From: Dan Walsh <dwalsh@redhat.com>
7acb38
7acb38
* Fri Jan 06 2017 Lokesh Mandvekar <lsm5@fedoraproject.org> - 2:2.0-1
7acb38
- Resolves: #1406517 - bump to v2.0 (first upload to Fedora as a
7acb38
standalone package)
7acb38
- include projectatomic/RHEL-1.12 branch commit for building on centos/rhel
7acb38
7acb38
* Mon Dec 19 2016 Lokesh Mandvekar <lsm5@fedoraproject.org> - 2:1.12.4-29
7acb38
- new package (separated from docker)