Commit graph

2183 commits

Author SHA1 Message Date
Jamie Strandboge
7baf9a4d36 utils/apparmor/sandbox.py: sigh, add another sleep to avoid a race in firefox 2012-12-04 10:15:34 -06:00
Jamie Strandboge
826a84aca1 merge from trunk 2012-12-04 10:12:09 -06:00
Christian Boltz
fab491b44c Add a profile for samba's winbindd.
I added this profile to the openSUSE apparmor-profiles package in Feb 2012. 
Until now I didn't receive any bugreports so I'd say it's complete ;-)

References: https://bugzilla.novell.com/show_bug.cgi?id=748499

Acked-By: jdstrand (on IRC)
2012-11-06 23:19:46 +01:00
Steve Beattie
8e70fdcdfd Subject: aa-decode test script v3
This patch adds a test script/driver for the aa-decode utility. The only
change from the previous versions is to support overriding the location
of the aa-decode to test via the APPARMOR_DECODE environment variable
and documenting the utils/ tests in the top level README.

The aa-decode test can be run directly from the commandline in the utils
directory like so:

  test/test-aa-decode.py -v

Signed-off-by: Steve Beattie <sbeattie@ubuntu.com>
Acked-By: Christian Boltz <apparmor@cboltz.de>
2012-11-05 17:27:20 -08:00
Steve Beattie
8c7c5a6a80 Subject: two fixes to the parser's simple test driver
This patch fixes two issue with the simple test driver. The first is
that child exec that actually ran the parser was located inside the
eval statement. This meant that if the exec failed for some reason
(like the parser didn't exist), the child wouldn't actually die,
but would pop out of the eval and continue running through the loop
of test profiles (while the parent process does the same). This meant
that if the script ran on the full testsuite with a misconfiguration,
it would explode creating O(n^2) processes, where n is the number of
testcase files -- with over 25k testcases, that's a lot. The fis is to
lift the child exec outside the eval{}, then an exec() failure causes
the child process to die correctly.

The second fix is that several of the testcases were added with the
DESCRIPTION field added in lower case (i.e. #=Description blah blah).
This fix makes the regex that pulls out the description not be
case-sensitive.

Signed-off-by: Steve Beattie <sbeattie@ubuntu.com>
Acked-By: John Johansen <john.johansen@canonical.com>
2012-11-05 17:23:53 -08:00
Steve Beattie
4791fb1bc8 Subject: parameterize parser tests to support different binaries
This patch replaces the hardcoded path to the in-tree apparmor parser
in several of the script based test scripts with the APPARMOR_PARSER
environment variable, keeping the hardcoded location as the default.
It also adds support for overriding the location of the parser via the
same environment variable. The make infrastructure is updated to use
this, though uses a different variable (PARSER) to drive it.

Thus 'make check PARSER=/some/path/to/an/alternate/apparmor_parser'
will run all the parser tests on that binary. This is useful for
running the testsuite in an automated post-install environment.
(It should be noted that doing so will still build and run the unit
test binaries based on the source tree.)

Signed-off-by: Steve Beattie <sbeattie@ubuntu.com>
Acked-By: John Johansen <john.johansen@canonical.com>
2012-11-05 17:22:37 -08:00
John Johansen
0e88c3ac70 apparmor: Fix clone test on quantal arm omap-4
It turns out that PAGE_SIZE isn't defined on all architectures.

This fixes a regression test failure happening on Ubuntu quantal
on the arm ti-omap4 architecture.

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-By: Steve Beattie <sbeattie@ubuntu.com>
2012-10-20 01:22:29 -07:00
John Johansen
6fe8e80388 apparmor: add abstractions to support the apparmor api
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Kees Cook <kees@ubuntu.com>
2012-10-20 01:19:22 -07:00
Christian Boltz
50d89bc579 Fix aa-decode handling of stdin
Handling stdin was totally broken (= no output) with the current log 
format because aa-decode expected name= to be the last entry in the 
log line.

This patch for stdin handling
- fixes the pattern to match the current log format (name= is NOT the
  last part in the log entry)
- uses bash replacement to avoid some sed calls (which also means the 
  script now needs an explicit "#!/bin/bash")
- prints decoded filenames in double instead of single quotes to be
  consistent with filenames that were not encoded
- also prints lines that do not contain an encoded filename (instead of 
  grepping them away)
- replace tr calls by perl's uc() (also for non-stdin mode)
- also handle encoded profile names (introduced by Steve)
- don't fail if a file or profile name contains a '

In other words: you can pipe your audit.log through aa-decode, and the 
only difference to the raw audit.log is that filenames are decoded.


Acked-By: Steve Beattie <sbeattie@ubuntu.com>
2012-10-16 00:19:49 +02:00
John Johansen
528d7c463a So the library version has not been being correctly bumped.
Make this a little bit easier to follow

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-By: Steve Beattie <sbeattie@ubuntu.com>
2012-10-12 11:44:11 -07:00
John Johansen
3a9cb05d58 The apparmor coredump regression test was broken.
- It failed to remove coredump files named "core"
- It failed to properly detect "core.<pid>" files
- And it would fail if the coredump_pattern had been modified to
  a different location.

This lead one of the tests to report it was passing when it
wasn't because it was detecting the previous tests core file.
- Fix the test to set the coredump_pattern, to dump into the
  tmpdir used for the test.
- Make it so it will only detect the core file for the pid of
  the last test run.
- And extend the test to have a couple of extra test cases.

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Kees Cook <kees@ubuntu.com>
2012-10-01 11:05:24 -07:00
Christian Boltz
5ae05cc2f4 Install extra profiles in /usr/share/apparmor/extra-profiles/ instead of
/etc/apparmor/profiles/extras/, and update the path at various places.

Also update the mailinglist address in extra-profiles README and 
recommend cp instead of mv.

Note: if you want to have a symlink 
    /etc/apparmor/profiles/extras -> /usr/share/apparmor/extra-profiles/
for backward compability, you'll have to create it yourself (for example
in the .spec file)

This also fixes https://bugzilla.novell.com/show_bug.cgi?id=713647


Acked-by: John Johansen <john.johansen@canonical.com>
2012-09-27 23:57:21 +02:00
Christian Boltz
0742f72f4f fix error handling in aa-decode
Acked-By: Steve Beattie <sbeattie@ubuntu.com>

Looks-Good-By: ;-)  Seth Arnold <seth.arnold@gmail.com>
2012-09-17 23:55:28 +02:00
Jamie Strandboge
a8f5562bde utils/apparmor/sandbox.py: adjust LIBOVERLAY_SCROLLBAR too, since the overlay
scrollbar doesn't track properly
2012-09-03 14:29:05 -05:00
Jamie Strandboge
aa6407d07b utils/apparmor/sandbox.py: only save environment variables that exist 2012-08-29 08:56:06 -05:00
Jamie Strandboge
457d19beaf utils/aa-sandbox.pod: note on hotplugging monitors 2012-08-29 08:49:15 -05:00
Jamie Strandboge
a324724cf3 utils/apparmor/sandbox.py: set QT_X11_NO_NATIVE_MENUBAR=1
utils/aa-sandbox.pod: update KNOWN LIMITATIONS for global menu
2012-08-29 08:43:48 -05:00
Jamie Strandboge
08d91ef714 utils/apparmor/sandbox.py: update title again 2012-08-28 11:56:18 -05:00
Jamie Strandboge
7eeaa74dd9 utils/apparmor/sandbox.py: fix error warning 2012-08-28 08:39:39 -05:00
Jamie Strandboge
0cd5965fcc utils/aa-sandbox.pod:
- clean up LIMITATIONS a bit
- mention lack of cursor support
2012-08-28 08:09:46 -05:00
Jamie Strandboge
06cc33166d utils/aa-sandbox.pod: document limitations 2012-08-28 08:01:15 -05:00
Jamie Strandboge
f2050ec13a utils/aa-sandbox.pod: document --with-clipboard 2012-08-28 07:44:49 -05:00
Jamie Strandboge
c92491621b utils/apparmor/sandbox.py:
- add --with-clipboard for use with xpra
- check for incompatible options
2012-08-28 07:41:23 -05:00
Jamie Strandboge
091bcd72fd adjust title to include the display 2012-08-27 20:13:41 -05:00
Jamie Strandboge
981188e17a utils/apparmor/sandbox.py: use a 3840x2560 server size to reduce memory usage 2012-08-27 17:18:21 -05:00
Jamie Strandboge
72995c5bcb utils/easyprof/templates/sandbox-x: add explicit deny rule to deny
@{HOME}/.Xauthority
utils/apparmor/sandbox.py: verify the above rule is any any dynamic templates
 that use -X
