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