Commit graph

2082 commits

Author SHA1 Message Date
Christian Boltz
4d406621ee update apparmor.vim to support "capability," (which allows all
capabilities). The rule will be marked in the "dangerous capability"
color.

Additionally, the patch removes the (already commented out) code for 
"set capability".

Acked-by: Kees Cook <kees@ubuntu.com>
2012-02-15 23:44:39 +01:00
Christian Boltz
e074def743 Add the missing k permission for /etc/.pwd.lock to the userdel profile.
Acked-By: Steve Beattie <sbeattie@ubuntu.com>
2012-02-13 10:50:37 +01:00
Jamie Strandboge
13e959f8c0 Author: Jamie Strandboge <jamie@canonical.com>
Description: glibc's __get_nprocs() now checks /sys/devices/system/cpu/online
 in addition to /proc/stat for the number of processors. This is used in the
 _SC_NPROCESSORS_ONLN implementation, a part of sysconf. This was introduced in
 upstream glibc commit:
 84e2a551a7
Bug-Ubuntu: https://launchpad.net/bugs/929531

Acked-By: Jamie Strandboge <jamie@canonical.com>
Acked-By: Christian Boltz <apparmor@cboltz.de>
2012-02-09 21:06:24 -06:00
Jamie Strandboge
5151168071 abstractions/ubuntu-helpers: use Pixr instead of Pix in case we have an
interpreted file
2012-01-24 09:00:32 -06:00
Christian Boltz
77f37e84eb Update abstractios for KDE4
(At least) openSUSE uses ~/.kde4 to store KDE4 settings.
This patch changes ~/.kde/ to ~/.kde{,4} in all abstractions.

The patch is mostly from Velery Valery, I only fixed a merge conflict 
and added the kmail{,2} part in private-files-strict.

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

