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