mirror of
https://github.com/roddhjav/apparmor.d.git
synced 2025-01-31 07:17:22 +01:00
test(aa-log): add more tests about the mount rules.
This commit is contained in:
parent
d6dc89b4f3
commit
48b39fa816
2 changed files with 33 additions and 9 deletions
|
@ -64,25 +64,37 @@ var (
|
|||
"operation": "mount",
|
||||
"info": "failed perms check",
|
||||
"error": "-13",
|
||||
"profile": "dockerd",
|
||||
"name": "/var/lib/docker/overlay2/metacopy-check906831159/merged/",
|
||||
"comm": "dockerd",
|
||||
"fstype": "overlay",
|
||||
"srcname": "overlay",
|
||||
"profile": "loupe",
|
||||
"name": "/newroot/dev/tty",
|
||||
"comm": "bwrap",
|
||||
"srcname": "/oldroot/dev/tty",
|
||||
"flags": "rw, rbind",
|
||||
}
|
||||
mount1 = &Mount{
|
||||
Qualifier: Qualifier{Comment: "failed perms check"},
|
||||
MountConditions: MountConditions{FsType: "overlay", Options: []string{}},
|
||||
MountConditions: MountConditions{FsType: "overlay"},
|
||||
Source: "overlay",
|
||||
MountPoint: "/var/lib/docker/overlay2/opaque-bug-check1209538631/merged/",
|
||||
}
|
||||
mount2 = &Mount{
|
||||
Qualifier: Qualifier{Comment: "failed perms check"},
|
||||
MountConditions: MountConditions{FsType: "overlay", Options: []string{}},
|
||||
Source: "overlay",
|
||||
MountPoint: "/var/lib/docker/overlay2/metacopy-check906831159/merged/",
|
||||
MountConditions: MountConditions{Options: []string{"rw", "rbind"}},
|
||||
Source: "/oldroot/dev/tty",
|
||||
MountPoint: "/newroot/dev/tty",
|
||||
}
|
||||
|
||||
// Umount
|
||||
umount1Log = map[string]string{
|
||||
"apparmor": "ALLOWED",
|
||||
"class": "mount",
|
||||
"operation": "umount",
|
||||
"profile": "systemd",
|
||||
"name": "/",
|
||||
"comm": "(ostnamed)",
|
||||
}
|
||||
umount1 = &Umount{MountPoint: "/"}
|
||||
umount2 = &Umount{MountPoint: "/oldroot/"}
|
||||
|
||||
// PivotRoot
|
||||
// pivotroot1LogStr = `apparmor="ALLOWED" operation="pivotroot" class="mount" profile="systemd" name="@{run}/systemd/mount-rootfs/" comm="(ostnamed)" srcname="@{run}/systemd/mount-rootfs/"`
|
||||
pivotroot1Log = map[string]string{
|
||||
|
|
|
@ -34,6 +34,12 @@ func TestRule_FromLog(t *testing.T) {
|
|||
log: mount1Log,
|
||||
want: mount1,
|
||||
},
|
||||
{
|
||||
name: "umount",
|
||||
fromLog: UmountFromLog,
|
||||
log: umount1Log,
|
||||
want: umount1,
|
||||
},
|
||||
{
|
||||
name: "pivotroot",
|
||||
fromLog: PivotRootFromLog,
|
||||
|
@ -153,6 +159,12 @@ func TestRule_Less(t *testing.T) {
|
|||
other: mount2,
|
||||
want: false,
|
||||
},
|
||||
{
|
||||
name: "umount",
|
||||
rule: umount1,
|
||||
other: umount2,
|
||||
want: true,
|
||||
},
|
||||
{
|
||||
name: "pivot_root1",
|
||||
rule: pivotroot2,
|
||||
|
|
Loading…
Reference in a new issue