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