Commit graph

1727 commits

Author SHA1 Message Date
Steve Beattie
3186b09035 Merge from trunk revision 1805:
Attached is a patch to make the initscript not fail if /tmp is full
  by converting the comm(1) usage on temporary files to an embedded
  awk script. On both Ubuntu and OpenSUSE, a version of awk (mawk in
  Ubuntu, gawk in OpenSUSE) is either a direct or indirect dependency
  on the minimal or base package set, and the original reporter also
  mentioned that an awk-based solution would be palatable in a way
  that converting to bash, or using perl or python here would not be.

  In the embedded awk script, I've tried to avoid gawk or mawk
  specific behaviors or extensions; e.g. this is the reason for the
  call to sort on the output of the awk script, rather than using
  gawk's asort(). But please let me know if you see anything that
  shouldn't be portable across awk implementations.

  An additional issue that is fixed in both scripts is handling
  child profiles (e.g. hats) during reload. If child profiles are
  filtered out (via grep -v '//') of the list to consider, then
  on reloading a profile where a child profile has been removed or
  renamed, that child profile will continue to stick around. However,
  if the profile containing child profiles is removed entirely,
  if the initscript attempts to unload the child profiles after the
  parent is removed, this will fail because they were unloaded when
  the parent was unloaded.  Thus I removed any filtering of child
  profiles out, but do a post-awk reverse sort which guarantees that
  any child profiles will be removed before their parent is. I also
  added the LC_COLLATE=C (based on the Ubuntu version) to the sort
  call to ensure a consistent sort order.

  To restate, the problem with the existing code is that it creates
  temporary files in $TMPDIR (by default /tmp) and if that partition
  is full, problems with the reload action ensue. Alternate solutions
  include switching the initscript to use bash and its <$() extension
  or setting TMPDIR to /dev/shm/. The former is unpalatable to some
  (particularly for an initscript), and for the latter, /dev/shm is
  only guaranteed to exist on GNU libc based systems (glibc apparently
  expects /dev/shm to exist for its POSIX shared memory implementation;
  see shm_overview(7)).  So to me, awk (sans GNU extensions) looks
  to be the least bad option here.

Nominated-By: Steve Beattie <sbeattie@ubuntu.com>
Acked-By: John Johansen <john.johansen@canonical.com>

