mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-22 10:07:12 +00:00
Rename requires_features and have_features
Rename require_features to require_kernel_features and have_features to kernel_features to indicate they are tests for kernel features, as now there are tests for parser features and in the future there might be library features as well. Signed-off-by: John Johansen <john.johansen@canonical.com> Acked-by: Tyler Hicks <tyhicks@canonical.com>
This commit is contained in:
parent
119c751951
commit
d7436a872c
@ -97,7 +97,7 @@ for TEST in ${TESTS} ; do
|
||||
|
||||
# no capabilities allowed
|
||||
genprofile ${my_entries}
|
||||
if [ "${TEST}" == "syscall_ptrace" -a "$(have_features ptrace)" == "true" ] ; then
|
||||
if [ "${TEST}" == "syscall_ptrace" -a "$(kernel_features ptrace)" == "true" ] ; then
|
||||
# ptrace between profiles confining tasks of same pid is controlled by the ptrace rule
|
||||
# capability + ptrace rule needed between pids
|
||||
runchecktest "${TEST} -- no caps" pass ${my_arg}
|
||||
@ -113,7 +113,7 @@ for TEST in ${TESTS} ; do
|
||||
for cap in ${CAPABILITIES} ; do
|
||||
if [ "X$(eval echo \${${TEST}_${cap}})" == "XTRUE" ] ; then
|
||||
expected_result=pass
|
||||
elif [ "${TEST}" == "syscall_ptrace" -a "$(have_features ptrace)" == "true" ]; then
|
||||
elif [ "${TEST}" == "syscall_ptrace" -a "$(kernel_features ptrace)" == "true" ]; then
|
||||
expected_result=pass
|
||||
else
|
||||
expected_result=fail
|
||||
@ -126,7 +126,7 @@ for TEST in ${TESTS} ; do
|
||||
# a subprofile.
|
||||
settest ${testwrapper}
|
||||
genprofile hat:$bin/${TEST} addimage:${bin}/${TEST} ${my_entries}
|
||||
if [ "${TEST}" == "syscall_ptrace" -a "$(have_features ptrace)" == "true" ] ; then
|
||||
if [ "${TEST}" == "syscall_ptrace" -a "$(kernel_features ptrace)" == "true" ] ; then
|
||||
# ptrace between profiles confining tasks of same pid is controlled by the ptrace rule
|
||||
# capability + ptrace rule needed between pids
|
||||
runchecktest "${TEST} changehat -- no caps" pass $bin/${TEST} ${my_arg}
|
||||
@ -141,7 +141,7 @@ for TEST in ${TESTS} ; do
|
||||
for cap in ${CAPABILITIES} ; do
|
||||
if [ "X$(eval echo \${${TEST}_${cap}})" == "XTRUE" ] ; then
|
||||
expected_result=pass
|
||||
elif [ "${TEST}" == "syscall_ptrace" -a "$(have_features ptrace)" == "true" ]; then
|
||||
elif [ "${TEST}" == "syscall_ptrace" -a "$(kernel_features ptrace)" == "true" ]; then
|
||||
expected_result=pass
|
||||
else
|
||||
expected_result=fail
|
||||
|
@ -18,7 +18,7 @@ pwd=`cd $pwd ; /bin/pwd`
|
||||
bin=$pwd
|
||||
|
||||
. $bin/prologue.inc
|
||||
requires_features dbus
|
||||
requires_kernel_features dbus
|
||||
requires_parser_support "dbus,"
|
||||
. $bin/dbus.inc
|
||||
|
||||
|
@ -18,7 +18,7 @@ pwd=`cd $pwd ; /bin/pwd`
|
||||
bin=$pwd
|
||||
|
||||
. $bin/prologue.inc
|
||||
requires_features dbus
|
||||
requires_kernel_features dbus
|
||||
requires_parser_support "dbus,"
|
||||
. $bin/dbus.inc
|
||||
|
||||
|
@ -17,7 +17,7 @@ pwd=`cd $pwd ; /bin/pwd`
|
||||
bin=$pwd
|
||||
|
||||
. $bin/prologue.inc
|
||||
requires_features dbus
|
||||
requires_kernel_features dbus
|
||||
requires_parser_support "dbus,"
|
||||
. $bin/dbus.inc
|
||||
|
||||
|
@ -17,7 +17,7 @@ pwd=`cd $pwd ; /bin/pwd`
|
||||
bin=$pwd
|
||||
|
||||
. $bin/prologue.inc
|
||||
requires_features dbus
|
||||
requires_kernel_features dbus
|
||||
requires_parser_support "dbus,"
|
||||
. $bin/dbus.inc
|
||||
|
||||
|
@ -65,7 +65,7 @@ okperm=rwl
|
||||
badperm=wl
|
||||
af_unix=""
|
||||
|
||||
if [ "$(have_features network/af_unix)" == "true" -a "$(parser_supports 'unix,')" == "true" ]; then
|
||||
if [ "$(kernel_features network/af_unix)" == "true" -a "$(parser_supports 'unix,')" == "true" ]; then
|
||||
af_unix="unix:create"
|
||||
fi
|
||||
|
||||
|
@ -102,7 +102,7 @@ runchecktest "UMOUNT (confined no perm)" fail umount ${loop_device} ${mount_poin
|
||||
remove_mnt
|
||||
|
||||
|
||||
if [ "$(have_features mount)" != "true" -o "$(parser_supports 'mount,')" != "true" ] ; then
|
||||
if [ "$(kernel_features mount)" != "true" -o "$(parser_supports 'mount,')" != "true" ] ; then
|
||||
genprofile capability:sys_admin
|
||||
runchecktest "MOUNT (confined cap)" pass mount ${loop_device} ${mount_point}
|
||||
remove_mnt
|
||||
|
@ -38,7 +38,7 @@ badchild=r
|
||||
# Add genprofile params that are common to all hats here
|
||||
common=""
|
||||
|
||||
if [ "$(have_features signal)" == "true" -a "$(parser_supports 'signal,')" == "true" ] ; then
|
||||
if [ "$(kernel_features signal)" == "true" -a "$(parser_supports 'signal,')" == "true" ] ; then
|
||||
# Allow send/receive of all signals
|
||||
common="${common} signal:ALL"
|
||||
fi
|
||||
|
@ -106,7 +106,7 @@ do_test "unconfined, bad context" fail "$put_old" "$new_root" "$bad"
|
||||
genprofile
|
||||
do_test "no perms" fail "$put_old" "$new_root" "$test"
|
||||
|
||||
if [ "$(have_features mount)" != "true" -o "$(parser_supports 'mount,')" != "true" ] ; then
|
||||
if [ "$(kernel_features mount)" != "true" -o "$(parser_supports 'mount,')" != "true" ] ; then
|
||||
# pivot_root mediation isn't supported by this kernel/parser, so verify that
|
||||
# capability sys_admin is sufficient and skip the remaining tests
|
||||
genprofile $cur $cap
|
||||
|
@ -22,7 +22,7 @@
|
||||
# For this file, functions are first, entry point code is at end, see "MAIN"
|
||||
|
||||
#use $() to retreive the failure message or "true" if success
|
||||
have_features()
|
||||
kernel_features()
|
||||
{
|
||||
if [ ! -e "/sys/kernel/security/apparmor/features/" ] ; then
|
||||
echo "Kernel feature masks not supported."
|
||||
@ -40,9 +40,9 @@ have_features()
|
||||
return 0;
|
||||
}
|
||||
|
||||
requires_features()
|
||||
requires_kernel_features()
|
||||
{
|
||||
local res=$(have_features $@)
|
||||
local res=$(kernel_features $@)
|
||||
if [ "$res" != "true" ] ; then
|
||||
echo "$res. Skipping tests ..."
|
||||
exit 0
|
||||
|
@ -52,7 +52,7 @@ runchecktest "test 2 -h prog" pass -h -n 100 $helper /bin/true
|
||||
runchecktest "test 2 -hc prog" pass -h -c -n 100 $helper /bin/true
|
||||
|
||||
|
||||
if [ "$(have_features ptrace)" == "true" -a "$(parser_supports 'ptrace,')" == "true" ] ; then
|
||||
if [ "$(kernel_features ptrace)" == "true" -a "$(parser_supports 'ptrace,')" == "true" ] ; then
|
||||
. $bin/ptrace_v6.inc
|
||||
else
|
||||
. $bin/ptrace_v5.inc
|
||||
|
@ -34,7 +34,7 @@ af_unix_create=""
|
||||
af_unix_create_label=""
|
||||
af_unix_inherit=""
|
||||
|
||||
if [ "$(have_features network/af_unix)" == "true" -a "$(parser_supports 'unix,')" == "true" ]; then
|
||||
if [ "$(kernel_features network/af_unix)" == "true" -a "$(parser_supports 'unix,')" == "true" ]; then
|
||||
# AppArmor requires that the process inheriting the sock file
|
||||
# descriptors have send,receive perms in its profile
|
||||
af_unix_create="unix:(create,getopt)"
|
||||
|
@ -15,7 +15,7 @@ pwd=`cd $pwd ; /bin/pwd`
|
||||
bin=$pwd
|
||||
|
||||
. $bin/prologue.inc
|
||||
requires_features network
|
||||
requires_kernel_features network
|
||||
|
||||
port=34567
|
||||
ip="127.0.0.1"
|
||||
|
@ -27,7 +27,7 @@ okperm=rw
|
||||
badperm=w
|
||||
af_unix=""
|
||||
|
||||
if [ "$(have_features network/af_unix)" == "true" -a "$(parser_supports 'unix,')" == "true" ]; then
|
||||
if [ "$(kernel_features network/af_unix)" == "true" -a "$(parser_supports 'unix,')" == "true" ]; then
|
||||
af_unix="unix:create"
|
||||
fi
|
||||
|
||||
@ -137,7 +137,7 @@ runchecktest "fd passing; confined -> confined (no perm)" fail $file $socket $fd
|
||||
sleep 1
|
||||
rm -f ${socket}
|
||||
|
||||
if [ "$(have_features policy/versions/v6)" == "true" -a "$(parser_supports 'unix,')" == "true" ] ; then
|
||||
if [ "$(kernel_features policy/versions/v6)" == "true" -a "$(parser_supports 'unix,')" == "true" ] ; then
|
||||
# FAIL - confined client, no access to the socket file
|
||||
|
||||
genprofile $file:$okperm $af_unix $socket:rw $fd_client:px -- image=$fd_client $file:$okperm $af_unix
|
||||
|
@ -28,8 +28,8 @@ bin=$pwd
|
||||
|
||||
. $bin/prologue.inc
|
||||
. $bin/unix_socket.inc
|
||||
requires_features policy/versions/v7
|
||||
requires_features network/af_unix
|
||||
requires_kernel_features policy/versions/v7
|
||||
requires_kernel_features network/af_unix
|
||||
requires_parser_support "unix,"
|
||||
|
||||
settest unix_socket
|
||||
|
@ -27,7 +27,7 @@ pwd=`cd $pwd ; /bin/pwd`
|
||||
bin=$pwd
|
||||
|
||||
. $bin/prologue.inc
|
||||
requires_features policy/versions/v6
|
||||
requires_kernel_features policy/versions/v6
|
||||
|
||||
settest unix_socket
|
||||
|
||||
@ -41,7 +41,7 @@ message=4a0c83d87aaa7afa2baab5df3ee4df630f0046d5bfb7a3080c550b721f401b3b\
|
||||
okserver=w
|
||||
badserver1=r
|
||||
badserver2=
|
||||
if [ "$(have_features policy/versions/v7)" == "true" ] ; then
|
||||
if [ "$(kernel_features policy/versions/v7)" == "true" ] ; then
|
||||
okserver=rw
|
||||
badserver2=w
|
||||
fi
|
||||
@ -52,7 +52,7 @@ fi
|
||||
# af_unix support requires 'unix getattr' to call getsockname()
|
||||
af_unix_okserver=
|
||||
af_unix_okclient=
|
||||
if [ "$(have_features network/af_unix)" == "true" -a "$(parser_supports 'unix,')" == "true" ] ; then
|
||||
if [ "$(kernel_features network/af_unix)" == "true" -a "$(parser_supports 'unix,')" == "true" ] ; then
|
||||
af_unix_okserver="create,setopt"
|
||||
af_unix_okclient="create,getopt,setopt,getattr"
|
||||
fi
|
||||
|
@ -28,8 +28,8 @@ bin=$pwd
|
||||
|
||||
. $bin/prologue.inc
|
||||
. $bin/unix_socket.inc
|
||||
requires_features policy/versions/v7
|
||||
requires_features network/af_unix
|
||||
requires_kernel_features policy/versions/v7
|
||||
requires_kernel_features network/af_unix
|
||||
requires_parser_support "unix,"
|
||||
|
||||
settest unix_socket
|
||||
|
Loading…
x
Reference in New Issue
Block a user