Commit graph

211 commits

Author SHA1 Message Date
Steve Beattie
01b7969eee From: Jeff Mahoney <jeffm@suse.com>
Subject: apparmor-utils: Inherit flags in sub-profiles when generating profiles
References: bnc#496204

 When creating profiles with cx subprofiles, genprof will set the
 sub-profile in enforce mode. When genprof cycles multiple times, it
 prohibits the sub-profile from working correctly.

 e.g.

 # Last Modified: Mon Jan 24 13:52:26 2011
 #include <tunables/global>

 /home/jeffm/mycat flags=(complain) {
   #include <abstractions/base>
   #include <abstractions/bash>
   #include <abstractions/consoles>

   /bin/bash ix,
   /bin/cat cx,
   /home/jeffm/mycat r,

 profile /bin/cat {
     #include <abstractions/base>

     /bin/cat r,
     /home/jeffm/mycat r,

   }
 }

 This patch allows sub-profiles to inherit the flags from the parent
 profile, which allows it to be created in complain mode (if appropriate).
 The temporary complain flags are cleaned up at genprof completion as
 expected.

 This issue was reported at: https://bugzilla.novell.com/show_bug.cgi?id=496204

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Acked-By: Steve Beattie <sbeattie@ubuntu.com>

Bug: https://launchpad.net/bugs/707092
2011-02-15 16:24:33 -08:00
Steve Beattie
8db18e6eb7 From: Jeff Mahoney <jeffm@suse.com>
Subject: Subdomain.pm: Fix for null path
References: bnc#407959

When handling the following log entry, logprof will spew perl errors and
ultimately generate an invalid config: "r,"

Since there is nothing to do with a null path, just skip to the next entry.

type=APPARMOR_DENIED msg=audit(1214497030.421:39): operation="inode_permission" info="Failed name resolution - object not a valid entry" requested_mask="r" denied_mask="r" pid=31367 profile="/usr/sbin/httpd2-worker

Acked-By: Steve Beattie <sbeattie@ubuntu.com>
2011-02-15 14:42:10 -08:00
Steve Beattie
5e5d91ba76 From: Jeff Mahoney <jeffm@suse.com>
Subject: apparmor: Subdomain.pm: Fix handling of audits of unconfined processes

 The version of AppArmor that was accepted into the mainline kernel
 issues audit events for things like change_hat while unconfined.
 Previous versions just returned -EPERM without the audit.

 This results in logprof and friends spewing uninitialized value errors
 when it hits events like:
 type=AVC msg=audit(1291742101.899:220): apparmor="DENIED" operation="change_hat" info="unconfined" error=-1 pid=28005 comm="cron

 ... which happen any time an unconfined process does something with pam
 when pam_apparmor is installed.

 This patch skips those events.

[Note that the second half of the OpenSUSE patch had already been applied.]

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Acked-By: Steve Beattie <sbeattie@ubuntu.com>
2011-02-15 11:14:15 -08:00
Steve Beattie
5425aadb6d From: Jeff Mahoney <jeffm@suse.com>
Subject: apparmor-utils: Translation unification
References: bnc#586072

 This patch removes small inconsistencies between identical strings to
 allow for easier translation.

Reported-by: Isis Binder <isis.binder@gmail.com>
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Acked-By: Steve Beattie <sbeattie@ubuntu.com>
2011-02-08 16:19:25 -08:00
Steve Beattie
08df8d93ce Merge from trunk rev 1644: Purge utils/severity.pl due to incorrect
license/copyright statement. It should have been covered under both
the Immunix acquisition by Novell Inc and by the open sourcing of
the apparmor tree by Novell Inc.
2011-02-08 15:56:43 -08:00
Steve Beattie
34c013f036 From: Jeff Mahoney <jeffm@suse.com>
Subject: [PATCH] apparmor-utils: cleanup after abort in genprof
References: bnc#307067

 The initial generation of the base profile is required to be written out
 to put the process in complain mode for observation. If the user
 decides to abort the profiling session, that base profile is left
 behind.

 This patch removes all profiles created during the run up to an abort.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Acked-By: Steve Beattie <sbeattie@ubuntu.com>
2011-02-08 14:49:32 -08:00
Steve Beattie
c1dacca6c7 From: Jeff Mahoney <jeffm@suse.com>
utils/Makefile: abstract out the perl vendor location for distros to
override if necessary

