summaryrefslogtreecommitdiff
path: root/test/podman_run_security.bats
blob: 07dabf44b8e8190bff4bee1131609f3bc7c552d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env bats

load helpers

function teardown() {
    cleanup_test
}

function setup() {
    copy_images
}

@test "run privileged test" {
    cap=$(grep CapEff /proc/self/status | cut -f2 -d":")

    run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run --privileged ${ALPINE}  grep CapEff /proc/self/status
    echo $output
    [ "$status" -eq 0 ]
    containercap=$(echo $output | tr -d '\r'| cut -f2 -d":")
    [ $containercap = $cap ]

    run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run --cap-add all ${ALPINE}  grep CapEff /proc/self/status
    echo $output
    [ "$status" -eq 0 ]
    containercap=$(echo $output | tr -d '\r'| cut -f2 -d":")
    [ $containercap = $cap ]

    cap=$(grep CapAmb /proc/self/status | cut -f2 -d":")
    run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run --cap-drop all ${ALPINE}  grep CapEff /proc/self/status
    echo $output
    [ "$status" -eq 0 ]
    containercap=$(echo $output | tr -d '\r'| cut -f2 -d":")
    [ $containercap = $cap ]
}