Commit graph

2666 commits

Author SHA1 Message Date
Seth Arnold
2a5587439f Merge two patches around uservars.* files
Delete uservars.out (Message-ID: <20140303235422.GD4112@nxnw.org>)
Add uservars.inc.{system,source} to support USE_SYSTEM variable

(John ack'd the USE_SYSTEM variable bit)

Signed-of-by: Seth Arnold <seth.arnold@canonical.com>
Acked-by: John Johansen <john.johansen@canonical.com>
2014-03-03 16:03:23 -08:00
Steve Beattie
6cf4cbea21 utils: remove aa-enforce '--remove' option
This patch removes the '--remove' option on aa-enforce as well as from
the man page. It also removes the test entry that contains it, but I
don't think this is entirely correct because I think the second half
of the test is dependent on the (now deleted) first half of the test.

(It also removes a missed reference to --revert in the aa-disable man
page.)

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-03-03 14:59:47 -08:00
Steve Beattie
3575ca4ac9 utils: remove aa-disable non-functional '-r' option
This patch removes the non-funcional -r option for aa-disable, as
well as the test and manpage documentation for it.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-03-03 13:29:32 -08:00
Steve Beattie
4f8dea0db8 utils: make test-aa-easyprof.py cope with UsrMove
The test-aa-easyprof.py script has '/bin/ls' hardcoded as a path;
however, on systems that have undergone UsrMove, this is a symlink to
/usr/bin/ls. This patch fixes the issue by getting the realpath of
/bin/ls and storing it as an instance field.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-03-03 13:26:41 -08:00
Steve Beattie
fc24ae63ef s patch splits out the disable functionality from the
apparmor/tools.py:act() method into a separate cmd_disable()
method. The intent is to unwind the logic in act() into smaller, more
digestible chunks, while sharing commonality via helper functions
(e.g. the added get_next_to_profile() function).

A secondary driver of this change is that the tools fail when used
against the trunk profiles, due to act() forcing all the profiles to
be read and the tools not understanding the recently added dbus rules
(they were intentionally ignored as part of scoping the rewrite).
Unfortunately, this is not a solution for aa-enforce, aa-complain, etc.
as they are expected to know enough about profiles to understand and
update profile flags.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Christian Boltz <apparmor@cboltz.de>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-03-03 07:50:12 -08:00
Steve Beattie
9bfb0d911e libapparmor: fix missing symbol adjustment from previous commit. 2014-03-01 16:19:11 -08:00
Steve Beattie
09af9efd5c libapparmor: add APPARMOR_1.1 version for aa_query_label symbol
In the course of developing apparmor dbus mediation, the aa_query_label
symbol was added to libapparmor on trunk, and given the symbol version
(via libapparmor.map) of APPARMOR_3.0. As apparmor upstream, we have
not made a release where this would have been exported.

Unfortunately, in Ubuntu, a version was released in 13.10 that included
the aa_query_label() symbol with a version of APPARMOR_1.1. This
can cause a breakage on that platform with the incorporation of the
impending apparmor 2.9 release.

This patch provides both versions (APPARMOR_1.1 and APPARMOR_2.9)
of the aa_query_label() symbol. It requires the function name in
kernel_interface.c to be renamed (similar to how the deprecated
change_hat() symbol is named in the source as __change_hat()),
otherwise linking fails with duplicated symbols. The default symbol
used will still be the APPARMOR_2.9 version, but binaries linked with
the APPARMOR_1.1 version would still continue to work unchanged.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: John Johansen <john.johansen@canonical.com>
2014-03-01 15:46:42 -08:00
Christian Boltz
6a44e0eef5 add recursive_print() to common.py.
It prints a data structure in an easily readable output and is quite 
useful for debugging. However, I don't recommend to call it in 
production code ;-)

Acked-by: Kshitij Gupta <kgupta8592 at gmail.com>
2014-02-28 23:31:16 +01:00
Kshitij Gupta
781d237798 Fix tests for new tools.
Update path to tools in minitools_test.py
Fix assert values in config_test.py