Acked-By: Steve Beattie <sbeattie@ubuntu.com>
2011-02-08 10:35:10 -08:00
Steve Beattie
aa024ec29c From: Jeff Mahoney <jeffm@suse.com>
Fix grammar in in utils UI text.
2011-02-08 10:23:11 -08:00
Steve Beattie
3cb964c5ee Subject: logprof - variable definitions should not have trailing commas.
This patch fixes a logprof bug where when profiles with variable
declarations at the top level (not hidden in an include) were written
back to a file, a trailing comma was being added to the declaration
statement, which is invalid apparmor policy syntax. This patch corrects
this and no longer adds the trailing comma.
2011-02-04 21:16:20 -08:00
Steve Beattie
05450ac38a From: Jeff Mahoney <jeffm@suse.com>
Subject: apparmor: Fix network event parsing
References: bnc#665483

 The upstream version of AppArmor had network mediation but it was
 removed. There's a compability patch floating around that both openSUSE
 and Ubuntu have applied to their kernels. Unfortunately, one part was
 overlooked. The socket operation event names where changed from the
 socket_ prefixed names they had when AppArmor was out-of-tree and
 utils/SubDomain.pm was never updated to understand them.

 This patch adds an operation-type table so that the code can just
 do a optype($operation) call to discover what type of operation a
 particular name refers to. It then uses this in place of the socket_
 checks to decide whether an event is a network operation.

 This allows genprof and logprof to work with networking rules again.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Acked-By: Steve Beattie <sbeattie@ubuntu.com>


