mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-31 06:16:03 +00:00
Merge branch 'cboltz-logprof-owner' into 'master'
let aa-logprof detect 'owner' events (again) See merge request apparmor/apparmor!34
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
/usr/sbin/cupsd {
|
/usr/sbin/cupsd {
|
||||||
/boot/ r,
|
owner /boot/ r,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/home/ubuntu/bzr/apparmor/tests/regression/apparmor/mkdir {
|
/home/ubuntu/bzr/apparmor/tests/regression/apparmor/mkdir {
|
||||||
/tmp/sdtest.7283-14445-r31VAP/tmpdir/ w,
|
owner /tmp/sdtest.7283-14445-r31VAP/tmpdir/ w,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/home/ubuntu/bzr/apparmor/tests/regression/apparmor/link {
|
/home/ubuntu/bzr/apparmor/tests/regression/apparmor/link {
|
||||||
/tmp/sdtest.19088-12382-HWH57d/linkfile l,
|
owner /tmp/sdtest.19088-12382-HWH57d/linkfile l,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
"/home/steve/tmp/my prog.sh" {
|
"/home/steve/tmp/my prog.sh" {
|
||||||
"/home/steve/tmp/my prog.sh" r,
|
owner "/home/steve/tmp/my prog.sh" r,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
profile "test space" {
|
profile "test space" {
|
||||||
/lib/x86_64-linux-gnu/libdl-2.13.so r,
|
owner /lib/x86_64-linux-gnu/libdl-2.13.so r,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/home/ubuntu/bzr/apparmor/tests/regression/apparmor/link {
|
/home/ubuntu/bzr/apparmor/tests/regression/apparmor/link {
|
||||||
/tmp/sdtest.19088-12382-HWH57d/linkfile l,
|
owner /tmp/sdtest.19088-12382-HWH57d/linkfile l,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/usr/sbin/vsftpd {
|
/usr/sbin/vsftpd {
|
||||||
/home/bane/foo r,
|
owner /home/bane/foo r,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -118,6 +118,10 @@ class ReadLog:
|
|||||||
ev['protocol'] = event.net_protocol
|
ev['protocol'] = event.net_protocol
|
||||||
ev['sock_type'] = event.net_sock_type
|
ev['sock_type'] = event.net_sock_type
|
||||||
|
|
||||||
|
if event.ouid != 18446744073709551615: # 2^64 - 1
|
||||||
|
ev['fsuid'] = event.fsuid
|
||||||
|
ev['ouid'] = event.ouid
|
||||||
|
|
||||||
if ev['operation'] and ev['operation'] == 'signal':
|
if ev['operation'] and ev['operation'] == 'signal':
|
||||||
ev['signal'] = event.signal
|
ev['signal'] = event.signal
|
||||||
ev['peer'] = event.peer
|
ev['peer'] = event.peer
|
||||||
@@ -268,6 +272,13 @@ class ReadLog:
|
|||||||
if not validate_log_mode(hide_log_mode(dmask)):
|
if not validate_log_mode(hide_log_mode(dmask)):
|
||||||
raise AppArmorException(_('Log contains unknown mode %s') % dmask)
|
raise AppArmorException(_('Log contains unknown mode %s') % dmask)
|
||||||
|
|
||||||
|
if e.get('ouid') is not None and e['fsuid'] == e['ouid']:
|
||||||
|
# mark as "owner" event
|
||||||
|
if '::' not in rmask:
|
||||||
|
rmask = '%s::' % rmask
|
||||||
|
if '::' not in dmask:
|
||||||
|
dmask = '%s::' % dmask
|
||||||
|
|
||||||
# convert rmask and dmask to mode arrays
|
# convert rmask and dmask to mode arrays
|
||||||
e['denied_mask'], e['name2'] = log_str_to_mode(e['profile'], dmask, e['name2'])
|
e['denied_mask'], e['name2'] = log_str_to_mode(e['profile'], dmask, e['name2'])
|
||||||
e['request_mask'], e['name2'] = log_str_to_mode(e['profile'], rmask, e['name2'])
|
e['request_mask'], e['name2'] = log_str_to_mode(e['profile'], rmask, e['name2'])
|
||||||
|
@@ -73,11 +73,13 @@ class TestParseEvent(unittest.TestCase):
|
|||||||
'attr': None,
|
'attr': None,
|
||||||
'denied_mask': 'r',
|
'denied_mask': 'r',
|
||||||
'error_code': 13,
|
'error_code': 13,
|
||||||
|
'fsuid': 1002,
|
||||||
'info': 'Failed name lookup - disconnected path',
|
'info': 'Failed name lookup - disconnected path',
|
||||||
'magic_token': 0,
|
'magic_token': 0,
|
||||||
'name': 'var/run/nscd/passwd',
|
'name': 'var/run/nscd/passwd',
|
||||||
'name2': None,
|
'name2': None,
|
||||||
'operation': 'file_mmap',
|
'operation': 'file_mmap',
|
||||||
|
'ouid': 0,
|
||||||
'parent': 0,
|
'parent': 0,
|
||||||
'pid': 25333,
|
'pid': 25333,
|
||||||
'profile': '/sbin/klogd',
|
'profile': '/sbin/klogd',
|
||||||
|
Reference in New Issue
Block a user