a11b8cd8ec
server: fix selinux labels for pod and containers Signed-off-by: Antonio Murdaca <runcom@redhat.com> sandbox: set selinux labels from request, not defaults Signed-off-by: Antonio Murdaca <runcom@redhat.com> container_create: use sandbox's selinux if container's nil Signed-off-by: Antonio Murdaca <runcom@redhat.com> sandbox: correctly init selinux labels First, we weren't correctly initializing selinux labels. If any of (level, user, role, type) was missing from kube selinux options, we were erroring out. This is wrong as kube sends just `level=s0` sometimes and docker itself allows `--security-opt label=level:s0`. This patch directly initializes selinux labels, correctly, and adds a test to verify it. Signed-off-by: Antonio Murdaca <runcom@redhat.com> test: testdata: use container_runtime_t selinux type RHEL SELinux policy doesn't have `container_t` type but we're using it in our fixtures. That means Fedora integration tests pass because `container_t` is in Fedora's container policy but RHEL is broken. Fix it by using `container_runtime_t` which is aliased in Fedora policy to `container_t`. Signed-off-by: Antonio Murdaca <runcom@redhat.com>
70 lines
1.1 KiB
JSON
70 lines
1.1 KiB
JSON
{
|
|
"metadata": {
|
|
"name": "container1",
|
|
"attempt": 1
|
|
},
|
|
"image": {
|
|
"image": "%VALUE%"
|
|
},
|
|
"command": [
|
|
"/bin/ls"
|
|
],
|
|
"args": [],
|
|
"working_dir": "/",
|
|
"envs": [
|
|
{
|
|
"key": "PATH",
|
|
"value": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
|
},
|
|
{
|
|
"key": "TERM",
|
|
"value": "xterm"
|
|
},
|
|
{
|
|
"key": "TESTDIR",
|
|
"value": "test/dir1"
|
|
},
|
|
{
|
|
"key": "TESTFILE",
|
|
"value": "test/file1"
|
|
}
|
|
],
|
|
"labels": {
|
|
"type": "small",
|
|
"batch": "no"
|
|
},
|
|
"annotations": {
|
|
"owner": "dragon",
|
|
"daemon": "crio"
|
|
},
|
|
"privileged": true,
|
|
"readonly_rootfs": true,
|
|
"log_path": "",
|
|
"stdin": false,
|
|
"stdin_once": false,
|
|
"tty": false,
|
|
"linux": {
|
|
"resources": {
|
|
"cpu_period": 10000,
|
|
"cpu_quota": 20000,
|
|
"cpu_shares": 512,
|
|
"oom_score_adj": 30
|
|
},
|
|
"security_context": {
|
|
"capabilities": {
|
|
"add_capabilities": [
|
|
"setuid",
|
|
"setgid"
|
|
],
|
|
"drop_capabilities": [
|
|
]
|
|
},
|
|
"selinux_options": {
|
|
"user": "system_u",
|
|
"role": "system_r",
|
|
"type": "svirt_lxc_net_t",
|
|
"level": "s0:c4,c5"
|
|
}
|
|
}
|
|
}
|
|
}
|