forked from jumanjihouse/docker-duoauthproxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_harden.bats
70 lines (58 loc) · 1.86 KB
/
test_harden.bats
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
@test "There are no suid files" {
suid_count=$(docker run --rm --entrypoint find duoauthproxy -type f -a -perm +4000 | wc -l)
[[ ${suid_count} -eq 0 ]]
}
@test "duo user exists" {
run docker run --rm --entrypoint getent duoauthproxy passwd
[[ ${lines[0]} =~ ^duo ]]
}
@test "duo user is denied interactive login" {
run docker run --rm --entrypoint getent duoauthproxy passwd
[[ ${lines[0]} =~ :/sbin/nologin$ ]]
}
@test "duo is the only user account" {
if [[ -n ${CIRCLECI} ]]; then
skip "This should work on circle but does not"
fi
run docker run --rm --entrypoint getent duoauthproxy passwd
[[ ${#lines[@]} -eq 1 ]]
}
@test "duo is the only user account" {
users=$(docker run --rm --entrypoint getent duoauthproxy passwd | wc -l)
[[ ${users} -eq 1 ]]
}
@test "duo group exists" {
run docker run --rm --entrypoint getent duoauthproxy group
[[ ${lines[0]} =~ ^duo ]]
}
@test "duo is the only group account" {
if [[ -n ${CIRCLECI} ]]; then
skip "This should work on circle but does not"
fi
run docker run --rm --entrypoint getent duoauthproxy group
[[ ${#lines[@]} -eq 1 ]]
}
@test "duo is the only group account" {
groups=$(docker run --rm --entrypoint getent duoauthproxy group | wc -l)
[[ ${groups} -eq 1 ]]
}
@test "bash is available" {
run docker run --rm --entrypoint sh duoauthproxy -c "command -v bash"
[[ ${status} -eq 0 ]]
}
@test "chown is available" {
run docker run --rm --entrypoint chown duoauthproxy --help
[[ ${output} =~ "Usage: chown" ]]
}
@test "chgrp is available" {
run docker run --rm --entrypoint chgrp duoauthproxy --help
[[ ${output} =~ "Usage: chgrp" ]]
}
@test "ln is available" {
run docker run --rm --entrypoint sh duoauthproxy -c "command -v ln"
[[ ${status} -eq 0 ]]
}
@test "chmod is available" {
run docker run --rm --entrypoint sh duoauthproxy -c "command -v chmod"
[[ ${status} -eq 0 ]]
}