apparmor/utils
Steve Beattie 579aa7cb3e utils: add simple parsing of multi-line rules [v3]
D-Bus rules in particular seem to get written as multi-line rules. This
patch adds very simple hackish support for multiple lines. Essentially,
what it does is if the parsing of a line doesn't match anything and
falls all the way through, it saves the line and prepends it to the next
line that occurs in the profile, but *only* if the line does not have a
trailing comma to indicate the end of a rule. If the trailing comma
exists, then it assumes that it's a rule that it doesn't understand and
aborts.

With this patch, the simpler tools (aa-enforce, aa-complain, etc.) can
parse policies containing multi-line rules to an extent and continue to
function correctly. Again, aa-logprof and aa-genprof may have issues on
the writing back of profiles, so some assistance testing here would be
appreciated.

Some testcases are added to exercise the regex that looks for a rule
with a trailing comma but can still handle rules that have (,) or {,}
in them.

Patch history:
  v1 - initial version
  v2 - simplify and rearrange rule-ending comma search regex, since
       we only care about the trailing comma
     - add a new regex to search for trailing comments to filter out
     - simplify reset of lastline variable
     - restructure tests into a new script, and add more tests
  v3 - add additional testcases, most of which are problematic and thus
       commented out :(

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2014-03-07 10:04:57 -08:00
..
apparmor utils: add simple parsing of multi-line rules [v3] 2014-03-07 10:04:57 -08:00
easyprof Add aa-easyprof and easyprof.py and related pieces from the Ubuntu 2014-02-13 17:53:40 -08:00
po Regenerate apparmor-utils pot (translations template) file 2014-02-13 10:59:16 -08:00
test utils: add simple parsing of multi-line rules [v3] 2014-03-07 10:04:57 -08:00
vim utils: remove generated vim manpage on make clean 2014-03-06 10:20:21 -08:00
aa-audit utils: split out aa-audit function 2014-03-06 11:52:00 -08:00
aa-audit.pod Merge in Kshitij Gupta <kgupta8592@gmail.com>'s rewrite of the 2014-02-12 15:54:00 -08:00
aa-autodep utils: split out aa-genprof command 2014-03-06 11:54:38 -08:00
aa-autodep.pod Merge in Kshitij Gupta <kgupta8592@gmail.com>'s rewrite of the 2014-02-12 15:54:00 -08:00
aa-cleanprof utils/aa-*: adjust python shebang lines to ease rewriting to an 2014-02-14 14:42:19 -08:00
aa-cleanprof.pod Merge in Kshitij Gupta <kgupta8592@gmail.com>'s rewrite of the 2014-02-12 15:54:00 -08:00
aa-complain utils: split out aa-complain function 2014-03-06 11:51:00 -08:00
aa-complain.pod utils: split out aa-complain function 2014-03-06 11:51:00 -08:00
aa-decode speed up aa-decode by using a bash regex matching instead of calling egrep for each line. 2013-01-01 20:15:04 +01:00
aa-decode.pod as ACKed on IRC, drop the unused $Id$ tags everywhere 2010-12-20 12:29:10 -08:00
aa-disable utils: remove aa-disable non-functional '-r' option 2014-03-03 13:29:32 -08:00
aa-disable.pod utils: remove aa-enforce '--remove' option 2014-03-03 14:59:47 -08:00
aa-easyprof Add aa-easyprof and easyprof.py and related pieces from the Ubuntu 2014-02-13 17:53:40 -08:00
aa-easyprof.pod Add aa-easyprof and easyprof.py and related pieces from the Ubuntu 2014-02-13 17:53:40 -08:00
aa-enforce utils: split out aa-complain function 2014-03-06 11:51:00 -08:00
aa-enforce.pod utils: split out aa-enforce function 2014-03-06 11:49:43 -08:00
aa-exec remove unneeded perl requires on Time::Local and File::Basename 2013-06-27 12:11:09 -05:00
aa-exec.pod fix broken URLs in various utils/*.pod files. 2013-09-19 21:17:39 +02:00
aa-genprof utils: fix apparmor.ui references in aa-genprof 2014-03-06 10:22:26 -08:00
aa-genprof.pod Merge in Kshitij Gupta <kgupta8592@gmail.com>'s rewrite of the 2014-02-12 15:54:00 -08:00
aa-logprof utils/aa-*: adjust python shebang lines to ease rewriting to an 2014-02-14 14:42:19 -08:00
aa-logprof.pod Merge in Kshitij Gupta <kgupta8592@gmail.com>'s rewrite of the 2014-02-12 15:54:00 -08:00
aa-mergeprof utils/aa-*: adjust python shebang lines to ease rewriting to an 2014-02-14 14:42:19 -08:00
aa-mergeprof.pod Merge in Kshitij Gupta <kgupta8592@gmail.com>'s rewrite of the 2014-02-12 15:54:00 -08:00
aa-notify More helpful error message for "aa-notify -p" if a user is not member of 2011-10-20 00:20:02 +02:00
aa-notify.pod utils/aa-notify.pod: update to clarify '-u' argument when using '-p' 2011-08-17 07:49:00 -05:00
aa-sandbox utils: remove unneeded imports from aa-easyprof and aa-sandbox 2014-01-17 00:09:23 -08:00
aa-sandbox.pod utils/aa-sandbox.pod: note on hotplugging monitors 2012-08-29 08:49:15 -05:00
aa-status utils/aa-*: adjust python shebang lines to ease rewriting to an 2014-02-14 14:42:19 -08:00
aa-status.pod fix broken URLs in various utils/*.pod files. 2013-09-19 21:17:39 +02:00
aa-unconfined Fix module import errors, remove extraneous newlines 2014-02-27 14:53:25 -08:00
aa-unconfined.pod Merge in Kshitij Gupta <kgupta8592@gmail.com>'s rewrite of the 2014-02-12 15:54:00 -08:00
apparmor-utils.spec.in as ACKed on IRC, drop the unused $Id$ tags everywhere 2010-12-20 12:29:10 -08:00
check_po.pl utitlity to look for problems in the po files. 2007-08-15 19:24:49 +00:00
logprof.conf update logprof.conf for UsrMove 2014-02-02 15:12:32 +01:00
logprof.conf.pod fix broken URLs in various utils/*.pod files. 2013-09-19 21:17:39 +02:00
Makefile utils: hook in vim generator sanity test into make check 2014-02-27 16:25:00 -08:00
notify.conf Here is a patch to standardize on all utils using the "aa-" prefix instead 2010-11-03 17:03:52 -07:00
python-tools-setup.py Fix make install to handle new python binaries, as well as informing 2014-02-13 00:04:39 -08:00
README.md Merge in Kshitij Gupta <kgupta8592@gmail.com>'s rewrite of the 2014-02-12 15:54:00 -08:00
severity.db CAP_EPOLLWAKEUP was renamed to CAP_BLOCK_SUSPEND. Update severity.db for that. 2012-08-14 13:46:10 -05:00

Known Bugs: Will allow multiple letters in the () due to translation/unicode issues with regexing the key. User input will probably bug out in a different locale.