utils/aa-sandbox.pod: update man page to warn about /.Xauthority access
2012-08-27 16:43:20 -05:00
Jamie Strandboge
cb3d73424b utils/apparmor/sandbox.py: add --read-path=x.xauth to opt 2012-08-27 16:16:04 -05:00
Jamie Strandboge
392b5e07c0 various fixes based on feedback from James Troup. 2012-08-27 16:11:01 -05:00
Jamie Strandboge
ea6b1568b4 utils/apparmor/sandbox.py:
- use signal.<signal> instead of hardcoding a number
- add --with-xauthority option
- remove '-r' and '--with-geometry' and use --with-xephyr-geometry instead
- allow passing arguments to the application when using aa-exec
- kill with SIGTERM, then try again with SIGKILL
- always use os.execv() in forks. Using cmd() when not specifying '-d' created
  different behaviors between debug and non-debug mode
- better cleanup Xpra when aa-exec command fails
- use the full dummy.xorg.conf, which gives us the correct modelines for large
  displays. This fixes the issue "Server's virtual screen is too small .... You
  may see strange behavior." which should up when the window's size was bigger
  than the 'current server resolution'
2012-08-27 15:27:30 -05:00
Jamie Strandboge
3ad2820ebd utils/apparmor/sandbox.py:
- cleanup environment handling
- refactor cleanup code
- verify Xsecurity is setup correctly (ie, interpret output of xhost)
- add generation of .Xauthority-sandbox...
- explitly use SECURITY extension
2012-08-27 10:54:26 -05:00
Jamie Strandboge
fd4986e726 manpage updates 2012-08-24 12:16:20 -05:00
Jamie Strandboge
bb58f40ae3 add utils/aa-sandbox.pod 2012-08-24 12:07:19 -05:00
Jamie Strandboge
ec5973a3e6 utils/apparmor/sandbox.py: change 'resolution' to 'geometry' 2012-08-24 12:06:54 -05:00
Jamie Strandboge
72dbf597cc utils/apparmor/sandbox.py: use pkexec if '--with-x' is specified 2012-08-24 11:21:21 -05:00
Jamie Strandboge
c062a8a841 utils/apparmor/sandbox.py:
- fix detection of xdummy driver
- update comments
- add '--no-tray' to 'xpra attach'
2012-08-24 11:09:35 -05:00
Jamie Strandboge
056e642d2b utils/apparmor/sandbox.py: bail if we don't have xdummy 2012-08-24 10:57:28 -05:00
Jamie Strandboge
3fe45e4a9b utils/apparmor/sandbox.py: sleep for 0.5 seconds initially, then poll every
second
2012-08-24 10:52:22 -05:00
Jamie Strandboge
064887dfbd catch exception for x.start() 2012-08-24 10:49:24 -05:00
Jamie Strandboge
a13efcfe0a utils/apparmor/sandbox.py: detect if xpra is running before attach 2012-08-24 10:47:01 -05:00
Jamie Strandboge
cf24f21a77 utils/apparmor/sandbox.py: fix up arg validation for --with-xserver 2012-08-24 10:34:14 -05:00
Jamie Strandboge
5ce539c432 utils/apparmor/sandbox.py:
- add xpra3d server option which uses Xdummy
- update debugging output
2012-08-24 10:21:48 -05:00
Jamie Strandboge
7756e48197 utils/apparmor/sandbox.py:
- add --profile option
- small cleanups
2012-08-23 21:52:52 -05:00
Jamie Strandboge
ed0f41c650 utils/apparmor/sandbox.py:
- whitespace cleanups
- move setting DISPLAY into the start() method
- add extra options to xpra attach
2012-08-23 21:19:37 -05:00
Jamie Strandboge
80a59da4b8 adjust sandbox code:
- for python3
- to add xpra support
- refactoring
- cleanups
2012-08-23 20:49:12 -05:00
Jamie Strandboge
cafd8c9b3e drop globalmenu support for now 2012-08-23 20:47:58 -05:00
Jamie Strandboge
d7b2cb6a50 small cleanups for prettier output 2012-08-23 20:39:19 -05:00
Jamie Strandboge
c0821032fb remove and add some comments 2012-08-23 20:25:29 -05:00
Jamie Strandboge
51256d8fe7 move X server search code into classes 2012-08-23 19:56:18 -05:00
Jamie Strandboge
1fdc3a5e99 utils/apparmor/sandbox.py:
- add --xserver option and support both xephyr and xpra
- refactoring
2012-08-23 19:36:25 -05:00
Jamie Strandboge
7157a62d2b utils/apparmor/sandbox.py: detect next DISPLAY to use 2012-08-23 17:37:31 -05:00