Commit graph

248 commits

Author SHA1 Message Date
Steve Beattie
298b32e82e Fix up another include test that was failing for the wrong reason. 2009-07-23 20:38:59 +00:00
Steve Beattie
f67f92652a Fix up a couple of testcase includes that got broken in the reorg. 2009-07-23 20:27:54 +00:00
John Johansen
8a780d6f6d Rearrange tests into subdirectories, so that it is easier to see what tests
are currently present.
2009-07-23 07:42:57 +00:00
John Johansen
a03d354ee5 Enable simple.py to traverse subdirectories. This will allow splitting
up the simple_tests/ dir into several subdirs, so they are easier
to manage.
2009-07-22 22:19:23 +00:00
Steve Beattie
a08658b46d Add a couple of testcases around change_profile keyword and different
types of profile names.
2009-07-22 15:43:46 +00:00
John Johansen
3850ede5cf Fix aliases so that aliases are applied to the profile name as well as
the entries

Add rewrite as an alternative alias keyword
2009-06-10 20:26:31 +00:00
Steve Beattie
5a2b875b81 parser/Makefile:
* move network families to filter out into a separate variable to
   so that the list doesn't get lost in a complex sed invocation
 * pull out the actual macro definitions from linux/socket.h and use
   them if glibc's sys/socket.h (really bit/socket.h) hasn't caught up
   with the family definitions.
2009-06-10 19:20:51 +00:00
Steve Beattie
54037862e6 Fix formatting from last commit. 2009-06-10 17:51:09 +00:00
John Johansen
5998357682 Add option to force that read implies exec from user side. 2009-06-10 15:37:27 +00:00
Steve Beattie
b1fab26057 Don't overwrite $STATUS if we've already hit a profile that failed
to parse.
2009-03-19 02:50:53 +00:00
Steve Beattie
947a77bcde Add a case to the interface error reporting for -EACCES return, which
likely means that the admin attempted to load a policy while confined by
apparmor.
2009-03-13 03:44:26 +00:00
Steve Beattie
24ddc6f081 Debugging fixups:
- report applied modes (enforce, complain, audit)
- if local profile, report name of profile it is local to
2009-03-12 19:23:27 +00:00
Steve Beattie
27b8275d5a Add parsing testcases:
- basic local (interior) profile support testcase
- basic deny rules test
2009-03-12 19:22:08 +00:00
Steve Beattie
ff1dc201b1 Fix a bug where passing --Complain on the command line would override an
audit flag set in the profile(s).
2009-03-12 19:19:35 +00:00
Steve Beattie
13f73b626b Mild cruft cleanup (woo!)
- fix "Namespcae" tyop
- get rid of sub_name and default_deny from the main profile struct as
  they haven't been used for a long time; also eliminates their output
  from the debugging output.
- emit dumped parsing structure with only one -d, users were confuzzled
  and it was not documented that you needed to use -dd to get it to
  output anything if DEBUG wasn't set when compiling.
2009-03-12 16:05:19 +00:00
Steve Beattie
087182be9a Blarg, we actually documented --complain as --Complain, which of course
doesn't work. Making the parser match the documentation, though either
form should still work.

