Commit graph

1254 commits

Author SHA1 Message Date
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
100d791e84 Update mount test to allow for cability sys_admin, allowing mount and unmount 2009-07-08 21:35:28 +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
b240be37cc Submitted By: Mario Fetka (mario dot fetka at gmail dot com)
Acked-By: Steve Beattie <steve@nxnw.org>

- correct --as-needed linkflag
- use autotools to check for dbus and libaudit-dev properly
2009-05-13 04:20:48 +00:00
Steve Beattie
5d38632153 Submitted By: Mario Fetka (mario dot fetka at gmail dot com)
Acked-By: Steve Beattie <steve@nxnw.org>

Fix a typo in the header.
2009-05-12 22:03:13 +00:00
Steve Beattie
719bfd2011 Fix aclocal warning. 2009-05-12 21:58:54 +00:00
Steve Beattie
c3f9d75abe Submitted By: Mario Fetka (mario dot fetka at gmail dot com)
Acked-By: Steve Beattie <steve@nxnw.org>

This patch allows libapparmor to be built out of tree.
2009-05-12 21:56:56 +00:00
Steve Beattie
b02e3ff0cd Fix up a couple of grotty bits around the debugging code. 2009-03-19 17:36:40 +00:00
Steve Beattie
be5ddfa59b utils/SubDomain.pm:
- Update matching regex for reordered kernel audit messages (when they
  come through syslog). Ideally, rather than use a regex, the utils would
  just use the log parsing library to determine whether it's a log even
  of interest.
- fix debugging code write a logfile in /var/log/apparmor and not a
  predictable location in /tmp; File::Temp would be the right solution
  except that the log file is created in a BEGIN clause, and
  File::Temp.new() ends up returning an unopened filehandle in that
  situation, so logging fails. Someone with more perl-fu may know how to
  fix that.
2009-03-19 15:32:02 +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
19ddb3bfa4 Testcases that are vaguely related to
https://bugs.launchpad.net/bugs/340183
2009-03-13 06:39:05 +00:00
Steve Beattie
0208c5b5d6 whitespace bah. 2009-03-13 06:38:16 +00:00
Steve Beattie
62372fe628 Tentative fix for https://bugs.launchpad.net/bugs/340183 2009-03-13 06:37:39 +00:00
Steve Beattie
a9ff89cd5d Testcase reorg: rename all the ones that pertain to the old logging
style for clarity. Support for these should be dropped in the future,
because it just introduces bugs.
2009-03-13 05:48:06 +00:00
Steve Beattie
1acfd92d8a * set yydebug when YYDEBUG is set, this will cause mucho bison debuginfo
to be emitted.
* whitespace fixup
2009-03-13 05:19:39 +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
01519b3ae0 Fix leak when AppArmor encounters a deleted file 2009-02-15 02:38:53 +00:00
John Johansen
59f0d08417 Update translation files 2009-02-07 12:16:03 +00:00
John Johansen
4fc0bd5881 Update translation files 2009-02-07 12:14:40 +00:00
John Johansen
262075ca80 Update translation files 2009-02-07 12:09:50 +00:00
John Johansen
1def78f1c4 Add missing gettext for "Repository" prompt 2009-02-06 11:09:54 +00:00
John Johansen
9574478aaa Fix compile bug reported by Mario Fetka, 2009-01-04 09:42:46 +00:00
John Johansen
458a6c0418 Apply patch from mario.fetka@gmail.com which fixes the config file for
the module being builtin in 2.6.27, 2.6.28
2008-12-13 10:16:05 +00:00
John Johansen
1910575215 Apply patch from mario.fetka@gmail.com to cleanup AppArmor build under
2.6.27/2.6.28
2008-12-13 10:08:32 +00:00
John Johansen
28ba83a313 Update kernel patches for 2.6.28 2008-12-10 17:57:41 +00:00
John Johansen
9d87470a60 update patch becuase tag is being set else where 2008-12-05 09:41: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
John Johansen
c4a2786ff7 back port applicable patches from 2.6.27 branch 2008-11-28 13:11:22 +00:00
John Johansen
a4c3f33245 Setup base of 2.6.26 version of patches, copied from for mainline r1292 2008-11-28 11:56:09 +00:00
John Johansen
72bdec2f76 Several cleans, that will be merged in for final release
- fix-complain.diff
  Fixes deny rules in complain mode so that they don't reject events