Acked-By: Steve Beattie <sbeattie@ubuntu.com> for both trunk and 2.7.
2012-01-19 15:20:28 +01:00
Jamie Strandboge
8e3b75c40a update p11-kit to allow mmap of libraries in pkcs directories
Acked-by: Jamie Strandboge <jamie@canonical.com>
Acked-By: Steve Beattie <sbeattie@ubuntu.com>
2012-01-18 16:22:08 -06:00
Jamie Strandboge
4037c3ae65 Adjust dnsmasq profile for read access to /{,var/}run/nm-dns-dnsmasq.conf
which is needed by NetworkManager integration in Ubuntu. (LP: #917628)

Acked-by: Jamie Strandboge <jamie@canonical.com>
Acked-By: Steve Beattie <sbeattie@ubuntu.com>
2012-01-18 16:20:43 -06:00
Steve Beattie
c817e01774 Bug: https://bugs.launchpad.net/bugs/917859
A bug in Ubuntu reported that the aspell abstraction does
not allow write access to the user customizable dictionaries, the
personal dictionary (~/.aspell.$LANG.pws) and the personal replacement
dictionary (~/.aspell.$LANG.prepl). It also adjusts the abstraction
to add the owner modifier to the personal dictionaries.

Signed-off-by: Steve Beattie <sbeattie@ubuntu.com>
Acked-by: John Johansen <john.johansen@canonical.com>

Bug: https://launchpad.net/bugs/917859
2012-01-18 10:15:57 -08:00
Jamie Strandboge
8d1e8c9c2e ubuntu-browsers.d/plugins-common: include the ubuntu-helpers profile here as
it is needed by pretty much all of the browser abstractions. aa-update-browser
unconditionally adds the plugins-common abstraction, so this should be
sufficient.
2012-01-17 08:22:11 -06:00
Jamie Strandboge
b0ad1303ac update ubuntu-integration abstraction for multiarch with gst-plugin-scanner
(LP: #917641)

Acked-by: Jamie Strandboge <jamie@canonical.com>
2012-01-17 08:00:56 -06:00
Jamie Strandboge
e4e173233c update ubuntu-browsers.d/text-editors to work with emacs2[2-9] 2012-01-17 07:10:33 -06:00
Jamie Strandboge
dd1756ba9e profiles/apparmor.d/abstractions/ubuntu-helpers: add inet6 too 2012-01-13 11:19:55 +01:00
Steve Beattie
cec0d50cfd Regression testsuite: remove a bit more code that's no longer needed
in prologue.inc.

Signed-off-by: Steve Beattie <sbeattie@ubuntu.com>
Acked-by: John Johansen <john.johansen@canonical.com>
2012-01-12 12:37:24 +01:00
Steve Beattie
1ef2d7e757 Regression testsuite: the coredump checkcorefile() function did not
properly quote the _known variable (set when the tests are marked as
expected failures) when the expectation was that the testcase would
produce a corefile. This would result in a failed testcase reporting
XFAIL incorrectly.

Signed-off-by: Steve Beattie <sbeattie@ubuntu.com>
Acked-by: John Johansen <john.johansen@canonical.com>
2012-01-12 12:32:32 +01:00
Steve Beattie
03976a038e Regression testsuite: remove unneeded parsing of permissions on the
suffix of an image= flag, as it's no longer needed. It also eliminates
code that emitted the permissions based on the result of the parse.

Signed-off-by: Steve Beattie <sbeattie@ubuntu.com>
Acked-by: John Johansen@canonical.com
2012-01-12 12:31:25 +01:00
Steve Beattie
83a3de91f8 Regression testsuite: add a flag to mkprofile.pl to not automatically
add 'rix' permissions on executable images (but still auto-generate
ldd dependencies), for use when specifying alternate permissions
on executables.

Where appropriate, it also converts a few testcases to make use of
the option.

Signed-off-by: Steve Beattie <sbeattie@ubuntu.com>
Acked-by: John Johansen <john.johansen@canonical.com>
2012-01-12 12:29:10 +01:00
Steve Beattie
e7cc3e2094 Regression testsuite: add the ability to add multiple binaries to a
generated profile and have the ldd auto-generation of rules occur on
it. It also kills all testcase usage of $dynlibs, which had stopped
being generated by prologue.inc in a prior patch.

Signed-off-by: Steve Beattie <sbeattie@ubuntu.com>
Acked-by: John Johansen <john.johansen@canonical.com>
2012-01-12 12:23:51 +01:00
Steve Beattie
4fa434a3d0 Regression testsuite: move the ldd analysis of binaries to the
mkprofile.pl helper and take the convoluted code out of the bash
prologue.inc. It also detects if the binary is a script and performs
ldd analysis on the interpreter.

Signed-off-by: Steve Beattie <sbeattie@ubuntu.com>
Acked-by: John Johansen <john.johansen@canonical.com>
2012-01-12 12:20:22 +01:00
Steve Beattie
44ca1c0f11 Regression testsuite: rename the emit_ functions to gen_ which reflects
their purpose a little more accurately; renames the dump_flags to
emit_flags for the same reason, and also adds a modicum a function
prototype information to the function declarations.

Signed-off-by: Steve Beattie <sbeattie@ubuntu.com>
Acked-by: John Johansen <john.johansen@canonical.com>
2012-01-12 11:49:32 +01:00
Steve Beattie
a0fbc1f26c Regression testsuite: move the generation of the rules that grant
write access to /proc/*/attr/current to mkprofile.pl from prologue.inc.

Signed-Off-By: Steve Beattie <sbeattie@ubuntu.com>
Acked-by: John Johansen <john.johansen@canonical.com>
2012-01-12 11:39:57 +01:00
John Johansen
62a7934ea6 Disable caching when a namespace is specified
Profile loads when specifying namespaces currently conflict with caching.
If the profile (ignoring the specified namespace) is in the cache, then
the cached profile will be loaded, replacing the profile in the current
namespace instead of loading the profile to the new namespace.

Fix this by disabling caching when a namespace is specified, forcing the
profile to be compiled.

NOTE: this will not affect profiles loaded from within a namespace using
      either the same or a separate directory as the base to load a namespac
      from.  This only affects loading profiles directly into a child
      namespace.

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Kees Cook <kees@ubuntu.com>
2012-01-11 17:26:51 +01:00
John Johansen
5fdf33c689 Add an option to allow setting the cache's location.
Currently the cache location is fixed and links are needed to move it.
Add an option that can be set in the apparmor_parser.conf file so distros
can locate the cache where ever makes sense for them.

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Kees Cook <kees@ubuntu.com>
2012-01-11 17:25:18 +01:00
John Johansen
7031a91aec Disable revalidation/revocation tests
The behavior for revalidation/revocation of open files has changed
with the current kernel code, resulting in these tests being reported
as failing even though they are showing expected behavior.

Under the current kernel module this form of revalidation/revocation
can not be tested reliably, so just changing the expected result is
not enough, completely disable the tests for now.

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-By: Steve Beattie <sbeattie@ubuntu.com>
2012-01-11 16:50:34 +01:00
Jamie Strandboge
39a3f5b08d Add profiles/apparmor.d/abstractions/ubuntu-helpers:
Lenient profile that is intended to be used when 'Ux' is desired but
does not provide enough environment sanitizing. This effectively is an
open profile that blacklists certain known dangerous files and also
does not allow any capabilities. For example, it will not allow 'm' on files
owned be the user invoking the program. While this provides some additional
protection, please use with care as applications running under this profile
are effectively running without any AppArmor protection. Use this profile
only if the process absolutely must be run (effectively) unconfined.

Limitations:
1. This does not work for root owned processes, because of the way we use
   owner matching in the sanitized helper. We could do a better job with
   this to support root, but it would make the policy harder to understand
   and going unconfined as root is not desirable anyway.

2. For this sanitized_helper to work, the program running in the sanitized
   environment must open symlinks directly in order for AppArmor to mediate
   it. This is confirmed to work with:
    - compiled code which can load shared libraries
    - python imports
   It is known not to work with:
    - perl includes

3. Going forward it might be useful to try sanitizing ruby and java

Use at your own risk. This profile was developed as an interim workaround for
LP: #851986 until AppArmor implements proper environment filtering.

Acked-by: Jamie Strandboge <jamie@canonical.com>



Adjust ubuntu abstractions to use sanitized_helper instead of (P)Ux.

Acked-by: Jamie Strandboge <jamie@canonical.com>



Update launchpad-integration to use a sanitized helper in a similar manner
as that in ubuntu-helpers.

Acked-by: Jamie Strandboge <jamie@canonical.com>
2012-01-11 15:20:42 +01:00
Jamie Strandboge
7eee94290b add xdg-desktop abstraction to gnome and kde. Acked via discussions 2012-01-11 14:17:32 +01:00
Jamie Strandboge
45e7265c82 Create an xdg-desktop abstraction based on the upstream documentation for
creating owner writes on things like ~/.cache and ~/.config

Acked-by: Jamie Strandboge <jamie@canonical.com>
Acked-By: Steve Beattie <sbeattie@ubuntu.com>
2012-01-11 13:00:34 +01:00
Jamie Strandboge
3c2684b674 merge from trunk 2012-01-11 09:48:22 +01:00
Jamie Strandboge
b1a8e7cf44 fix up comments in launchpad-integration 2012-01-11 09:27:22 +01:00
Jamie Strandboge
7887d5906d don't #include ubuntu-helpers in the abstractions. This can only be included
once in policy, otherwise you will get an error regarding multiple definitions
for sanitized_helper
2012-01-11 09:00:35 +01:00
Jamie Strandboge
b0ef4d2b6a add note to ubuntu-helpers regarding needing to only include it once 2012-01-11 08:50:47 +01:00
Jamie Strandboge
c626e62da6 fix missing '}' in ubuntu-helpers 2012-01-11 08:48:07 +01:00
Jamie Strandboge
b93c49974c update ubuntu-browsers to also Cx the firefox.sh in /usr/lib 2012-01-11 00:59:38 +01:00
Jamie Strandboge
d045d609be update launchpad-integration to use a sanitized helper 2012-01-10 20:54:57 +01:00
Jamie Strandboge
333cd41d33 update ubuntu abstractions to use the sanitized helper 2012-01-10 20:54:38 +01:00
Jamie Strandboge
2526933747 ubuntu-helpers: account for lib32 and lib64 2012-01-10 19:57:58 +01:00
Christian Boltz
a33c5822a9 when using smbldap-useradd using this smb.conf entry
add machine script = /usr/sbin/smbldap-useradd -t 5 -w "%u"
smbd obviously needs x permissions for smbldap-useradd.

The commit also adds a new profile for usr.sbin.smbldap-useradd (based on 
the audit.log from Alexis Pellicier).

Additionally, I moved the "/etc/samba/* rwk" rule next to the other 
/etc-related rules in the smbd profile.

References: https://bugzilla.novell.com/show_bug.cgi?id=738041
2012-01-10 19:06:24 +01:00
Jamie Strandboge
d6c4f56da8 add profiles/apparmor.d/abstractions/ubuntu-helpers:
Lenient profile that is intended to be used when 'Ux' is desired but
does not provide enough environment sanitizing. This effectively is an
open profile that blacklists certain known dangerous files and also
does not allow any capabilities. For example, it will not allow 'm' on files
owned be the user invoking the program. While this provides some additional
protection, please use with care as applications running under this profile
are effectively running without any AppArmor protection. Use this profile
only if the process absolutely must be run (effectively) unconfined.

Limitations:
1. This does not work for root owned processes, because of the way we use
   owner matching in the sanitized helper. We could do a better job with
   this to support root, but it would make the policy harder to understand
   and going unconfined as root is not desirable any way.

2. For this sanitized_helper to work, the program running in the sanitized
   environment must open symlinks directly in order for AppArmor to mediate
   it. This is confirmed to work with:
    - compiled code which can load shared libraries
    - python imports
   It is known not to work with:
    - perl includes

3. Going forward it might be useful to try sanitizing ruby and java

Use at your own risk. This profile was developed as an interim workaround for
LP: #851986 until AppArmor implements proper environment filtering.
2012-01-10 18:36:14 +01:00
Steve Beattie
25f800ac7d Fix from Felix Geyer: block write access to ~/.kde/env because KDE
automatically sources scripts in that folder on startup.

Bug: https://launchpad.net/bugs/914190
2012-01-10 11:54:12 +01:00
Steve Beattie
ad0f942bb5 Fix from Felix Geyer: in the enchant abstraction, allow the creation of
enchant .config directory.

Bug: https://launchpad.net/bugs/914184
2012-01-10 11:37:54 +01:00
Steve Beattie
1ff5a08f60 utils/Immunix/AppArmor.pm: fixes the profile autogeneration code to
include read access to the script itself for interpreted scripts.
2012-01-09 17:42:55 +01:00
Steve Beattie
8a223ce3d5 utils/Immunix/AppArmor.pm: update the initial profile generation
for python and ruby scripts to include the respective abstractions.
2012-01-09 17:39:31 +01:00
Christian Boltz
2f85e0b7d2 according to Peter Czanik, the openSUSE syslog-ng maintainer, syslog-ng
needs capability dac_read_search.

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

ACKed-by: Steve Beattie <steve@nxnw.org>
2012-01-09 13:28:25 +01:00
Jamie Strandboge
6d55882b4a add p11-kit abstraction (LP: #912754, LP: #912752)
From the README in the toplevel source:
"[P11-KIT] Provides a way to load and enumerate PKCS#11 modules. Provides a
standard configuration setup for installing PKCS#11 modules in such a way that
they're discoverable."

File locatations are described in [1]. There is a global configuration file in
/etc/pkcs11/pkcs11.conf. Per module configuration happens in
/etc/pkcs11/<module name>. There is also user configuration in ~/.pkcs11, but
IMO this should not be allowed in the abstraction. Example configuration can be
seen in the upstream documentation[2].

This will likely need to be refined as more applications use p11-kit.

[1]http://p11-glue.freedesktop.org/doc/p11-kit/config-locations.html
[2]http://p11-glue.freedesktop.org/doc/p11-kit/config-example.html

Acked-by: Jamie Strandboge <jamie@canonical.com>
Acked-By: Steve Beattie <sbeattie@ubuntu.com>


Also add p11-kit to authentication abstraction

Acked-by: Jamie Strandboge <jamie@canonical.com>
Acked-By: Steve Beattie <sbeattie@ubuntu.com>
2012-01-06 17:01:39 -06:00
Jamie Strandboge
c5ccbb50d2 add p11-kit to authentication abstraction
Acked-by: Jamie Strandboge <jamie@canonical.com>
2012-01-06 11:46:52 -06:00
Jamie Strandboge
572bab7e84 add p11-kit abstraction (LP: #912754, LP: #912752)
From the README in the toplevel source:
"[P11-KIT] Provides a way to load and enumerate PKCS#11 modules. Provides a
standard configuration setup for installing PKCS#11 modules in such a way that
they're discoverable."

File locatations are described in [1]. There is a global configuration file in
/etc/pkcs11/pkcs11.conf. Per module configuration happens in
/etc/pkcs11/<module name>. There is also user configuration in ~/.pkcs11, but
IMO this should not be allowed in the abstraction. Example configuration can be
seen in the upstream documentation[2].

This will likely need to be refined as more applications use p11-kit.

[1]http://p11-glue.freedesktop.org/doc/p11-kit/config-locations.html
[2]http://p11-glue.freedesktop.org/doc/p11-kit/config-example.html

Acked-by: Jamie Strandboge <jamie@canonical.com>
2012-01-06 11:45:44 -06:00
John Johansen
f561b8cdfe Make hfa::match not need to walk a string twice
Currently hfa::match calls hfa::match_len to do matching.  However this
requires walking the input string twice.  Instead provide a match routine
for input that is supposed to terminate at a given input character.

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-By: Steve Beattie <sbeattie@ubuntu.com>
2012-01-06 09:04:36 -08:00
John Johansen
3ff8b4d19a Add basic string matching to the hfa
Add the ability to match strings directly from the hfa instead of needing
to build a cfha.

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-By: Steve Beattie <sbeattie@ubuntu.com>
2012-01-06 09:03:20 -08:00
Jamie Strandboge
47280bb483 Description: allow read of @{HOME}/.cups/client.conf and
@{HOME}/.cups/lpoptions
Bug-Ubuntu: https://launchpad.net/bugs/887992

Added owner match per Steve Beattie and lpoptions per Steve and Christian Boltz
2012-01-06 10:45:34 -06:00
Jamie Strandboge
2b4e235ffd Description: allow read access of /etc/python{2,3}.[0-7]*/sitecustomize.py
in python abstraction. This script is used by apport aware python applications
Bug-Ubuntu: https://launchpad.net/bugs/860856

Acked-by: Jamie Strandboge <jamie@canonical.com>
Acked-by: Kees Cook <kees@ubuntu.com>
2012-01-06 10:38:06 -06:00
Jamie Strandboge
27dacf2eca Description: update dovecot deliver profile to access various .conf files for
dovecot
Bug-Ubuntu: https://launchpad.net/bugs/458922

Acked-by: Jamie Strandboge <jamie@canonical.com>
Acked-by: Kees Cook <kees@ubuntu.com>
2012-01-06 10:34:44 -06:00