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