Signed-off: Kshitij Gupta <kgupta8592@gmail.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2014-02-28 16:09:00 +05:30
Steve Beattie
5045d74716 utils: add common symlink to test/ clean target, to compensate for
packaging systems that do a make clean while trying to represent
changes.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-02-27 16:47:06 -08:00
Steve Beattie
20f26a0680 utils: hook in vim generator sanity test into make check
Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-02-27 16:25:00 -08:00
Steve Beattie
0dede73da8 utils: fix path in test-aadecode.py and push make check into the test/
subdirectory.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-02-27 16:23:35 -08:00
Seth Arnold
fc7a7004da Fix module import errors, remove extraneous newlines
AttributeError: 'module' object has no attribute 'UI_Info'
AttributeError: 'module' object has no attribute 'open_file_read'
AttributeError: 'module' object has no attribute 'check_for_apparmor'

Signed-off-by: Seth Arnold <seth.arnold@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
2014-02-27 14:53:25 -08:00
John Johansen
6744feeb76 Capability entries in the profile are not being correctly initialized to 0
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
2014-02-27 13:53:28 -08:00
Jamie Strandboge
429f077679 Add /var/www/html to abstractions/web-data, which is the path used on Debian
and its derivatives
Bug-Ubuntu: https://launchpad.net/bugs/1285653

Acked-By: Jamie Strandboge <jamie@canonical.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2014-02-27 14:49:54 -06:00
Christian Boltz
7e60928b34 aa-autodep (and therefore also aa-genprof) created a nearly-empty
profile files with only tunables/global, but no profile. This patch 
makes sure that the profile itsself is also written to the profile file.

Without the added line, filelist[prof_filename]['profiles'].keys()) in 
serialize_profile was empty, which means the loop that writes the 
profile was never executed.

Acked-by: Steve Beattie <steve@nxnw.org>
2014-02-26 23:41:00 +01:00
Steve Beattie
7b9d8a1f9d libapparmor: libtool versionin
This commit adjusts the trunk libtool versions in accordance
with the outlined rules. It also adds clarifying text to the
documentation comment to explain how to use the rules and what the
resulting outcome is. Finally, it removes a bogus argument to linker
to forcibly set the SONAME in the library, as libtool will do this
automatically (and override the passed argument).

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
Acked-by: John Johansen <john.johansen@canonical.com>
2014-02-25 15:34:40 -08:00
Christian Boltz
410e1eb132 Change aa-complain / set_complain() to (only) add the complain flag.
We don't need to additionally create a force-complain symlink.

Acked-by: Steve Beattie <steve@nxnw.org>
2014-02-25 13:17:46 +01:00
Steve Beattie
361f08bad8 utils: fix cmd reference in apparmor/tools.py
This patch fixes up the parser command invocation via
apparmor/common.py:cmd(), as it handles stdout/stderr redirection,
and the redirection that was being attempted were being handed as
arguments to the parser.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2014-02-24 14:22:35 -08:00
Christian Boltz
33857562af update the bugtracker link in the libapparmor README
Acked-by: Steve Beattie <steve@nxnw.org>
2014-02-24 22:44:32 +01:00
Christian Boltz
a5d003f90d new profile tools - handling of "(F)inish"
Let "(F)inish" ask the user if he wants to save the changed profiles 
before exiting, instead of aborting without saving (we already have 
Abo(r)t for that ;-)


Acked-by: Kshitij Gupta <kgupta8592@gmail.com>
2014-02-24 20:56:28 +01:00
Christian Boltz
ce8429523d fix two (unrelated) issues in common.py:
- add some debug logging in valid_path()
- fix a py2 incompability in DebugLogger.__init__ (OSError vs. IOError)

Acked-by: Kshitij Gupta <kgupta8592@gmail.com>
2014-02-24 20:34:21 +01:00
Christian Boltz
2e3d542c28 Profile parsing: some fixes around the REPOSITORY: line
- use the (new) "parts" variable for the line.split result to make the 
  code less confusing