(Based on a secondary element of https://bugs.launchpad.net/bugs/341205)
2009-03-12 15:21:46 +00:00
John Johansen
59f0d08417 Update translation files 2009-02-07 12:16:03 +00:00
John Johansen
5148942b90 Fix a missing case in the pcre-expression parsing "\\"
Change the globbing conversion to include [^\x00].  This reduces cases of
artifical overlap between globbing rules, and link rules.  Link rules
are encoded to use a \0 char to seperate the 2 match parts of the rule.

Before this fix a glob * or ** could match against the \0 seperator
resulting the generation of dfa states for that overlap.  This of course
can never happen as \0 is not a valid path name character.

In one example stress policy when adding the rule
  owner /** rwl,
this change made the difference between having a dfa with 55152 states
and one with 30019
2008-12-04 10:44:02 +00:00
John Johansen
037d7b5a57 Clean up the tree simplification code, and make the following improvements
- disable charter, charset merging.  This can actually hamper optimization
  in some cases and needs special cases added to the factoring code.

  The charset code is merged off into its own routines that can be
  reenabled at a later time.

- fix a couple bugs in tree simplifications that would cause earlier
  exit before the tree had even reached a local minima

  I particular the t != c portion of the simplify_tree, would cause
  the loop to exit early if it didn't change but other modifications
  had been made.

- remove the extra epsnode that was getting added to the created tree

- optimize the forward factor alt loop so that it will find all left
  factor matches down the alt subtree without having to loop and recompare
  against nodes that were already checked

These changes result in small improvements in most cases, but in some
policies the changes result in very large wins.  The early bailout of
optimizations was causing 2.5* as many dfa states in one particular
stress test policy.
2008-12-03 03:47:31 +00:00
Steve Beattie
edfa025814 Move preamble inclusions to a different directory since it was breaking
the test on including an entire directory.
Add some basic local profile tests.
2008-11-25 19:05:40 +00:00
Steve Beattie
2e5807b6c4 Add two tests for aliases within include files. 2008-11-24 19:53:36 +00:00
Steve Beattie
1e3e427263 Bleah, the previous code was killing the wrapper sh created by the
open("|")  call, but not the actual apparmor_parser process itself.
2008-11-21 05:00:06 +00:00
Steve Beattie
a64d8142c9 Add a 2 minute (by default, configurable) timeout to each testcase, this
should prevent runaway apparmor_parser processes.
2008-11-20 23:22:43 +00:00
Steve Beattie
e1a2c27cfd Update documentation on how many entries the 3rd stress test generates. 2008-11-20 17:38:38 +00:00
John Johansen
de3ed997a7 Add a test for dfa tree optimization. The test is a profile that could
OOM a machine without dfa tree optimization.
2008-11-20 17:27:32 +00:00
Steve Beattie
a8fea9babc With jjohansen@suse.de's latest optimisation commits, this test case is
now feasible once again.
2008-11-20 17:27:01 +00:00
John Johansen
b017899f12 Fix a bug in tree normalization, where it could get stuck in an infinite loop
when doing Epsnode move, when cating or alting two epsnodes.
2008-11-20 16:19:51 +00:00
John Johansen
0491e8d707 Add char node, and char node set merging. This does not have a substantive
impact on performance but makes tree debugging nicer.
2008-11-20 13:23:13 +00:00
John Johansen
c0533b390b Reintroduce calling back into tree simplification when any modifications have
been made but only from the top level.  This allows us to get the
optimizations that were missed, while not causing the massive recursive call
explosion we had before.
2008-11-20 13:21:23 +00:00
John Johansen
1855fde331 Reduce the use of simplify recursion, repeating the recursion of single
changes is a waste especially as we get to larger subtrees.

Unfortunately this also means that a fair bit of optimization is lost.
2008-11-20 13:18:30 +00:00
John Johansen
91eb71e9fa Improve tree normalization
- reduce the amount it is called, and the amount of recursion it does
- fix a bug that would prevent trees from being fully normalized
2008-11-19 16:54:26 +00:00
John Johansen
77eb67b5a0 Fix problem where named execute transitions were not being applied, for hats
and local profiles.  bnc#446574
2008-11-19 14:00:06 +00:00
Steve Beattie
6cfcb1a823 Submitted By: Mario Fetka (mario dot fetka at gmail dot com)
Description: fix compile on build

Patch from Gentoo community:
  - fix up a couple of missing semicolons in syntax (bison compensates
    by emitting it's own)
  - Fix yet another variable tyop in rc.apparmor.functions
  - dump stderr of ls in rc.apparmor.functions to /dev/null
  - add an install-unknown make target
2008-11-18 17:33:38 +00:00
Steve Beattie
aed481debe Add simple testcase for alias duplicate detection. 2008-11-16 00:49:43 +00:00
Steve Beattie
96e124bf8d Bah, the last commit message was wrong; it added support for mixing
alias rules and variable declarations within the preamble of a profile.

This commit adds another testcase for alias rules; one in which there is
an overlapping pair of aliases. The parser parses it, but based on -dd
output, I don't believe it's treating it properly.
2008-11-14 16:46:16 +00:00
Steve Beattie
cc923edf3c - Add AF_ISDN to filtered list of AF tags
- Restructure filter sed script to be shorter
- Add a make check target which is equiv to make tests
2008-11-14 16:25:44 +00:00
Steve Beattie
6b793b1a8b Add a testcase for the alias handling 2008-11-13 23:48:11 +00:00
Steve Beattie
b07ec7d81b - Add AF_ISDN to filtered list of AF tags
- Restructure filter sed script to be shorter
- Add a make check target which is equiv to make tests
2008-11-13 23:28:38 +00:00
John Johansen
052c58403d fix init script dependency to use $null on stop 2008-11-07 14:11:34 +00:00
John Johansen
5b97455878 Improve dfa generation.
Apply tree factoring and simplification techniques to reduce the number of
states used in computing the dfa.  This can have an exponential impact
on both space and time for dfa generation.
2008-11-07 13:00:05 +00:00
John Johansen
8db35802f9 allow external hats to begin with ^ 2008-11-07 12:54:52 +00:00
John Johansen
6c39288cec fix init script functions so that they don't make use of utilities from
/usr/bin, which will break /usr if they are on a remote filesystem
2008-11-07 12:53:37 +00:00
John Johansen
ecf9412623 Update translation files 2008-11-07 12:01:08 +00:00
John Johansen
7d6b94b4c2 fix case/esac indentation on rc.* 2008-11-07 01:46:03 +00:00
John Johansen
6911dfd7d6 Fix indentation for case/esac on rc.apparmor.suse rc.aaeventd.suse 2008-11-07 01:44:05 +00:00
John Johansen
42c43bb520 fix race condition between boot.apparmor and boot.cleanup bnc#426149 2008-11-07 01:33:57 +00:00
John Johansen
6b6c57887c Reverting previous commit. 2008-11-07 01:31:19 +00:00
John Johansen
1b0dd32cca fix race condition between boot.apparmor and boot.cleanup bnc#426149 2008-11-07 01:19:55 +00:00
John Johansen
fe07cb1e6c fix miss spell word transtion bnc383310 2008-09-12 06:52:39 +00:00
John Johansen
c149ae6097 Finish adding support to allow the parser to loaded dumped profiles
generated using
  apparmor_parser profile -S >binary_profile

can now be loaded using
  apparmor_parser -B binary_profile
2008-09-10 08:44:53 +00:00