Commit graph

3021 commits

Author SHA1 Message Date
Jamie Strandboge
6db2f7d4eb Newer version of libvirt have a lease helper. Update dnsmasq policy for this.
Acked-By: Jamie Strandboge <jamie@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-08-20 22:06:15 -05:00
Jamie Strandboge
502e992c42 Update perl abstraction, logprof.conf, severity.db and tests for Debian/Ubuntu
perl multiarch paths

Acked-By: Jamie Strandboge <jamie@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-08-20 19:14:24 -05:00
Christian Boltz
5006abbbb2 Fix "Invalid mode found: AUDITING" in aa-logprof. Actually the fix is
done in logparser.py which contained "AUDITING" instead of "AUDIT" at
one place.

References: https://bugs.launchpad.net/apparmor/+bug/1358705


Acked-by: Steve Beattie <steve@nxnw.org>
2014-08-21 00:55:44 +02:00
Christian Boltz
427258d07a remove unused REs in logparser.py
Those REs also exist (and are used) in aa.py.


Acked-by: Steve Beattie <steve@nxnw.org>
2014-08-18 21:01:38 +02:00
Christian Boltz
784837301b Fix a bug in logparser.py add_event_to_tree(). It looked for '\\null-/'
but should look for '//null-' instead.

Also remove some code duplication by merging with the next condition, 
which executes the same self.add_to_tree code.


Acked-by: Kshitij Gupta <kgupta8592@gmail.com>.
2014-08-17 21:50:15 +02:00
Christian Boltz
51eb1bd69c fix a crash in aa.py / check_for_LD_XXX():
File "/home/cb/apparmor/HEAD-CLEAN/utils/apparmor/aa.py", line 126, in check_for_LD_XXX
  for line in f_in:
  [...]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xf8 in position 40: ordinal not in range(128)

While on it, also replace usage of the "found" variable by "return" 
statements, which should bring a small performance improvement - if we 
have a match, it's superfluous to continue searching.

The patch also adds me to the copyright header ;-)