- change the line.startswith to check for "REPOSITORY:" (note the 
  added ":") like it was in the code before my previous patch.
- make the check for "NEVERSUBMIT" more exact
- print a warning on invalid REPOSITORY: lines and make sure to keep
  them as unmodified line (it might just be a "normal" comment someone
  added manually)


Acked-by: Kshitij Gupta <kgupta8592@gmail.com> (on IRC)
2014-02-24 19:20:11 +01:00
Christian Boltz
295a836324 new profile tools: preserve full initial comment
This patch
- preserves the complete initial comment
- makes sure whitespace inside the comment is kept (except leading 
  whitespace - line.trim() is still applied).
- no longer removes the "# vim:syntax" line

Note: I didn't test if handling the "REPOSITORY" line still works (in
theory it should), but without a working repo, I don't care too much ;-)


Acked-by: Steve Beattie <steve@nxnw.org>
2014-02-22 13:09:15 +01:00
Steve Beattie
72fa616362 Merge abstraction changes from Simon Dezial:
- Add missing applications/ directory read access rules
  - Adapt paths for python 3.{3,4}, coalescing some rules, and
    remove unneeded rule
2014-02-21 12:58:05 -08:00
Steve Beattie
192ca1dc57 parser: exit with error on invalid arguments
The parser currently indicates that it exited successfully if invalid
arguments are passed to it, which makes it difficult to detect when
other tools are calling it incorrectly. This patch causes it to return
'1' indicating a failure.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: John Johansen <john.johansen@canonical.com>
2014-02-20 16:53:18 -08:00
Simon Deziel
59e97687b1 Remove unneeded rule as this is already allowed by
the site-wide config rule.
2014-02-20 10:33:19 -05:00
Simon Deziel
96fd3f8bd0 Adapt path for python 3.{3,4} too 2014-02-20 10:31:47 -05:00
Simon Deziel
2eb7390aa2 Add missing directory read access rules 2014-02-20 10:31:07 -05:00
Christian Boltz
ea8e02412e dnsmasq profile - NetworkManager integration
This is an updated version of the previous dnsmasq profile patch, again 
from develop7 [at] develop7.info


Acked-by: John Johansen <john.johansen@canonical.com>
2014-02-17 22:56:02 +01:00
Seth Arnold
c77143b542 Bump library version numbers for a 2.8.95 pre-release of 2.9. 2014-02-16 22:12:43 -08:00
Steve Beattie
c3b258f602 Merge in the new python version of the apparmor utilities from Kshitij
Gupta's <kgupta8592@gmail.com> Google Summer of Code project, as well as
deprecate the older perl versions of the code.
2014-02-14 23:34:42 -08:00
Steve Beattie
b98c40181c utils/apparmor/yasti.py: remove XXX comments; when the time comes for
someone to attempt to see if things work with the python ycp bindings,
they'll discover whether the functions are the right ones or not.
2014-02-14 22:52:31 -08:00
Steve Beattie
7fab3a7a69 Sync with trunk. 2014-02-14 14:47:18 -08:00
Steve Beattie
ec7676bdec utils/aa-*: adjust python shebang lines to ease rewriting to an
alternate python if installed via the python-tools-setup.py script.
2014-02-14 14:42:19 -08:00
Christian Boltz
503d951673 update abstractions/winbind
- some *.dat files live in a different directory nowadays (at least in 
  openSUSE)
- the openSUSE smb.conf includes the (autogenerated) dhcp.conf, so this
  file also needs to be readable.

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

Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-02-14 23:37:13 +01:00
Jamie Strandboge
6812e5e550 Update abstractions to use new XDG_*_DIR values. Thanks to Christian Boltz for
the suggestion to use @{XDG_DOWNLOAD_DIR} in abstractions/user-download as
well as the existing entries.

