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