Bug: https://launchpad.net/bugs/775785
2011-08-26 16:03:03 -07:00
Steve Beattie
3dfebc380d Merge from trunk rev 1789: logprof and genprof were creating Px and
Cx execute permissions with the modifiers as lowercase (meaning to
pass on sensitive environment variables to the exec'ed process) even
if the user told them not to when prompted. This patch fixes the issue.

Nominated-by: Steve Beattie <steve@nxnw.org>
Acked-by: John Johansen <john.johansen@canonical.com>
2011-08-17 16:28:15 -07:00
Steve Beattie
e35765bed2 Merge from trunk rev 1749: Actually skip loading profiles that we report
we're skipping.

From: Arkadiusz Miskiewicz <arekm@maven.pl>
Acked-By: Steve Beattie <sbeattie@ubuntu.com>
2011-08-04 16:22:10 -07:00
Jamie Strandboge
2b959a80f8 This is bug #815883. The dnsmasq profile needs to be updated for newer
libvirt. Patch is attached. The glob is needed since the lease file's
name is derived from the libvirt network name.
2011-07-27 09:32:35 -05:00
Steve Beattie
6c10463072 Merge from trunk rev 1740: Add
/usr/share/gnome/applications/mimeinfo.cache to gnome abstraction

Nominated-by: Jamie Strandboge <jamie@canonical.com>
Acked-By: Steve Beattie <sbeattie@ubuntu.com>
2011-07-14 13:05:32 -07:00
Steve Beattie
112db48794 Merge from trunk rev 1737: allow owner read access to
/var/run/lightdm/authority/[0-9]* in the X abstraction

Nominated-by: Jamie Strandboge <jamie@canonical.com>
Acked-By: Steve Beattie <sbeattie@ubuntu.com>
2011-07-14 13:02:31 -07:00
John Johansen
7f5505263a Rename tags to remove use of ~
Rename tags
  apparmor_2.6.0~rc1 to apparmor_2.6.0-rc1
  apparmor_2.6.1~rc1 to apparmor_2.6.1-rc1

this is necessary for importing to the git mirror

Signed-off-by: John Johansen <john.johansen@canonical.com>
2011-06-06 03:26:08 -07:00
Steve Beattie
128c40c75f Merge from trunk commit 1721.1.2: This fixes a bug in sprintf use in
a few of the Perl tools, reported by Emanuel Bronshtein in LP: #781961.
																 Signed-off-by: Kees Cook <kees.cook@canonical.com>
Acked-By: Steve Beattie <sbeattie@ubuntu.com>
2011-06-02 20:10:46 -07:00
Steve Beattie
106fa146fe Merge from trunk rev 1733: Bug:
https://bugs.launchpad.net/apparmor/+bug/788616

This patch fixes the init scripts helper functions file to
filter out the hat/child process separator as currently used
by the parser, '//' rather than what used to be used, the '^'
symbol. This fixes bugs where profiles that covered regexs (e.g.
'/usr/lib/firefox-4.0.1/firefox{,*[^s][^h]}') and thus were being
improperly filtered away and unloaded when reloading apparmor policy.

Nominated-By: Steve Beattie <sbeattie@ubuntu.com>
Acked-By: Kees Cook <kees@ubuntu.com>
2011-06-02 20:05:53 -07:00
Steve Beattie
ab63cb9142 Merge from trunk commit rev 1734:This patch adjusts the tag make
target to use a separate version with '~' replaced by '-'. This is
needed for mirroring to git as git can't handle '~'s embedded in tag
or branch names.

Tested by setting up a separate tag_version target like so:

tag_version:
	echo ${TAG_VERSION}

Nominated-By: Steve Beattie <sbeattie@ubuntu.com>
Acked-By: John Johansen <john.johansen@canonical.com>
2011-06-02 20:04:02 -07:00
John Johansen
d99e4232e5 Add 2.6.39 compatibility patches 2011-05-19 12:44:05 -07:00
Steve Beattie
3f3971562f Bah, fix up testcases I screwed up. 2011-03-29 02:47:17 -07:00
Steve Beattie
e8c894721b Merge from trunk rev 1702: The parser's lexer supports
variables defined matching the regex '[[:alpha:]][[:alnum:]_]*'
(i.e. a single alpha followed by any number of alphanumerics or
underscores). Unfortunately, the code that expends variables inside a
profile does not match this, it incorrectly matched '([[:alpha:]]|_)+'
(one or more alphas or underscores). This patch corrects the behavior
there as well as synchronizing the expected variable names in the
apparmor.d manpage and apparmor.vim syntax file.

It also adds unit tests and testcases to verify the behavior.

Nominated-by: Steve Beattie <sbeattie@ubuntu.com>
Acked-By: John Johansen <john.johansen@canonical.com>
2011-03-28 11:00:24 -07:00
Steve Beattie
21a6df5b2c adjust version for 2.6.2 development cycle 2011-03-28 10:56:49 -07:00
Steve Beattie
4158b5e095 Fix up the profiles make install target for the tunables/multiarch.d/
change.
2011-03-23 16:07:55 -07:00
Steve Beattie
3706a9c31a Update version for release 2011-03-23 15:01:51 -07:00
Steve Beattie
6bd242fefc Merge from trunk rev 1700: fix typo in multi-arch comment. 2011-03-23 13:45:41 -07:00
Steve Beattie
2ef723e054 Merge from trunk rev 1699: This patch add multiarch support for common
shared library locations, as well as a tunables file and directory
to ease adding additional multiarch paths.

Bug: https://launchpad.net/bugs/736870
2011-03-23 12:27:16 -07:00
Steve Beattie
e268784406 Merge from trunk rev 1698: Update the toplevel README file to discuss
the needed apparmor compatibility patches, mention the profile
consistency check, and remove some variables that no longer need to
be set at build time.
2011-03-18 23:15:43 -07:00
Steve Beattie
be34a7e217 Merge from trunk rev 1697: disable the local include in the extras
firefox profile; the build process does not generate local files
for things in extras, and even if it did, this one is named in a
non-standard fashion (usr.bin.firefox vs. usr.lib.firefox.firefox).
2011-03-18 23:07:19 -07:00
Steve Beattie
d9832491bd Merge from trunk 1696: profiles/Makefile: fix 'check' target to
iterate over the profiles in the extras directory as intended and
fail the make if a parse failure occurs. Also, set the default parser
and logprof to be the intree ones; the system ones can still be used
by setting environment variables.  Finally, have the 'all' target
generate the local files. Also, set the parser base directory to
the apparmor.d directory (rather than as an added include, to avoid
outside contamination from system profiles and includes).

With these changes, make && make check should verify the profile set
is compilable and mostly consistent. (Alas, the current profiles are
not quite consistent).

Nominated-By: Steve Beattie <sbeattie@ubuntu.com>
Acked-By: John Johansen <john.johansen@canonical.com>
2011-03-18 23:05:38 -07:00
Steve Beattie
2a031e3d71 prep for releasing a 2.6.1 release candidate 2011-03-18 15:56:09 -07:00
Steve Beattie
1ed68f67a9 Merge from trunk rev 1695: This fixes the apparmor apache2 module
to link correctly against the built libapparmor, as well as working
around libtool so that the libapparmor library build directory does
not get added as an rpath to the module.

Nominated-By: Steve Beattie <sbeattie@ubuntu.com>
Acked-By: John Johansen <john.johansen@canonical.com>

Bug: https://launchpad.net/bugs/737074
2011-03-17 23:35:45 -07:00
Steve Beattie
ffcb113465 Merge from trunk rev 1694: reduce the number of network protocols
filtered out of the parser at build time.

Bug: https://launchpad.net/bugs/732837
2011-03-17 11:18:43 -07:00
Steve Beattie
613a449db6 Merge from trunk rev 1693: Fix from PLD/Arkadiusz Miskiewicz
<arekm@maven.pl> to the initscript helper functions to correct some
log messages and to unload hats first, before their parents.

Nominated-by: John Johansen <john.johansen@canonical.com>
Acked-By: Steve Beattie <sbeattie@ubuntu.com>
2011-03-17 10:24:25 -07:00
Steve Beattie
a14d06f8f6 Update repo url after branching 2.6 off of trunk, as well as adjust the
version to indicate that the branch is working towards a 2.6.1 release.
2011-03-10 10:08:24 -08:00
John Johansen
0b383ad769 Add tests to ensure parser is checking its own time stamp wrt profile cache
Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: John Johansen <john.johansen@canonical.com>
2011-03-08 14:52:32 -08:00
John Johansen
55bad42088 apparmor_parser doesn't use its time stamp when determining if cache is stale
If the apparmor_parser is updated (outside of current packaging), when
doing profile loads it will use the existing cache of compiled profiles,
instead of forcing a recompile on profiles.

This can cause apparmor to load bad policy if the parser contains a bug
fix for the previous version of the parser.

This can be worked around in packaging by invalidating the cache and
forcing a profile reload when the parser is upgraded.

Signed-off-by: John Johansen <john.johansen@canonical.com>
2011-03-08 14:49:03 -08:00
John Johansen
258c39d4a5 Profiles that specify a name and attachment specification fail to attach when the
attachment specification doesn't contain globbing.

eg.
   # profile name and attachment the same - attaches as expected
   profile /usr/lib/chromium-browser/chromium-browser

   # profile without attachment specification - does not attach as expected
  profile chromium-browser

  # profile with name and attachment specification where the attachment specification uses globbing - attaches as expected
  profile chromium-browser /usr/lib/chromium-browser/chromium-broswer*

  # profile with name and attachment specification without globbing - FAILS to attach when it should
  profile chromium-browser /usr/lib/chromium-browser/chromium-browser


This occurs because the xmatch_len is not set correctly for the profiles that specify
a name and an attachment specification, where the attachment specification does not
contain globbing characters.

In this situation the correct length for the xmatch_len is the length of the name, as
the shortest possible unambiguous match is the name length.

This patch does not fix a related bug where an attachment specification of ** will not
match (/**) will.
2011-03-08 10:12:09 -08:00
John Johansen
9819bf5df0 Ensure that the buffer read from /proc/sys/kernel/osrelease is null terminated
Signed-off-by: Jamie Strandboge <jamie@canonical.com>
Acked-by: John Johansen <john.johansen@canonical.com>
2011-03-03 15:53:23 -08:00
John Johansen
174c89f772 override AF_MAX for kernels that don't support proper masking
Older versions of the apparmor kernel patches didn't handle receiving
network tables of a larger size than expected.

Allow the parser to detect the kernel version and override the AF_MAX
value for those kernels.

This also replaces the hack using a hardcoded limit of 36 for kernels
missing the features flag.

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Kees Cook <kees.cook@canonical.com>
2011-03-03 15:45:10 -08:00
Steve Beattie
52e14b5c93 merged:
Kees Cook 2011-03-02 update AA url in README
2011-03-02 20:12:27 -08:00
Kees Cook
83ef426514 update AA url in README 2011-03-02 12:19:35 -08:00
Steve Beattie
e14c6c39f1 Make tcp test support current network syntax, reanable tcp test 2011-03-02 05:02:45 -08:00
Steve Beattie
d1789d1469 Merge fix from 2.5 branch to leave timestamps alone when exporting
tarball.
2011-02-24 01:32:08 -08:00
Steve Beattie
2fed7cdb61 Adjust the python setup to actually match what swig expects so it will work 2011-02-23 23:34:36 -08:00
Steve Beattie
cd97402779 Update project info in libapparmor's setup.py.in. 2011-02-23 21:10:20 -08:00
Steve Beattie
ca4906c0a3 Fix list email typo 2011-02-23 15:57:36 -08:00
Steve Beattie
a28e39cd06 Prep for 2.6.0 release 2011-02-23 15:55:03 -08:00
Steve Beattie
3768096308 Fix compilation errors that slipped in. Yes, I realize this breaks the
one translation string that was intended for regexp.y, sorry.
2011-02-23 14:40:07 -08:00
Steve Beattie
3dde3d5322 libraries/libapparmor/: more license cleanups, adjust my email address
in the AUTHORS file.
2011-02-23 14:02:45 -08:00
John Johansen
9df0a29e9e Update the copyright message in apparmor_parser --version 2011-02-22 14:58:49 -08:00
Jamie Strandboge
da1e958eb9 parser/rc.apparmor.functions: Don't unload libvirt's dynamic profiles on
reload. For now just special-case libvirt's profiles. If more applications
use dynamic profiles, this should be generalized in some way to flag profiles
as dynamic. (LP: #702774)
2011-02-22 16:24:29 -06:00
John Johansen
52ca88141a Fix previously committed translation patch that didn't correctly add the
new apparmor-parser.pot file
2011-02-22 11:36:14 -08:00
Jamie Strandboge
4cd73b7a93 parser/rc.apparmor.functions: Don't unload libvirt's dynamic profiles on
reload. For now just special-case libvirt's profiles. If more applications
use dynamic profiles, this should be generalized in some way to flag profiles
as dynamic. (LP: #702774)
2011-02-22 11:29:33 -06:00
Jamie Strandboge
fb188972dc parser/rc.apparmor.functions: Don't unload libvirt's dynamic profiles on
reload. For now just special-case libvirt's profiles. If more applications
 use dynamic profiles, this should be generalized in some way to flag profiles
 as dynamic.
2011-02-22 11:14:34 -06:00
John Johansen
6e6b57fbd1 Sync apparmor.vim to the latest version from Christian Boltz
Signed-off-by: John Johansen <john.johansen@canonical.com>
2011-02-22 03:57:37 -08:00
John Johansen
ee0d5b7d50 Update documentation for change_hatv, change_hat_varags and change_onexec
Signed-off-by: John Johansen <john.johansen@canonical.com>
2011-02-22 03:55:53 -08:00
John Johansen
6d62a3634e Update change_hatv and change_hat_vargs prototypes to use long
Signed-off-by: John Johansen <john.johansen@canonical.com>
2011-02-22 03:55:16 -08:00
John Johansen
54fd453d35 Update swig to export all current interface fns
Signed-off-by: John Johansen <john.johansen@canonical.com>
2011-02-22 03:54:35 -08:00