Acked-By: Jamie Strandboge <jamie@canonical.com>
Acked-By: Christian Boltz <apparmor@cboltz.de>
2014-02-14 16:28:16 -06:00
Jamie Strandboge
8a0951be18 = Background =
The xdg-user-dirs specification[1] allows for translatable and movable common
directories. While this may be beneficial for users who for example want to have
~/Pictures translated into their own language, this flexibility provides
challenges for AppArmor. Untranslated xdg user directories are typically (see
~/.config/user-dirs.dirs):

XDG_DESKTOP_DIR="$HOME/Desktop"
XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_TEMPLATES_DIR="$HOME/Templates"
XDG_PUBLICSHARE_DIR="$HOME/Public"
XDG_DOCUMENTS_DIR="$HOME/Documents"
XDG_MUSIC_DIR="$HOME/Music"
XDG_PICTURES_DIR="$HOME/Pictures"
XDG_VIDEOS_DIR="$HOME/Videos"

On an Ubuntu system with the fr_CA locale installed, these become:
XDG_DESKTOP_DIR="$HOME/Desktop"
XDG_DOWNLOAD_DIR="$HOME/Téléchargements"
XDG_TEMPLATES_DIR="$HOME/Templates"
XDG_PUBLICSHARE_DIR="$HOME/Public"
XDG_DOCUMENTS_DIR="$HOME/Documents"
XDG_MUSIC_DIR="$HOME/Musique"
XDG_PICTURES_DIR="$HOME/Images"
XDG_VIDEOS_DIR="$HOME/Vidéos"

While the kernel and AppArmor parser handle these translations fine, the
profiles do not.

As an upstream, we can vastly improve the situation by simply creating the
xdg-user-dirs tunable using the default 'C' xdg-user-dirs values:
$ cat /etc/apparmor.d/tunables/xdg-user-dirs
@{XDG_DESKTOP_DIR}=Desktop
@{XDG_DOWNLOAD_DIR}=Downloads
@{XDG_TEMPLATES_DIR}=Templates
@{XDG_PUBLICSHARE_DIR}=Public
@{XDG_DOCUMENTS_DIR}=Documents
@{XDG_MUSIC_DIR}=Music
@{XDG_PICTURES_DIR}=Pictures
@{XDG_VIDEOS_DIR}=Videos

# Also, include files in tunables/xdg-user-dirs.d for site-specific adjustments
# to the various XDG directories
#include <tunables/xdg-user-dirs.d>

