Skip to content

Commit

Permalink
[test] add custom selinux rules
Browse files Browse the repository at this point in the history
For containers/container-selinux#274.

Signed-off-by: Kir Kolyshkin <[email protected]>
  • Loading branch information
kolyshkin committed Oct 11, 2023
1 parent 00a2235 commit 7cac73e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
4 changes: 4 additions & 0 deletions contrib/test/ci/build/runc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@
dest: /usr/bin/runc
state: link
force: yes

- name: load custom selinux rules
shell: scripts/mod-selinux.sh
chdir: "{{ ansible_env.GOPATH }}/src/github.com/cri-o/cri-o"
27 changes: 27 additions & 0 deletions scripts/mod-selinux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

set -euxo pipefail

cat <<EOF >local.te
module local 1.0;
require {
type container_runtime_tmpfs_t;
type container_t;
class file { entrypoint execute map read };
}
#============= container_t ==============
allow container_t container_runtime_tmpfs_t:file entrypoint;
allow container_t container_runtime_tmpfs_t:file map;
allow container_t container_runtime_tmpfs_t:file { execute read };
EOF

# Compile the module.
checkmodule -M -m -o local.mod local.te

# Create the package.
semodule_package -o local.pp -m local.mod

# Load the module into the kernel.
sudo semodule -i local.pp

0 comments on commit 7cac73e

Please sign in to comment.