d2c883
%global debug_package   %{nil}
d2c883
d2c883
# container-selinux
d2c883
%global git0 https://github.com/projectatomic/%{name}
9c6e2a
%global commit0 b470fa275ac57bfa2a82e3526291881dfcab6e44
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
cd19d8
%global relabel_files() %{_sbindir}/restorecon -R %{_bindir}/*podman* %{_bindir}/*runc* %{_bindir}/*crio %{_bindir}/docker* %{_localstatedir}/run/containerd.sock %{_localstatedir}/run/docker.sock %{_localstatedir}/run/docker.pid %{_sysconfdir}/docker %{_sysconfdir}/crio %{_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* &> /dev/null || :
d2c883
d2c883
# Version of SELinux we were using
cd19d8
%global selinux_policyver 3.13.1-192
d2c883
d2c883
Name: container-selinux
d2c883
Epoch: 2
9c6e2a
Version: 2.68
add9a2
Release: 1%{?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
9c6e2a
Requires(post): sed
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
add9a2
%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
9c6e2a
. %{_sysconfdir}/selinux/config
9c6e2a
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
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
9c6e2a
* Mon Jul 16 2018 Dan Walsh <dwalsh@fedoraproject.org> - 2.68-1
9c6e2a
- Add label for /var/lib/origin
9c6e2a
- Add customizable_file_t to customizable_types
9c6e2a
9c6e2a
* Sun Jul 15 2018 Dan Walsh <dwalsh@fedoraproject.org> - 2.67-1
9c6e2a
- Add policy for container_logreader_t
9c6e2a
cd19d8
* Thu Jun 14 2018 Dan Walsh <dwalsh@fedoraproject.org> - 2.66-1
cd19d8
- Allow dnsmasq to dbus chat with spc_t
cd19d8
cd19d8
* Sun Jun 3 2018 Dan Walsh <dwalsh@fedoraproject.org> - 2.64-1
cd19d8
- Allow containers to create all socket classes
cd19d8
cd19d8
* Thu May 24 2018 Dan Walsh <dwalsh@fedoraproject.org> - 2.62-1
cd19d8
- Label overlay directories under /var/lib/containers/ correctly
cd19d8
cd19d8
* Mon May 21 2018 Dan Walsh <dwalsh@fedoraproject.org> - 2.61-1
cd19d8
- Allow spc_t to load kernel modules from inside of container 
cd19d8
cd19d8
* Mon May 21 2018 Dan Walsh <dwalsh@fedoraproject.org> - 2.60-1
cd19d8
- Allow containers to list cgroup directories
cd19d8
- Transition for unconfined_service_t to container_runtime_t when executing container_runtime_exec_t.
cd19d8
cd19d8
* Mon May 21 2018 Dan Walsh <dwalsh@fedoraproject.org> - 2.58-2
cd19d8
- Run restorecon /usr/bin/podman in postinstall
cd19d8
cd19d8
* Fri May 18 2018 Dan Walsh <dwalsh@fedoraproject.org> - 2.58-1
cd19d8
- Add labels to allow podman to be run from a systemd unit file
cd19d8
cd19d8
* Mon May 7 2018 Dan Walsh <dwalsh@fedoraproject.org> - 2.57-1
cd19d8
- Set the version of SELinux policy required to the latest to fix build issues.
cd19d8
cd19d8
* Wed Apr 11 2018 Dan Walsh <dwalsh@fedoraproject.org> - 2.56-1
cd19d8
- Allow container_runtime_t to transition to spc_t over unlabeled files
cd19d8
add9a2
* Mon Mar 26 2018 Dan Walsh <dwalsh@fedoraproject.org> - 2.55-1
add9a2
    Allow iptables to read container state
add9a2
    Dontaudit attempts from containers to write to /proc/self
add9a2
    Allow spc_t to change attributes on container_runtime_t fifo files
af767f
add9a2
* Thu Mar 8 2018 Dan Walsh <dwalsh@fedoraproject.org> - 2.52-1
add9a2
- Add better support for writing custom selinux policy for customer container domains.
add9a2
add9a2
* Thu Mar 8 2018 Dan Walsh <dwalsh@fedoraproject.org> - 2.51-1
add9a2
- Allow shell_exec_t as a container_runtime_t entrypoint
add9a2
add9a2
* Wed Mar 7 2018 Dan Walsh <dwalsh@fedoraproject.org> - 2.50-1
add9a2
- Allow bin_t as a container_runtime_t entrypoint
add9a2
add9a2
* Fri Mar 2 2018 Dan Walsh <dwalsh@fedoraproject.org> - 2.49-1
add9a2
- Add support for MLS running container runtimes
add9a2
- Add missing allow rules for running systemd in a container
add9a2
add9a2
* Wed Feb 21 2018 Dan Walsh <dwalsh@fedoraproject.org> - 2.48-1
add9a2
- Update policy to match master branch
add9a2
- Remove typebounds and replace with nnp_transition and nosuid_transition calls
add9a2
add9a2
* Tue Jan 9 2018 Dan Walsh <dwalsh@fedoraproject.org> - 2.41-1
add9a2
- Add support to nnp_transition for container domains
add9a2
- Eliminates need for typebounds.
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
add9a2
* Mon Nov 27 2017 Dan Walsh <dwalsh@fedoraproject.org> - 2.36-1
e50124
- Allow containers to relabelto/from all file types to container_file_t
add9a2
add9a2
* Mon Nov 27 2017 Dan Walsh <dwalsh@fedoraproject.org> - 2.35-1
e50124
- Allow container to map chr_files labeled container_file_t
e50124
add9a2
* Wed Nov 22 2017 Dan Walsh <dwalsh@fedoraproject.org> - 2.34-1
add9a2
- Dontaudit container processes getattr on kernel file systems
add9a2
add9a2
* Sun Nov 19 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
add9a2
* Tue Oct 10 2017 Dan Walsh <dwalsh@fedoraproject.org> - 2.29-1
add9a2
- Add support for lxcd
add9a2
- Add support for labeling of tmpfs storage created within a container.
add9a2
add9a2
* Mon Oct 9 2017 Dan Walsh <dwalsh@fedoraproject.org> - 2.28-1
add9a2
- Allow a container to umount a container_file_t filesystem
add9a2
add9a2
* Fri Sep 22 2017 Dan Walsh <dwalsh@fedoraproject.org> - 2.27-1
add9a2
-  Allow container runtimes to work with the netfilter sockets
add9a2
-  Allow container_file_t to be an entrypoint for VM's
add9a2
-  Allow spc_t domains to transition to svirt_t
add9a2
add9a2
* Fri Sep 22 2017 Dan Walsh <dwalsh@fedoraproject.org> - 2.24-1
add9a2
-     Make sure container_runtime_t has all access of container_t
f19cd6
add9a2
* Thu Sep 7 2017 Dan Walsh <dwalsh@fedoraproject.org> - 2.23-1
add9a2
- Allow container runtimes to create sockets in tmp dirs
f19cd6
add9a2
* Tue Sep 5 2017 Dan Walsh <dwalsh@fedoraproject.org> - 2.22-1
add9a2
- Add additonal support for crio labeling.
9607a1
add9a2
* Mon Aug 14 2017 Troy Dawson <tdawson@redhat.com> - 2.21-3
add9a2
- Fixup spec file conditionals
9607a1
add9a2
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2:2.21-2
add9a2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
c9af41
add9a2
* Thu Jul 6 2017 Dan Walsh <dwalsh@fedoraproject.org> - 2.21-1
add9a2
- Allow containers to execmod on container_share_t files.
586051
add9a2
* Thu Jul 6 2017 Dan Walsh <dwalsh@fedoraproject.org> - 2.20-2
add9a2
- Relabel runc and crio executables
586051
add9a2
* Fri Jun 30 2017 Dan Walsh <dwalsh@fedoraproject.org> - 2.20-1
add9a2
- Allow container processes to getsession
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)