and then create the /etc/apparmor.d/tunables/xdg-user-dirs.d directory. With
that alone, we can start using rules like this in policy:

  owner @{HOME}/@{XDG_MUSIC_DIR}/** r,

and users/admins can adjust /etc/apparmor.d/tunables/xdg-user-dirs or drop files
into /etc/apparmor.d/tunables/xdg-user-dirs.d, providing a welcome convenience.

This of course doesn't solve everything. Because users can modify their
~/.config/user-dirs.dirs file at will and have it point anywhere, so we can't
examine those files and do anything automatic there (when we have user policy we
can revisit this). This patch handles translations well though since use of
translations for these directories happens outside of the user's control. Users
who modify ~/.config/user-dirs.dirs can update policy like they need to now (ie,
this patch doesn't change anything for them).

[0] https://lists.ubuntu.com/archives/apparmor/2013-August/004183.html
[1] http://freedesktop.org/wiki/Software/xdg-user-dirs/

This patch adds basic support for XDG user dirs:

1. Update profiles/apparmor.d/tunables/global to include xdg-user-dirs.
2. Create the xdg-user-dirs tunable using the default 'C' xdg-user-dirs values
   and includes tunables/xdg-user-dirs.d
3. Add profiles/apparmor.d/tunables/xdg-user-dirs.d/site.local with commented
   out examples on how to use the directory.

Acked-By: Jamie Strandboge <jamie@canonical.com>
Acked-By: Christian Boltz <apparmor@cboltz.de>
2014-02-14 16:24:52 -06:00
Jamie Strandboge
e9c30a9361 libthai-data is used by LibThai which is the library used to deal with
Thai-specific functions like word-breaking, input and output methods and basic
character and string support. This is: https://launchpad.net/bugs/1278702

Acked-By: Jamie Strandboge <jamie@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
2014-02-14 14:28:12 -06:00
Steve Beattie
a482139616 utils/aa-autodep: make --force be a boolean argument, not require an additional value 2014-02-14 12:25:13 -08:00
Steve Beattie
3cbbeac60d utils/apparmor/tools.py: fix misimport of UI stuff as well as a paren
depth error in use_autodep()
2014-02-14 12:19:55 -08:00
Steve Beattie
edb874a2de utils/apparmor/aa.py: fix confusion over name vs data structure 2014-02-14 11:54:02 -08:00
Steve Beattie
4d2b9b5c5d utils/apparmor/aa.py: fix dict/list confusion in create_new_profile() 2014-02-14 11:20:20 -08:00
Seth Arnold
35e79ef66d Author: Jamie Strandboge <jamie@canonical.com>
Description: Allow applications run under sanitized_helper to connect to DBus

This was originally 0076_sanitized_helper_dbus_access.patch in the Ubuntu
apparmor packaging.

jdstrand: +1 (this is in the Ubuntu namespace, so feel free to commit)
2014-02-13 18:11:54 -08:00
Seth Arnold
0aefb378f9 Subject: using webapps triggers firefox rejections
Bug: https://bugs.launchpad.net/ubuntu/+source/apparmor/+bug/1056418
From: Steve Beattie <steve.beattie@canonical.com>

Came from 0021-webapps_abstraction.patch in the Ubuntu apparmor packaging.

jdstrand: +1 (this is in the Ubuntu namespace, so feel free to commit)
2014-02-13 18:10:05 -08:00
Seth Arnold
b432cf45c9 Add aa-easyprof and easyprof.py and related pieces from the Ubuntu
apparmor packaging.

These were originally 0030-easyprof-sdk.patch and
0037-easyprof-sdk-pt2.patch. Jamie posted an updated
0030-easyprof-sdk_v2.patch and I squashed both patches into one commit.

Acked-By: Jamie Strandboge <jamie@canonical.com>
2014-02-13 17:53:40 -08:00
Seth Arnold
3ee30ca14c Description: Remove access to pulseaudio debug socket from audio abstraction
Grant access to specific files in the /var/run/user/UID/pulse/ directory to
 remove access to potentially dangerous and non-essential files such as the
 debug (cli) socket provided by the module-cli-protocol-unix module.
Author: Tyler Hicks <tyhicks@canonical.com>
Bug-Ubuntu: https://launchpad.net/bugs/1211380
Acked-by: Steve Beattie <steve@nxnw.org>
2014-02-13 17:25:31 -08:00
Seth Arnold
b70d3fe48e Author: Jamie Strandboge <jamie@canonical.com>
Description: allow mmap of fglrx dri libraries
Bug-Ubuntu: https://launchpad.net/bugs/1200392
Acked-by: Steve Beattie <steve@nxnw.org>

Came from 0038-lp1200392.patch.
2014-02-13 17:23:56 -08:00
Seth Arnold
8e5f15c603 Author: Jamie Strandboge <jamie@canonical.com>
Description: update mod_apparmor man page for Apache 2.4 and add new
 apparmor.d/usr.sbin.apache2 profile (based on the prefork profile)
Acked-by: Steve Beattie <steve@nxnw.org>

Differs from original 0036-libapache2-mod-apparmor-profile-2.4.patch
ubuntu patch -- I've deleted the "delete the apache 2.2 profile" part of
the patch. So apache 2.2's profile is also still supported.
2014-02-13 17:21:41 -08:00
Seth Arnold
f88539d230 Description: /etc/vdpau_wrapper.cfg needed for Firefox 18+ on quantal
Author: Micah Gersten <micah@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>

Modified by Seth Arnold; nvidia nvpau_wrapper.cfg permission was hoisted
up into an nvidia abstraction.
2014-02-13 17:17:46 -08:00