2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-30 05:47:59 +00:00

tests: Add negative tests for missing individual AF_UNIX pathname perms

Iterate through the individual client and server AF_UNIX pathname
permissions and remove them, one-by-one, to verify that the test fails.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
This commit is contained in:
Tyler Hicks 2014-09-30 11:34:42 -05:00
parent 84b6f98007
commit 85db44b586

View File

@ -78,6 +78,7 @@ testsocktype()
local testdesc="AF_UNIX pathname socket ($socktype)"
local args="$sockpath $socktype $message $client"
local af_unix
local af_unix_access
removesockets $sockpath $client_sockpath
@ -125,6 +126,17 @@ testsocktype()
genprofile $sockpath:$okserver $client:Ux
runchecktest "$testdesc; confined server w/o af_unix" fail $args
removesockets $sockpath $client_sockpath
# Split the list of AF_UNIX accesses up at the ',' characters
# so that they can be iterated through. Remove each access,
# one-by-one, and verify that the test fails.
for access in ${af_unix_okserver//,/ }; do
# FAIL - server w/ a missing af_unix access
genprofile $sockpath:$okserver "unix:(${af_unix_okserver//$access/})" $client:Ux
runchecktest "$testdesc; confined server w/ a missing af_unix access ($access)" fail $args
removesockets $sockpath $client_sockpath
done
fi
server="$sockpath:$okserver $client_sockpath:$okserver $af_unix $client:px"
@ -167,6 +179,17 @@ testsocktype()
genprofile $server -- image=$client $sockpath:$okclient
runchecktest "$testdesc; confined client w/o af_unix" fail $args
removesockets $sockpath $client_sockpath
# Split the list of AF_UNIX accesses up at the ',' characters
# so that they can be iterated through. Remove each access,
# one-by-one, and verify that the test fails.
for access in ${af_unix_okclient//,/ }; do
# FAIL - client w/ a missing af_unix access
genprofile $server -- image=$client $sockpath:$okclient "unix:(${af_unix_okclient//$access/})"
runchecktest "$testdesc; confined client w/ a missing af_unix access ($access)" fail $args
removesockets $sockpath $client_sockpath
done
fi
removeprofile