From ad41e9430257ad96ad302bec64a8e74d5613c999 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Nov 30 2017 19:06:50 +0000 Subject: import container-selinux-2.33-1.git86f33cd.el7 --- diff --git a/.container-selinux.metadata b/.container-selinux.metadata new file mode 100644 index 0000000..e9f60b0 --- /dev/null +++ b/.container-selinux.metadata @@ -0,0 +1 @@ +71846eb29392a82fe433cd9bd6d979b4f1dc52ca SOURCES/container-selinux-86f33cd.tar.gz diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..91c022f --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/container-selinux-86f33cd.tar.gz diff --git a/README.md b/README.md deleted file mode 100644 index 98f42b4..0000000 --- a/README.md +++ /dev/null @@ -1,4 +0,0 @@ -The master branch has no content - -Look at the c7 branch if you are working with CentOS-7, or the c4/c5/c6 branch for CentOS-4, 5 or 6 -If you find this file in a distro specific branch, it means that no content has been checked in yet diff --git a/SPECS/container-selinux.spec b/SPECS/container-selinux.spec new file mode 100644 index 0000000..8d0e15f --- /dev/null +++ b/SPECS/container-selinux.spec @@ -0,0 +1,229 @@ +%global debug_package %{nil} + +# container-selinux +%global git0 https://github.com/projectatomic/%{name} +%global commit0 86f33cdfe059cdb1361ab8468caa90c9f95c4176 +%global shortcommit0 %(c=%{commit0}; echo ${c:0:7}) + +# container-selinux stuff (prefix with ds_ for version/release etc.) +# Some bits borrowed from the openstack-selinux package +%global selinuxtype targeted +%global moduletype services +%global modulenames container + +# Usage: _format var format +# Expand 'modulenames' into various formats as needed +# Format must contain '$x' somewhere to do anything useful +%global _format() export %1=""; for x in %{modulenames}; do %1+=%2; %1+=" "; done; + +# Relabel files +%global relabel_files() %{_sbindir}/restorecon -R %{_bindir}/docker* %{_localstatedir}/run/containerd.sock %{_localstatedir}/run/docker.sock %{_localstatedir}/run/docker.pid %{_sysconfdir}/docker %{_localstatedir}/log/docker %{_localstatedir}/log/lxc %{_localstatedir}/lock/lxc %{_unitdir}/docker.service %{_unitdir}/docker-containerd.service %{_unitdir}/docker-latest.service %{_unitdir}/docker-latest-containerd.service %{_sysconfdir}/docker %{_libexecdir}/docker* /etc/docker &> /dev/null || : + +# Version of SELinux we were using +%global selinux_policyver 3.13.1-39 + +Name: container-selinux +Epoch: 2 +Version: 2.33 +Release: 1.git%{shortcommit0}%{?dist} +License: GPLv2 +URL: %{git0} +Summary: SELinux policies for container runtimes +Source0: %{git0}/archive/%{commit0}/%{name}-%{shortcommit0}.tar.gz +BuildArch: noarch +BuildRequires: git +BuildRequires: pkgconfig(systemd) +BuildRequires: selinux-policy >= %{selinux_policyver} +BuildRequires: selinux-policy-devel >= %{selinux_policyver} +# RE: rhbz#1195804 - ensure min NVR for selinux-policy +Requires: selinux-policy >= %{selinux_policyver} +Requires(post): selinux-policy-base >= %{selinux_policyver} +Requires(post): selinux-policy-targeted >= %{selinux_policyver} +Requires(post): policycoreutils >= 2.5-11 + +%if 0%{?fedora} +Requires(post): policycoreutils-python-utils +%else +Requires(post): policycoreutils-python +%endif +Requires(post): libselinux-utils +Obsoletes: %{name} <= 2:1.12.5-14 +Obsoletes: docker-selinux <= 2:1.12.4-28 +Provides: docker-selinux = %{epoch}:%{version}-%{release} +Provides: docker-engine-selinux = %{epoch}:%{version}-%{release} + +%description +SELinux policy modules for use with container runtimes. + +%prep +%autosetup -Sgit -n %{name}-%{commit0} + +%build +make + +%install +# install policy modules +%_format MODULES $x.pp.bz2 +install -d %{buildroot}%{_datadir}/selinux/packages +install -d -p %{buildroot}%{_datadir}/selinux/devel/include/services +install -p -m 644 %{modulenames}.if %{buildroot}%{_datadir}/selinux/devel/include/services +install -m 0644 $MODULES %{buildroot}%{_datadir}/selinux/packages + +# remove spec file +rm -rf %{name}.spec + +%check + +%post +# Install all modules in a single transaction +if [ $1 -eq 1 ]; then + %{_sbindir}/setsebool -P -N virt_use_nfs=1 virt_sandbox_use_all_caps=1 +fi +%_format MODULES %{_datadir}/selinux/packages/$x.pp.bz2 +%{_sbindir}/semodule -n -s %{selinuxtype} -r container 2> /dev/null +%{_sbindir}/semodule -n -s %{selinuxtype} -d docker 2> /dev/null +%{_sbindir}/semodule -n -s %{selinuxtype} -d gear 2> /dev/null +%{_sbindir}/semodule -n -X 200 -s %{selinuxtype} -i $MODULES > /dev/null +if %{_sbindir}/selinuxenabled ; then + %{_sbindir}/load_policy + %relabel_files + if [ $1 -eq 1 ]; then + restorecon -R %{_sharedstatedir}/docker &> /dev/null || : + fi +fi + +%postun +if [ $1 -eq 0 ]; then +%{_sbindir}/semodule -n -r %{modulenames} docker &> /dev/null || : +if %{_sbindir}/selinuxenabled ; then +%{_sbindir}/load_policy +%relabel_files +fi +fi + +#define license tag if not already defined +%{!?_licensedir:%global license %doc} + +%files +%doc README.md +%{_datadir}/selinux/* + +%changelog +* Wed Nov 8 2017 Dan Walsh - 2.33-1 +- Allow containers to read /etc/resolv.conf and /etc/hosts if volume +- mounted into container. + +* Wed Nov 8 2017 Dan Walsh - 2.32-1 +- Make sure users creating content in /var/lib with right labels + +* Thu Oct 26 2017 Dan Walsh - 2.31-1 +- Allow the container runtime to dbus chat with dnsmasq +- add dontaudit rules for container trying to write to /proc + +* Wed Oct 25 2017 Dan Walsh - 2:2.30-2.git7f2de1a +- Relabel /etc/docker directory + +* Wed Oct 11 2017 Dan Walsh - 2:2.30-1.git7f2de1a +- bump to v2.30 +- Allow containers to create files on tmpfs file systems +- Dontaudit containers attempts to write to /proc + +* Mon Oct 9 2017 Dan Walsh - 2:2.28-1.git85ce147 +- bump to v2.28 + +* Tue Sep 26 2017 Lokesh Mandvekar - 2:2.24-1.gitaeff029 +- bump to v2.24 + +* Tue Aug 08 2017 Lokesh Mandvekar - 2:2.21-2.gitba103ac +- Resolves: #1469792 +- built @origin/RHEL-1.12 commit ba103ac + +* Wed Jul 19 2017 Lokesh Mandvekar - 2:2.21-1 +- Resolves: #1469661 +- bump to v2.21 +- built commit 333854a + +* Mon Jul 10 2017 Lokesh Mandvekar - 2:2.20-2 +- Resolves: #1463549 +- built commit 532fa20 + +* Tue Jul 04 2017 Frantisek Kluknavsky - 2:2.20-1.1 +- rebase + +* Wed Jun 14 2017 Lokesh Mandvekar - 2:2.19-2.1 +- update release tag to isolate from 7.3 + +* Wed Jun 14 2017 Dan Walsh - 2:2.19-1 +- Fix mcs transition problem on stdin/stdout/stderr +- Add labels for CRI-O +- Allow containers to use tunnel sockets + +* Tue Jun 06 2017 Lokesh Mandvekar - 2:2.15-1.1 +- Resolves: #1451289 +- rebase to v2.15 +- built @origin/RHEL-1.12 commit 583ca40 + +* Mon Mar 20 2017 Dan Walsh - 2:2.10-2.1 +- Make sure we have a late enough version of policycoreutils + +* Mon Mar 6 2017 Dan Walsh - 2:2.10-1 +- Update to the latest container-selinux patch from upstream +- Label files under /usr/libexec/lxc as container_runtime_exec_t +- Give container_t access to XFRM sockets +- Allow spc_t to dbus chat with init system +- Allow containers to read cgroup configuration mounted into a container + +* Tue Feb 21 2017 Lokesh Mandvekar - 2:2.9-4 +- Resolves: #1425574 +- built commit 79a6d70 + +* Mon Feb 20 2017 Lokesh Mandvekar - 2:2.9-3 +- Resolves: #1420591 +- built @origin/RHEL-1.12 commit 8f876c4 + +* Mon Feb 13 2017 Lokesh Mandvekar - 2:2.9-2 +- built @origin/RHEL-1.12 commit 33cb78b + +* Fri Feb 10 2017 Lokesh Mandvekar - 2:2.8-2 +- + +* Tue Feb 07 2017 Lokesh Mandvekar - 2:2.7-1 +- built origin/RHEL-1.12 commit 21dd37b + +* Fri Jan 20 2017 Lokesh Mandvekar - 2:2.4-2 +- correct version-release in changelog entries + +* Thu Jan 19 2017 Dan Walsh - 2:2.4-1 +- Add typebounds statement for container_t from container_runtime_t +- We should only label runc not runc* + +* Tue Jan 17 2017 Dan Walsh - 2:2.3-1 +- Fix labeling on /usr/bin/runc.* +- Add sandbox_net_domain access to container.te +- Remove containers ability to look at /etc content + +* Wed Jan 11 2017 Lokesh Mandvekar - 2:2.2-4 +- use upstream's RHEL-1.12 branch, commit 56c32da for CentOS 7 + +* Tue Jan 10 2017 Jonathan Lebon - 2:2.2-3 +- properly disable docker module in %post + +* Sat Jan 07 2017 Lokesh Mandvekar - 2:2.2-2 +- depend on selinux-policy-targeted +- relabel docker-latest* files as well + +* Fri Jan 06 2017 Lokesh Mandvekar - 2:2.2-1 +- bump to v2.2 +- additional labeling for ocid + +* Fri Jan 06 2017 Lokesh Mandvekar - 2:2.0-2 +- install policy at level 200 +- From: Dan Walsh + +* Fri Jan 06 2017 Lokesh Mandvekar - 2:2.0-1 +- Resolves: #1406517 - bump to v2.0 (first upload to Fedora as a +standalone package) +- include projectatomic/RHEL-1.12 branch commit for building on centos/rhel + +* Mon Dec 19 2016 Lokesh Mandvekar - 2:1.12.4-29 +- new package (separated from docker)