File tree Expand file tree Collapse file tree 3 files changed +51
-3
lines changed Expand file tree Collapse file tree 3 files changed +51
-3
lines changed Original file line number Diff line number Diff line change 57
57
mkdir -p -m 0700 /root/.ssh
58
58
vagrant ssh-config >> /root/.ssh/config
59
59
guest_info_script : |
60
- ssh default 'sh -exc "uname -a && systemctl --version && df -T && cat /etc/os-release && go version"'
60
+ ssh default 'sh -exc "uname -a && systemctl --version && df -T && cat /etc/os-release && go version; sestatus; ls -lZ / "'
61
61
check_config_script : |
62
62
ssh default /vagrant/script/check-config.sh
63
63
unit_tests_script : |
79
79
CIRRUS_WORKING_DIR : /home/runc
80
80
GO_VERSION : " 1.20"
81
81
BATS_VERSION : " v1.9.0"
82
- RPMS : gcc git iptables jq glibc-static libseccomp-devel make criu fuse-sshfs
82
+ RPMS : gcc git iptables jq glibc-static libseccomp-devel make criu fuse-sshfs container-selinux
83
83
# yamllint disable rule:key-duplicates
84
84
matrix :
85
85
DISTRO : centos-7
@@ -170,6 +170,10 @@ task:
170
170
# -----
171
171
df -T
172
172
# -----
173
+ sestatus
174
+ # -----
175
+ ls -lZ /
176
+ # -----
173
177
cat /proc/cpuinfo
174
178
check_config_script : |
175
179
/home/runc/script/check-config.sh
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ Vagrant.configure("2") do |config|
23
23
cat << EOF | dnf -y --exclude=kernel,kernel-core shell && break
24
24
config install_weak_deps false
25
25
update
26
- install iptables gcc golang-go make glibc-static libseccomp-devel bats jq git-core criu fuse-sshfs
26
+ install iptables gcc golang-go make glibc-static libseccomp-devel bats jq git-core criu fuse-sshfs container-selinux
27
27
ts run
28
28
EOF
29
29
done
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bats
2
+
3
+ load helpers
4
+
5
+ function setup() {
6
+ requires root # for chcon
7
+ if ! selinuxenabled; then
8
+ skip " requires SELinux enabled and in enforcing mode"
9
+ fi
10
+
11
+ # FIXME this should be done elsewhere!
12
+ chcon -u system_u -r object_r -t container_runtime_exec_t " $( readlink -f " ${INTEGRATION_ROOT} /../../runc" ) "
13
+
14
+ setup_busybox
15
+ if ! chcon -u system_u -r object_r -t container_file_t -R rootfs; then
16
+ skip " chcon failed"
17
+ fi
18
+ }
19
+
20
+ function teardown() {
21
+ teardown_bundle
22
+ grep denied /var/log/audit/audit.log | tail
23
+ }
24
+
25
+ @test " runc run (no selinux label)" {
26
+ update_config ' .process.args = ["/bin/true"]'
27
+ runc run tst
28
+ [ " $status " -eq 0 ]
29
+ }
30
+
31
+ @test " runc run (custom selinux label)" {
32
+ update_config ' .process.selinuxLabel |= "system_u:system_r:container_t:s0:c4,c5"
33
+ | .process.args = ["/bin/true"]'
34
+ runc run tst
35
+ [ " $status " -eq 0 ]
36
+ }
37
+
38
+ @test " runc run (custom selinux label, RUNC_DMZ=legacy)" {
39
+ export RUNC_DMZ=legacy
40
+ update_config ' .process.selinuxLabel |= "system_u:system_r:container_t:s0:c4,c5"
41
+ | .process.args = ["/bin/true"]'
42
+ runc run tst
43
+ [ " $status " -eq 0 ]
44
+ }
You can’t perform that action at this time.
0 commit comments