[apparmor] [patch] [1/9] add a named match group to RE_PROFILE_DBUS

Seth Arnold seth.arnold at canonical.com
Fri May 20 23:34:19 UTC 2016


On Sun, Dec 27, 2015 at 04:03:10PM +0100, Christian Boltz wrote:
> Hello,
> 
> as a preparation for the DbusRule class, add a <details> match group
> to RE_PROFILE_DBUS.
> 
> Also adjust test-regex_matches.py for the added group.
> 
> Note: RE_PROFILE_DBUS is only used in aa.py, and only matches[0..2]
> are used. 0 and 1 are audit and allow/deny and 2 is and stays the whole
> rule (except audit and allow/deny). Therefore no aa.py changes are
> needed.
> 
> 
> 
> [ 52-add-match-group-to-RE_PROFILE_DBUS.diff ]

Acked-by: Seth Arnold <seth.arnold at canonical.com>

Thanks

> 
> === modified file ./utils/apparmor/regex.py
> --- utils/apparmor/regex.py     2015-12-12 13:34:40.549997194 +0100
> +++ utils/apparmor/regex.py     2015-12-20 17:22:56.051619606 +0100
> @@ -46,7 +46,7 @@
>  RE_PROFILE_NETWORK      = re.compile(RE_AUDIT_DENY + 'network(?P<details>\s+.*)?' + RE_COMMA_EOL)
>  RE_PROFILE_CHANGE_HAT   = re.compile('^\s*\^(\"??.+?\"??)' + RE_COMMA_EOL)
>  RE_PROFILE_HAT_DEF      = re.compile('^(?P<leadingspace>\s*)(?P<hat_keyword>\^|hat\s+)(?P<hat>\"??.+?\"??)\s+((flags=)?\((?P<flags>.+)\)\s+)*\{' + RE_EOL)
> -RE_PROFILE_DBUS         = re.compile(RE_AUDIT_DENY + '(dbus\s*,|dbus\s+[^#]*\s*,)' + RE_EOL)
> +RE_PROFILE_DBUS         = re.compile(RE_AUDIT_DENY + '(dbus\s*,|dbus(?P<details>\s+[^#]*)\s*,)' + RE_EOL)
>  RE_PROFILE_MOUNT        = re.compile(RE_AUDIT_DENY + '((mount|remount|umount|unmount)(\s+[^#]*)?\s*,)' + RE_EOL)
>  RE_PROFILE_SIGNAL       = re.compile(RE_AUDIT_DENY + '(signal\s*,|signal(?P<details>\s+[^#]*)\s*,)' + RE_EOL)
>  RE_PROFILE_PTRACE       = re.compile(RE_AUDIT_DENY + '(ptrace\s*,|ptrace(?P<details>\s+[^#]*)\s*,)' + RE_EOL)
> === modified file ./utils/test/test-regex_matches.py
> --- utils/test/test-regex_matches.py    2015-12-12 13:34:40.553997166 +0100
> +++ utils/test/test-regex_matches.py    2015-12-20 17:26:03.002435746 +0100
> @@ -259,10 +259,10 @@
>          self.regex = aa.RE_PROFILE_DBUS
>  
>      tests = [
> -        ('   dbus,', (None, None, 'dbus,', None)),
> -        ('   audit dbus,', ('audit', None, 'dbus,', None)),
> -        ('   dbus send member=no_comment,', (None, None, 'dbus send member=no_comment,', None)),
> -        ('   dbus send member=no_comment, # comment', (None, None, 'dbus send member=no_comment,', '# comment')),
> +        ('   dbus,',                                    (None,      None,   'dbus,',                            None,                       None)),
> +        ('   audit dbus,',                              ('audit',   None,   'dbus,',                            None,                       None)),
> +        ('   dbus send member=no_comment,',             (None,      None,   'dbus send member=no_comment,',     'send member=no_comment',   None)),
> +        ('   dbus send member=no_comment, # comment',   (None,      None,   'dbus send member=no_comment,',     'send member=no_comment',   '# comment')),
>  
>          ('   dbusdriver,', False),
>          ('   audit dbusdriver,', False),
> 
> 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20160520/f43908bf/attachment-0001.pgp>


More information about the AppArmor mailing list