Bug: https://launchpad.net/bugs/706733
2011-01-24 15:09:08 -08:00
Steve Beattie
4edf5a5a06 Merge from trunk revision 1582: update the man pages to:
* add Canonical to the headers of the pod files touched
    * use aa_change_hat() instead of change_hat() (LP: #692216)
    * use http://wiki.apparmor.net in the SEE ALSO
    * use http://https://bugs.launchpad.net/apparmor/+filebug for bugs
    * prefix 'aa-' in SEE ALSO section for utilities (eg, 'aa-complain'
      for 'complain')

Nominated-by: Jamie Strandboge <jamie@canonical.com>
Acked-By: Steve Beattie <sbeattie@ubuntu.com>
2011-01-13 16:29:20 -06:00
Steve Beattie
93a49944d4 Support newer auditd formatted messages. Patch from mancha on irc.
Acked-By: Steve Beattie <sbeattie@ubuntu.com>
2011-01-07 13:45:56 -08:00
Steve Beattie
59e4883b63 Merge from trunk rev 1390: utils/SubDomain.pm fix warnings for messages
without denied or requested masks.

Nominated-by: Jesse Michael <jesse@lonelyrhinoceros.com>
Acked-By: Steve Beattie <sbeattie@ubuntu.com>
2010-10-11 11:45:28 -07:00
Steve Beattie
daa141d65f Merge from trunk rev 1475: fixSubDomain.pm to take truncate, rename_src,
rename_dest, and mkdir operations into account, as well as add
logparsing library testcases for those operations.

Bug: https://bugs.launchpad.net/apparmor/+bug/623467
Nominated-by: Steve Beattie <sbeattie@ubuntu.com>
Acked-By: Steve Beattie <sbeattie@ubuntu.com>
2010-09-21 00:40:50 -07:00
Steve Beattie
d41f723645 Merge from trunk rev 1435 (+ creation of empty .err files):
Update log parser grammar to handle new LSM-audit log messages.
Add testcases for new LSM-audit log messages.

Nominated-by: Steve Beattie <sbeattie@ubuntu.com>
Acked-By: Kees Cook <kees@ubuntu.com>
2010-09-10 00:18:39 -07:00
Steve Beattie
cea0cdb4e9 Merge from trunk rev 1485: Fix apparmor_notify memory leak for
non-reported messages.

Nominated-by: John Johansen <john.johansen@canonical.com>
Acked-By: Steve Beattie <sbeattie@ubuntu.com>
2010-09-09 11:28:04 -07:00
Steve Beattie
f12a20dcae Merge of trunk rev 1484: change notify.conf to default to enabling
apparmor_notify.

Nominated-by: John Johansen <john.johansen@canonical.com>
Acked-By: Steve Beattie <sbeattie@ubuntu.com>
2010-09-09 11:25:36 -07:00
Steve Beattie
26624648f8 apparmor_notify merges: r1391-r1396,r1401-r1402,r1405,r1407-r1408:
These commits should bring apparmor_notify and apparmor_notify.pod
up to what is in trunk. In short:
- add long options
- cleanup output
- better handle auditd
- handle logfile rotation
- use seteuid() to drop privileges so we can raise/drop after log
  file rotation. Add -u USER option for dropping privileges when not
  using sudo
- man page updates
- group like entries together when using -v with -s (and later cleanups
  including LP: #582075)
Nominated-by: Jamie Strandboge <jamie@canonical.com>
Acked-By: Steve Beattie <sbeattie@ubuntu.com>
2010-06-21 15:36:21 -07:00
John Johansen
e2737566ff Fix genprof/logprof to handle create (c) and delete (d) permissions that
are being reported by the kernel modules auditing.
2010-03-10 15:30:06 -08:00
Jamie Strandboge
dd3a979827 apparmor_notify: call getopt and check for -h before trying to open audit.log,
so help can be used as non-root when auditd is installed
2010-03-10 10:11:26 -06:00
Jamie Strandboge
75d858a764 apparmor_notify: add -w NUM -- wait NUM seconds before displaying notifications
(with -p)
2010-03-03 11:30:55 -06:00
Jamie Strandboge
e0ca522633 fix pod2man error in apparmor_notify.pod 2010-02-12 10:25:02 -06:00
Jamie Strandboge
a58c1b5119 utils/Makefile: install apparmor_notify
add utils/apparmor_notify.pod
2010-02-12 10:14:11 -06:00
Jamie Strandboge
737cd15707 apparmor_notify: allow -s option with -p 2010-02-04 00:15:24 -08:00
Jamie Strandboge
858d535389 apparmor_notify: simple aggregation on first run 2010-02-03 21:50:05 -08:00
Jamie Strandboge
767bf6d1d7 apparmor_notify: handle being called as apparmor_notify or aa-notify 2010-02-03 20:56:38 -08:00
Jamie Strandboge
29a95e10de rename apparmor-notify to apparmor_notify
update apparmor_notify to read ~/.apparmor/notify.conf
2010-02-01 17:30:04 -08:00
Jamie Strandboge
26499f965b utils/apparmor-notify: adjust copyright to match the rest of the source 2010-01-28 10:58:38 -06:00
Jamie Strandboge
75b07641fd add utils/apparmor-notify and utils/notify.conf, but don't install yet 2010-01-28 10:25:09 -06:00
Jamie Strandboge
e8b3312f2e add aa-decode and manpage
For now just look at 'name=...' which is usually the last in the log entry,
so validate input against this and output based on it.
TODO: better handle other cases too
2010-01-12 07:19:20 -06:00
Kees Cook
938385db40 sort on profile names when reporting results from aa-status 2010-01-02 22:18:51 -08:00
Kees Cook
3c43ce869c have "enforce" command clear out symlink directories, from Ubuntu 2009-11-11 11:38:26 -08:00
Kees Cook
190329745d handle new null profile logs, handle new include directories. from ubuntu branch 2009-11-11 11:37:30 -08:00
Kees Cook
6fa3406b0e update more documentation, update Debian start-up script for LSB, flip logprof repo 2009-11-11 10:51:05 -08:00
Kees Cook
da6c9246f5 clear remaining $Id$ tags, since bzr does not suppor them 2009-11-11 10:44:26 -08: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
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
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
John Johansen
4f2821bce0 Update translation files 2008-11-07 12:02:32 +00:00
Steve Beattie
32696e32bc Things will also be painfully broken if there's a profile for /bin/dash,
which serves as /bin/sh on ubuntu.
2008-11-06 22:48:32 +00:00
Steve Beattie
288aed8886 Fix uninitialized variable warning if /etc/apparmor/repository.conf does
not exist.
2008-11-04 20:37:57 +00:00
John Johansen
f2dec0e337 fix for bnc408846, where network rules are repeatedly prompted for even when
a matching rule is in the profile.
2008-09-10 08:38:44 +00:00
John Johansen
4fb77c6f5d fix 3 bugs currently convered by bnc408877
- flags being dropped from hats
- rules can be poorly split on writing the profile
- identical rules with different permissions are not properly combined, so
  that only permissions of the last rule are kept
2008-09-10 08:36:59 +00:00