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