- mount-capability.diff
  Allow confined applications to mount and unmount as long as they
  have capability sys_admin

- fix-config.diff
  Add the missing SECURITY_NETWORK dependency

- fix-security-param.diff
  Make apparmor respect the security= parameter

- securit_default.diff
  Add a new kernel config option to allow setting the default LSM,
  When multiple LSMs are compiled into the kernel this is often
  more desirable than taking the first LSM to register

- fork-tracking.diff
  Newer kernels have changed the allocation of child pid until after
  the security_clone hook.  This breaks AppArmor's fork tracking
  for processes that enter the null-complain-profile.

  To fix this the parent pid is output with every message.  A corresponding
  update in the tools also must be done.

- fix-d_namespace_path.diff
  It is possible that the root.mnt->mnt_ns has been unmounted, resulting
  in an oops.  In this case just test for it, and if it happens the
  ns_root.mnt passed to __d_path will be NULL resulting in a disconnected
  path.

- AppArmor-misc-cleanups.diff
  Some miscelleanous cleanups from Miklos Szeredi, covering some
  kernel coding style and defaults cleanups

- AppArmor-checkpatch.diff
  patch from Miklos Szeredi, to cleanup sparse warnings, and other misc
  coding style errors.
2008-11-28 09:22:54 +00:00
Steve Beattie
e18d431b0e Resurrect a random profile generator for stress testing the parser.
Needs love in the form of enhancements to support regexs, all the added
features in upcoming 2.3 release, etc.

Could also stand a bit of refactoring to make the ruby program not suck
up so much ram by writing out profiles as things go along rather than
generating a bunch of large objects and keeping them around.
2008-11-26 22:16:48 +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
John Johansen
9bf970a4c1 Fix the utils to use the unconfined instead of unconstrained, as the kernel no
longer supports the word unconstrained.
2008-11-21 13:03:52 +00:00
John Johansen
e9e58b9887 Fix bnc#447566, where enforce, complain, and audit tools fail to work
for profiles that use the profile keyword before the profile name.
2008-11-21 13:03:00 +00:00
John Johansen
7fdf8d9925 Fix bnc#430358 where the utils make an invalid profile, by outputting
other rules with no permissions.

Since other rules are not currently supported, remove them.
2008-11-21 12:58:48 +00:00
John Johansen
4c3df3ae53 fix bnc#407491, where a solatary / is not properly handled by the utils
The / is stripped and permission is prompted for a "" path.
2008-11-21 12:57:08 +00:00
John Johansen
39343c8675 Fix fork track (bnc#447564)
Fork tracking is broken by the kernel message for clone no longer supplying
the child pid correctly.  Instead the parent pid will be output with each
message and the tools will fake a fork when they detect a previously
unknow parent child relationship.
2008-11-21 12:55:00 +00:00
John Johansen
77caea2cc7 'unconfined' can appear to mix up process names eg. (/usr/bin/rsync vs.
/usr/bin/rsyncd) bnc#408869

The unconfined tool shows:

[...]
29799 /usr/bin/rsync not confined
29799 /usr/bin/rsync not confined

This is because unconfined is grabbing the post symlink resolved exe filename
which for /usr/sbin/rsyncd is /usr/bin/rsync.

To fix this provide both the cmdline and exec name in parenthesis when the
exe name and the cmdline name differ.

For the above example you would see
29799 /usr/bin/rsync (/usr/sbin/rsyncd) not confined
2008-11-21 12:31:22 +00:00