Acked-by: Kshitij Gupta <kgupta8592@gmail.com>.
2014-08-17 18:16:33 +02:00
Christian Boltz
ddd78f97d9 Simplify simple_tests/profile/flags/*bad*.sd testcases to make sure
they only fail because of one (expected) reason and we notice if they
don't fail anymore. Complex profiles have the risk to fail for multiple
reasons, which also means nobody will notice if they fail for one reason
less.

The simplification is done by
- removing #include lines
- in some cases, replace the #include line with "/foo/bar r," to avoid 
  empty hats

Acked-by: Steve Beattie <steve@nxnw.org>
2014-08-16 13:22:51 +02:00
Seth Arnold
0ba4c8cd7e Ensure the that the {**,} and {,**} regexs are being properly parsed by
the Python tools.

Signed-off-by: Seth Arnold <seth.arnold@canonical.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2014-08-14 10:51:42 -07:00
Launchpad Translations on behalf of apparmor-dev
74f82b022f Launchpad automatic translations update. 2014-08-14 05:34:24 +00:00
Tyler Hicks
e46fa6d92f tests: Update unix_socket.sh for kernel ABI v7
Kernel ABI v6 only required 'w' permissions for the parent process that
creates the socket, accepts a connection, writes to the socket, and
reads from the socket.

Kernel ABI v7 will require 'rw' permissions for the parent process. This
change detects the current kernel ABI version and adjusts the parent
process's confinement appropriately. It also performs a negative test to
make sure that 'w' is not sufficient.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-08-11 23:59:34 -05:00
Tyler Hicks
a2d0cc1a97 tests: Minimal update to make unix_socket.sh aware of abstract sockets
This change only sets up unix_socket.sh to test abstract sockets.
Unconfined processes are tested while using an abstract socket but
the test function returns before testing with confinement.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-08-11 23:59:28 -05:00
Tyler Hicks
f7465573b7 tests: Modify unix_socket/unix_socket_client to accept abstract names
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-08-11 23:59:17 -05:00
Tyler Hicks
1cd336386e tests: Rename the unix_socket_file test to unix_socket
Rename the test in preparation for expanding its capabilities to cover
all UNIX domain socket address format types.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-08-11 23:58:51 -05:00
Tyler Hicks
fc8c936361 tests: Don't leak socket fd to child process
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-08-11 23:56:17 -05:00
Christian Boltz
0c904eb476 smbd: changed cachedir in openSUSE
openSUSE now compiles samba --with-cachedir=/var/lib/samba (instead of 
the default /var/cache/samba). This patch updates the smbd profile to 
match this change.


Acked by: Seth Arnold <seth.arnold@canonical.com>
2014-08-11 23:22:55 +02:00
Christian Boltz
61ac0a0ac4 dovecot/auth needs read access to /etc/dovecot/* when using plaintext
user/password files (everybody will use a different filename for the 
user/password list - and when you allow reading the password list, 
allowing to read the config doesn't add any harm ;-)

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

Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-08-11 23:16:22 +02:00
Christian Boltz
d5e6058370 apparmor:vim: add mediate_deleted and delegate_deleted flags
Acked-by: Steve Beattie <steve@nxnw.org>
2014-08-11 23:13:55 +02:00
Christian Boltz
c814443a83 Set the currently selected path as (editable) default when using "(N)ew"
in aa-logprof or aa-genprof.

Acked-by: Kshitij Gupta <kgupta8592@gmail.com>
2014-08-06 19:07:41 +02:00
Christian Boltz
356e7cb199 aa-mergeprof: honor -d parameter
(it was ignored until now)

Acked-by: Kshitij Gupta <kgupta8592@gmail.com>.
2014-08-04 20:19:08 +02:00
Christian Boltz
265270b83c From: Jeff Mahoney <jeffm@suse.com>
Subject: perl-apparmor: Properly handle bare 'file' keyword
References: bnc#889652

The bare file keyword is a shortcut for /{**,}. There are also implied
permissions that go with it.

This patch accepts the file keyword as well as allowing for missing mode
specifiers.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>

Acked-by: Steve Beattie <steve@nxnw.org>
2014-08-02 12:46:15 +02:00
Christian Boltz
c7f7b8d7e0 From: Jeff Mahoney <jeffm@suse.com>
Subject: perl-apparmor: Handle bare 'capability' keyword
References: bnc#889651

Specifying 'capability' implies all capabilities, but the perl code didn't
recognize it.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>

Acked-by: Steve Beattie <steve@nxnw.org>
2014-08-02 12:45:26 +02:00
Christian Boltz
d6f1895465 From: Jeff Mahoney <jeffm@suse.com>
Subject: perl-apparmor: Fix bare 'network' keyword handling
References: bnc#889650

The 'network' bare keyword was being printed as "audit network all" due to
two different bugs:

1) {audit}{all} was always being set to 1, regardless of whether the audit
   keyword was used
2) {rule} eq 'all' is the wrong test - it should be {rule}{all}

With these fixed, 'network' is properly handled.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>

Acked-by: Steve Beattie <steve@nxnw.org>
2014-08-02 12:43:54 +02:00
Christian Boltz
241544ad8a modify aa-mergeprof to:
- allow users to merge two profiles (2-way merge) using aa-mergeprof by
  making the third profile optional
- re-enable code that cleaned up base and other profile and using it in
  deleted count (was disabled due to pyflakes thinking it was unused)

Patch by Kshitij Gupta <kgupta8592@gmail.com>


Acked-by: Christian Boltz <apparmor@cboltz.de>
2014-07-29 12:39:12 +02:00
Christian Boltz
37ca3dd556 add some more globbing tests for globs with extension, including
filenames that contain a * wildcard and a .* regex wildcard.

Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-07-28 20:16:04 +02:00
Christian Boltz
be6cb6724d fix aa-mergeprof to
- import apparmor.ui as aaui
- call aaui.UI_*() instead of apparmor.aa.UI_*()
- use apparmor.aamode.AA_MAY_EXEC instead of apparmor.aa.AA_MAY_EXEC


Acked-by: Kshitij Gupta <kgupta8592@gmail.com>.
2014-07-28 00:24:26 +02:00
Steve Beattie
ab2ac92ecf utils: make all tests consistent in verbosity
This patch adjusts the verbosity of several of the utils tests,
to make them all consistently verbose.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-07-25 17:49:06 -07:00
Launchpad Translations on behalf of apparmor-dev
3ec7f81dcc Launchpad automatic translations update. 2014-07-24 05:40:28 +00:00
Christian Boltz
dd3b6a8d4a Set PYTHONPATH=.. in runtests-py3.sh to make sure the tests use the in-
tree python modules.

Also remove "sys.path.append('../')" (and now-unused "import sys") from 
all tests that contain it for consistency and to make testing with the 
installed modules possible (even if we don't have a USE_SYSTEM option 
yet).


Acked-by: Steve Beattie <steve@nxnw.org>
2014-07-22 21:25:25 +02:00
Christian Boltz
95ef7cabcb Fix a crash in aa-logprof (to be exact: save_profiles() in aa.py) when
saving the remaining profile after using "save selected profile".

When using "save selected profile", write_profile() (called by 
write_profile_ui_feedback()) does "changed.pop(profile_name)". 
However, saving the remaining profiles in save_profiles() uses a cached 
version of changed.keys() and therefore tries to save a profile that 
was already saved and is no longer part of "changed".


Also remove two commented lines we'll never need again:
- #changed.pop is done in write_profile()
- q['options'] is set some lines above

References: https://bugs.launchpad.net/apparmor/+bug/1341178

Acked-by: Steve Beattie <steve@nxnw.org>
2014-07-22 12:56:37 +02:00
Steve Beattie
aeebd69555 utils: add CAP_AUDIT_READ to severity.db
This patch adds the new capability CAP_AUDIT_READ, added in the 3.16
kernel, to the utils severity.db. I set the severity level at 7,
since it seemed to offer less exposure than CAP_AUDIT_CONTROL and
CAP_AUDIT_WRITE, which are both considered severity 8.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-07-21 22:54:14 -07:00
Christian Boltz
a04a6bfdaf change severity_test.py and minitools_test.py to use the in-tree
profiles instead of the system profiles in /etc/apparmor.d/

Acked-by: Steve Beattie <steve@nxnw.org>
2014-07-17 15:59:57 +02:00
Christian Boltz
5f8b035a71 change runtests-py*.sh (scripts for manually running the utils/test/*.py
testcases) to
- sleep 10 seconds after each failed test to make failures more annoying
  ^W^W^W^Wgive people a chance to read failure details
- print a list of failed tests at the end

Also avoid duplicate code by letting runtests-py2.sh call runtests-py3.sh.


Acked-by: Steve Beattie <steve@nxnw.org>
2014-07-17 15:47:18 +02:00
Steve Beattie
9106aa7e59 Periodic merge from lp:apparmor (trunk) 2014-07-16 11:31:47 -07:00
Steve Beattie
0c64863c97 Merge from launchpad translations branch:
* updates to Bosnian, Suomi, and Malay parser translations
* added stub Turkish translation for utils
2014-07-16 11:28:08 -07:00
Launchpad Translations on behalf of apparmor-dev
1619144323 Launchpad automatic translations update. 2014-07-16 05:44:54 +00:00
Christian Boltz
43b128473d logparser.py defines LOG_MODE_RE, but doesn't use it.
LOG_MODE_RE is also defined (and used) in aamode.py.

This patch removes the superfluous definition from logparser.py.


Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-07-14 21:01:15 +02:00
Christian Boltz
abf92ecf67 fix two issues in LOG_MODE_RE in aamode.py:
- remove "Ix" (only valid as lowercase "ix")
- add "pux" (was missing before)

Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-07-14 20:56:26 +02:00
Christian Boltz
faff4b97c4 We still carry around the initscripts for aa-eventd. Since aa-eventd
is dead since a very long time, move them to the deprecated/ directory.

Acked-by: Steve Beattie <steve@nxnw.org>
2014-07-12 20:51:03 +02:00
Steve Beattie
c71af8b926 libapparmor: fix log parsing memory leaks
This patch fixes some memory leaks in the libapparmor log parsing
functions, specifically around handling records obtained from syslog
and records containing network addresses.

Bug: https://bugs.launchpad.net/bugs/1340927
Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-07-11 15:59:21 -07:00
Steve Beattie
16d7e971c3 profiles: permit clustered Samba access to CTDB socket and databases
Merge update to samba abstraction for CTDB support from David Disseldorp
<ddiss@suse.de>,

Acked-by: Steve Beattie <steve@nxnw.org>
2014-07-11 12:49:34 -07:00
Steve Beattie
dd41f0ff87 mod_apparmor: for apache 2.4, use new access control hook
Use ap_hook_check_access_ex() instead of
ap_hook_access_checker() for apache 2.4; see
http://httpd.apache.org/docs/2.4/developer/new_api_2_4.html#http_request

Signed-off-by: Steve Beattie <steve@nxnw.org>
2014-07-09 14:15:11 -07:00
Christian Boltz
dd3df80f01 abstractions/nameservice should allow /run/nscd/passwd etc. in addition
to /var/run/nscd/passwd.

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


Acked-by: Seth Arnold <seth.arnold@canonical.com> for both trunk and 2.8.
2014-07-09 10:14:14 +02:00
Steve Beattie
c42bc173ac mod_apparmor: whitespace cleanups
This patch is cosmetic; it cleans up a lot of whitespace issues:
removing trailing spaces, converting tabs into spaces, and removing
unneeded spaces around function arguments.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: John Johansen <john.johansen@canonical.com>
2014-07-08 00:46:13 -07:00
Steve Beattie
495b4c2c36 mod_apparmor: remove immunixisms from code
This patch is a cosmetic set of changes to remove references to immunix
from the source code (except in the case of handling deprecated
keywords), as well as correcting my email address.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: John Johansen <john.johansen@canonical.com>
2014-07-08 00:44:44 -07:00
Steve Beattie
8b79c9beb1 mod_apparmor: add 'servername-uri' hat
This patch adds an additional hat to try in the mod_apparmor processing
sequence, constructed from the host's ServerName + '-' + URI
(e.g. 'www.example.com-/some/uri'). This hat is attempted before the raw
URI hat is attempted, leaving the ordering as follows:

  (1) to a hatname in a location/directory directive
  (2) to the server name or a defined per-server default
  (3) to the server name + "-" + uri
  (4) to the uri
  (5) to DEFAULT_URI
  (6) back to the parent profile

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: John Johansen <john.johansen@canonical.com>
2014-07-08 00:41:58 -07:00
Steve Beattie
372764355a mod_apparmor: try uri hat after AADefaultHatName, not before
In trunk revno 2335, a bug was fixed in mod_apparmor that corrected
the storage location for AADefaultHatName.  The incorrect storage
caused the hat specified by the AADefaultHatName keyword to be the
default value for AAHatName, and meant that if both an AAHatName and
an AADefaultHatName entry were given in a vhost, mod_apparmor would
not fall back to trying AADefaultHatName if the hat specified in
AAHatName did not exist in the apache apparmor profile.

However, because the value specified in AADefaultHatName was the
default, if no AAHatName was specified, it would be attempted first,
before a hat based on the passed URI, rather than after as the
documentation stated and the code intended. By fixing the storage bug,
the attempted hat ordering now matched the documentation. But a number
of users came to rely on AADefaultHatName being attempted before
the URI. For trunk, this issue is less severe because mod_apparmor
passes a vector of hats to aa_change_hatv(), and thus missing URI
hats are not logged by the kernel apparmor bits. It still represents
a behavioral change to users, though.

This patch re-adjusts the ordering so that the URI-based hat is
attempted after the hat specified by AADefaultHatName is attempted,
thus maintaining the actual behavior before the bug addressed in
revno 2335 was fixed.

Patch history:
  v1: initial revision
  v2: no code changes; adjust comments and improve the man page
      documentation

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: John Johansen <john.johansen@canonical.com>
2014-07-08 00:39:05 -07:00
Christian Boltz
0f6be43d8e dovecot profile update
Some updates for the dovecot profiles, based on a patch from 
Christian Wittmer <chris@computersalat.de> (he sent it as SR for the 
openSUSE package, which uses a slightly older version of the dovecot
profiles)

Fix problems with dovecot and managesieve:
* usr.lib.dovecot.managesieve-login: network inet6 stream
* usr.lib.dovecot.managesieve:
  +#include <tunables/dovecot>
    /usr/lib/dovecot/managesieve {
  +  capability setgid,   # covered by abstractions/dovecot-common, therefore not part of this patch
  +  capability setuid,
  +  network inet stream,
  +  network inet6 stream,
  +  @{DOVECOT_MAILSTORE}/ rw,
  +  @{DOVECOT_MAILSTORE}/** rwkl,
* add #include <abstractions/wutmp> to usr.lib.dovecot.auth
   apparmor="DENIED" operation="open" parent=18310 \
   profile="/usr/lib/dovecot/auth" name="/var/run/utmp" pid=20939 \
   comm="auth" requested_mask="r" denied_mask="r" fsuid=0 ouid=0


Acked-by: Steve Beattie <steve@nxnw.org>

Bug: https://launchpad.net/bugs/1322778
2014-07-07 23:35:18 +02:00
David Disseldorp
b3c7f00669 profiles: permit clustered Samba access to CTDB socket and databases
When configured with "clustering = yes", Samba needs to be able to
connect to the local ctdbd daemon socket, and directly manipulate .tdb
database files managed by ctdb.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2014-07-04 12:09:58 +02:00
Steve Beattie
70926b5d55 profiles: add dovecot-common abstraction
This commit adds a dovecot-common abstraction, as well as adjusting
the profiles for dovecot's helper binaries to make use of it. The
important addition is the ability for the dovecot master process to
send signals to the helpers.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-06-27 12:14:53 -07:00
Steve Beattie
1b29c35db8 profiles: move postfix-common to abstractions/
Move postfix-common from program-chunks/ to abstractions/; remove
program-chunks directory since postfix-common was the last resident of
that directory (and had been since 2007), and adjust the includes of all
the profiles that include postfix-common.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-06-26 21:32:56 -07:00