2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-31 06:16:03 +00:00

parser: add parser simple tests for mqueue rules

Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
This commit is contained in:
Georgia Garcia
2022-03-21 21:39:21 +00:00
parent d4cbcf2f07
commit 673e8f9d36
23 changed files with 182 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
#
#=DESCRIPTION mqueue invalid label
#=EXRESULT FAIL
#
/usr/bin/foo {
mqueue label=,
}

View File

@@ -0,0 +1,8 @@
#
#=DESCRIPTION mqueue invalid type
#=EXRESULT FAIL
#
/usr/bin/foo {
mqueue type=,
}

View File

@@ -0,0 +1,8 @@
#
#=DESCRIPTION mqueue invalid queuename for type sysv
#=EXRESULT FAIL
#
/usr/bin/foo {
mqueue type=sysv /queuename,
}

View File

@@ -0,0 +1,8 @@
#
#=DESCRIPTION mqueue invalid queuename for type posix
#=EXRESULT FAIL
#
/usr/bin/foo {
mqueue type=posix 1234,
}

View File

@@ -0,0 +1,8 @@
#
#=DESCRIPTION mqueue invalid access name
#=EXRESULT FAIL
#
/usr/bin/foo {
mqueue invalidaccess /queuename,
}

View File

@@ -0,0 +1,8 @@
#
#=DESCRIPTION mqueue invalid type option - posix
#=EXRESULT FAIL
#
/usr/bin/foo {
mqueue type=posixfoo,
}

View File

@@ -0,0 +1,8 @@
#
#=DESCRIPTION mqueue invalid type option - sysv
#=EXRESULT FAIL
#
/usr/bin/foo {
mqueue type=sysvfoo,
}

View File

@@ -0,0 +1,8 @@
#
#=DESCRIPTION mqueue invalid type option
#=EXRESULT FAIL
#
/usr/bin/foo {
mqueue type=foo,
}

View File

@@ -0,0 +1,8 @@
#
#=DESCRIPTION mqueue invalid queuename - does not start with /
#=EXRESULT FAIL
#
/usr/bin/foo {
mqueue foo,
}

View File

@@ -0,0 +1,8 @@
#
#=DESCRIPTION mqueue invalid queuename - not only numbers
#=EXRESULT FAIL
#
/usr/bin/foo {
mqueue 1234foo,
}

View File

@@ -0,0 +1,6 @@
#
#=DESCRIPTION mqueue rule outside of a profile
#=EXRESULT FAIL
#
mqueue,

View File

@@ -0,0 +1,7 @@
#
#=DESCRIPTION mqueue generic rule
#=EXRESULT PASS
#
/usr/bin/foo {
mqueue,
}

View File

@@ -0,0 +1,8 @@
#
#=DESCRIPTION mqueue type option
#=EXRESULT PASS
#
/usr/bin/foo {
mqueue type=posix,
mqueue type=sysv,
}

View File

@@ -0,0 +1,7 @@
#
#=DESCRIPTION mqueue label option
#=EXRESULT PASS
#
/usr/bin/foo {
mqueue label=bar,
}

View File

@@ -0,0 +1,7 @@
#
#=DESCRIPTION mqueue valid sysv queue name
#=EXRESULT PASS
#
/usr/bin/foo {
mqueue 1234,
}

View File

@@ -0,0 +1,7 @@
#
#=DESCRIPTION mqueue valid posix queue name
#=EXRESULT PASS
#
/usr/bin/foo {
mqueue /bar,
}

View File

@@ -0,0 +1,7 @@
#
#=DESCRIPTION mqueue valid sysv queue name with type
#=EXRESULT PASS
#
/usr/bin/foo {
mqueue type=sysv 1234,
}

View File

@@ -0,0 +1,7 @@
#
#=DESCRIPTION mqueue valid posix queue name with type
#=EXRESULT PASS
#
/usr/bin/foo {
mqueue type=posix /bar,
}

View File

@@ -0,0 +1,7 @@
#
#=DESCRIPTION mqueue type and label defined
#=EXRESULT PASS
#
/usr/bin/foo {
mqueue type=posix label=bar,
}

View File

@@ -0,0 +1,7 @@
#
#=DESCRIPTION mqueue type, label and queue name defined
#=EXRESULT PASS
#
/usr/bin/foo {
mqueue type=posix label=bar /baz,
}

View File

@@ -0,0 +1,14 @@
#
#=DESCRIPTION mqueue valid access mode
#=EXRESULT PASS
#
/usr/bin/foo {
mqueue create,
mqueue (create, getattr, setattr),
mqueue (open delete),
mqueue (read write),
mqueue r,
mqueue w,
mqueue rw,
mqueue wr,
}

View File

@@ -0,0 +1,8 @@
#
#=DESCRIPTION mqueue full valid rule
#=EXRESULT PASS
#
/usr/bin/foo {
mqueue (create, write) type=posix label=baz /bar,
mqueue (open, delete) type=sysv label=baz 1234,
}

View File

@@ -0,0 +1,10 @@
#
#=DESCRIPTION mqueue misc rules
#=EXRESULT PASS
#
/usr/bin/foo {
deny mqueue,
audit allow mqueue,
audit deny mqueue,
allow mqueue,
}