Commit graph

4117 commits

Author SHA1 Message Date
Jamie Strandboge
59660c4650 Description: allow access to stub resolver configuration
Signed-Off-By: Jamie Strandboge <jamie@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2017-09-15 15:47:26 -05:00
John Johansen
6260deec9a Add the patches for 4.13 and 4.14. These are based on security-next for 4.14
The old out of tree patchseries has been completely dropped. v4.13
has most of the newer apparmor 3.x code in it. v4.14 has the rest except
the af_unix mediation which is included as the last patch
2017-09-11 09:16:39 -07:00
Christian Boltz
26a12fd9ac abstractions/freedesktop.org: support /usr/local/applications; support subdirs of applications folder
Merge request by Cameron Norman 2015-06-07
https://code.launchpad.net/~cameronnemo/apparmor/abstraction-fdo-applications-fixups/+merge/261336

Acked-by: Christian Boltz <apparmor@cboltz.de> for trunk, 2.11, 2.10 and 2.9
2017-09-10 12:27:23 +02:00
John Johansen
ec6faab94b Document the use of the features_X and requires() functions
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Tyler Hicks <tyhicks@canonical.com>
2017-09-07 17:29:09 -07:00
John Johansen
031792c400 regression_test: Clarify message about skipping pivot root transitions
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2017-09-07 13:01:23 -07:00
John Johansen
0d6a2fa9e7 regression tests: fix long path failure when path_max can not be written
Not all kernels support writing the path_max kernel parameter after
boot. Detect if it can be written and run the long_path tests only
if it can be.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
2017-09-07 11:24:54 -07:00
John Johansen
0983de0692 regression test: update query label tests to reflect, fixed xpass cases
newer versions of apparmor that support multi-transaction have this xpass
case fixed

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2017-09-07 02:29:49 -07:00
John Johansen
ec6f185787 regression test: conditionaly run pivot_root domain, transitions
Update the tests to test whether the kernel and parser support domain
transitions on pivot_root.

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2017-09-07 02:28:06 -07:00
John Johansen
4eece9d5ee with unix rules we output a downgraded rule compatible with network rules
so that policy will work on kernels that support network socket controls
but not the extended af_unix rules

however this is currently broken if the socket type is left unspecified
(initialized to -1), resulting in denials for kernels that don't support
the extended af_unix rules.

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: timeout
2017-09-07 02:26:15 -07:00
Christian Boltz
347715da30 Add network 'smc' keyword in NetworkRule and apparmor.d manpage
'smc' seems to be new in kernel 4.12.


Note that the 2.10 apparmor.d manpage also misses the 'kcm' keyword, so
the patch also adds it there.


Acked-by: Seth Arnold <seth.arnold@canonical.com> for trunk, 2.11 and 2.10.
2017-08-30 11:06:19 +02:00
Jamie Strandboge
27654be0b5 Update parser/policy_cache.c to consistently use defines in
valid_cached_file_version()

Signed-Off-By: Jamie Strandboge <jamie@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2017-08-29 08:58:34 -05:00
Christian Boltz
84cd523d8c Samba profile updates for ActiveDirectory / Kerberos
The Samba package used by the INVIS server (based on openSUSE) needs
some additional Samba permissions for the added ActiveDirectory /
Kerberos support.

As discussed with Seth, add /var/lib/sss/mc/initgroups read permissions
to abstractions/nameservice instead of only to the smbd profile because
it's probably needed by more than just Samba if someone uses sss.


Acked-by: Seth Arnold <seth.arnold@canonical.com> for 2.9, 2.10, 2.11 and trunk.
2017-08-29 13:31:20 +02:00
Christian Boltz
ae692bfb3b Drop 'log' parameter from ReadLog
This parameter is always [], so we can simplify the ReadLog __init__()
parameters.

Note that some tests handed over '' instead of []. This was a bug, but
didn't matter because those tests only use a small portion of ReadLog.


Acked-by: Seth Arnold <seth.arnold@canonical.com>
2017-08-28 23:15:51 +02:00
Christian Boltz
a016042a9a Make aa.py 'log' non-global
'log' is only used in do_logprof_pass, and reset to [] at the beginning
of the function. Therefore it doesn't need to be a global variable.

Also, do_logprof_pass() initializes log = [], which gets then handed
over to ReadLog and overwritten by the read_log() call in the next line.
To make clear that [] gets handed over to ReadLog, replace log with []
and drop the now superfluous initialization with [].


Acked-by: Seth Arnold <seth.arnold@canonical.com>
2017-08-28 23:12:08 +02:00
Seth Arnold
d53a4f80bf artiom suggested a man fix for postgresql's manpages
Signed-off-by: Seth Arnold <seth.arnold@canonical.com>
Acked-by: John Johansen <john.johansen@canonical.com>
2017-08-22 11:27:31 -07:00
Christian Boltz
9480a83ddf update some Postfix profiles
- change abstractions/postfix-common to allow /etc/postfix/*.db k
- add several permissions to postfix/error, postfix/lmtp and postfix/pipe
- remove superfluous abstractions/kerberosclient from all postfix
  profiles - it's included via abstractions/nameservice


Acked-by: Seth Arnold <seth.arnold@canonical.com> for 2.9, 2.10, 2.11 and trunk
2017-08-22 12:43:18 +02:00
Steve Beattie
db8d865193 libapparmor: fix ptrace regression test failure
In http://bazaar.launchpad.net/~apparmor-dev/apparmor/master/revision/3659,
a testcase was added that where the expected output file did not match
the input source name, cause libapparmor's regression tests to fail:

  Output doesn't match expected data:
  --- ./test_multi/ptrace_no_denied_mask.out    2017-08-18 16:35:30.000000000 -0700
  +++ ./test_multi/out/ptrace_no_denied_mask.out  2017-08-18 16:35:38.985863094 -0700
  @@ -1,5 +1,5 @@
   START
  -File: ptrace_1.in
  +File: ptrace_no_denied_mask.in
   Event type: AA_RECORD_DENIED
   Audit ID: 1495217772.047:4471
   Operation: ptrace
  FAIL: ptrace_no_denied_mask

This patch corrects the issue.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2017-08-18 17:11:39 -07:00
Steve Beattie
237fc59ba8 user abstractions: fix for non-latin file/directory names
Merge from Vincas Dargis, approved by intrigeri
Fix user-write and user-download abstractions for non-latin file names.

Acked-by: Steve Beattie <steve@nxnw.org>
2017-08-09 12:46:04 -07:00
Steve Beattie
cfe2854740 traceroute profile: support TCP SYN for probes, quite net_admin request
Merge from Vincas Dargis, approved by intrigeri.
fix traceroute denies in tcp mode

Acked-by: Steve Beattie <steve@nxnw.org>
2017-08-09 08:57:36 -07:00
Jamie Strandboge
77c2e27e6c abstractions/ubuntu-browsers: support Debian's Firefox non-ESR path.
The updated rule covers the old-style /usr/lib/firefox/firefox.sh
wrapper and the current /usr/lib/firefox{,-esr}/firefox{,-esr} paths.

It is a tiny bit wide but let's lean on the side of compatibility with
whatever similar paths are used in the future. It doesn't grant access
to anything we don't want on a current Debian sid system.
2017-08-08 07:53:22 -05:00
Jamie Strandboge
3abb79b0ae ubuntu-browsers, ubuntu-helpers: support Debian's Chromium paths. 2017-08-08 07:43:32 -05:00
intrigeri
cc5a23d4c1 ubuntu-browsers, ubuntu-helpers: support Debian's Chromium paths. 2017-08-07 17:03:05 -04:00
intrigeri
ff66ca9039 abstractions/ubuntu-browsers: support Debian's Firefox non-ESR path.
The updated rule covers the old-style /usr/lib/firefox/firefox.sh
wrapper and the current /usr/lib/firefox{,-esr}/firefox{,-esr} paths.

It is a tiny bit wide but let's lean on the side of compatibility with
whatever similar paths are used in the future. It doesn't grant access
to anything we don't want on a current Debian sid system.
2017-08-07 15:31:19 -04:00
Steve Beattie
0e6a9c54f2 abstractions/gnome: allow reading GLib schemas.
Merge from intrigeri based on original work by Cameron Norman.

Acked-by: Steve Beattie <steve@nxnw.org>
2017-08-07 10:37:50 -07:00
Steve Beattie
c519a1a9c1 wayland abstraction: allow wayland-cursor-shared-*
Merge from intrigeri.

Bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=870807
Acked-by: Steve Beattie <steve@nxnw.org>
2017-08-07 10:26:13 -07:00
Christian Boltz
c086d280b9 update netstat profile
- allow reading @{PROC}/@{pid}/net/netstat and @{PROC}/@{pid}/net/snmp
- drop owner conditional - /proc/*/net/* is always owned by root, and
  the owner conditional means breaking netstat for non-root users
- drop "@{PROC}/@{pids}/fd r," - /proc/*/fd is a directory, so this rule
  would never apply


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


Addition by Steve Beattie:
- also allow @{PROC}/@{pid}/net/udplite and  @{PROC}/@{pid}/net/udplit6


Acked-by: Christian Boltz <apparmor@cboltz.de>
2017-08-07 18:05:09 +02:00
intrigeri
2d6fa07fd5 wayland abstraction: allow wayland-cursor-shared-* (Closes: Debian#870807). 2017-08-05 09:47:27 -04:00
Christian Boltz
12cfc5ecf4 Prevent 'wa' conflicts for file rules
get_file_perms() and propose_file_rules() happily collect all file
permissions. This could lead to proposing 'wa' permissions in
aa-logprof, which then errored out because of conflicting permissions.

This patch adds a check to both functions that removes 'a' if 'w' is
present, and extends the tests to check this.


Acked-by: Seth Arnold <seth.arnold@canonical.com> for trunk and 2.11.

Note: Both functions (including this bug) were introduced together with
FileRule, so older releases are not affected.
2017-08-04 22:26:41 +02:00
Christian Boltz
1d0790c0c6 Carry over all autodep-generated rules in handle_children()
When creating a new child profile, handle_children() did only copy over
include and path rules. While this was correct in the past, path rules
got changed to FileRule in the meantime and were therefore lost.
(In practise, this means the "$binary mr," rule wasn't added to the new
child profile, causing a "superfluous" question in aa-logprof.)

This patch changes handle_children() to carry over the complete new
child profile instead of only cherry-picking include and path rules.


Acked-by: Steve Beattie <steve@nxnw.org> for trunk and 2.11.

Older versions (with path as hasher) are not affected.
2017-08-02 13:01:03 +02:00
Tyler Hicks
5e535b246a utils: update aa-status.pod to unify exit status and bugs sections
Create an EXIT STATUS header and place the BUGS section after the EXIT
STATUS section to match the style in aa-enabled.pod.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-By: Jamie Strandboge <jamie@canonical.com>
2017-07-31 17:44:52 +00:00
Tyler Hicks
ad4ac5780f binutils: update aa-enabled.pod to unify exit status styles
Make the possible exit status values bold to match the style used in
aa-status.pod as of r3680.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-By: Jamie Strandboge <jamie@canonical.com>
2017-07-31 17:44:07 +00:00
Jamie Strandboge
3927a5a54a update aa-status.pod for updated podchecker
Bug-Ubuntu: https://launchpad.net/bugs/1707614

Signed-Off-By: Jamie Strandboge <jamie@canonical.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2017-07-31 10:19:45 -05:00
Christian Boltz
e038b0fcff Remove duplicate rule from userdel profiles
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2017-07-28 12:51:50 +02:00
Jamie Strandboge
9f7eab039a Adjust python abstraction for python3.6
Signed-Off-By: Jamie Strandboge <jamie@canonical.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2017-07-26 15:05:25 -05:00
Christian Boltz
233a011db0 Add --no-reload to various utils manpages
This option exists in several aa-* tools since 2.9, but isn't mentioned
in the manpage.

Also drop some trailing whitespace in the manpages.


Acked-by: John Johansen <john.johansen@canonical.com>
for 2.9, 2.10, 2.11 and trunk.
2017-07-23 21:29:53 +02:00
Goldwyn Rodrigues
8cb6ded867 genprof: Use important message as an explanation
While performing genprof, The message to start and scan the program
is mentioned in a separate important message, while it can be
presented as a part of the explanation of the PromptQuestion.

While this will not change the output of text mode, this will help
json clients like yast be more expressive.


Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>

Acked-by: Seth Arnold <seth.arnold@canonical.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2017-07-14 22:32:15 +02:00
Christian Boltz
6bab27b56d [3/3] Move 'ruletypes' to profile_storage.py
Also make 'ruletypes' a dict pointing to the *Ruleset class, and change
ProfileStorage __init__() to iterate over 'ruleset'.


Acked-by: Seth Arnold <seth.arnold@canonical.com>
2017-07-11 13:33:40 +02:00
Christian Boltz
325ff61910 [2/3] Make ProfileStorage a class
Move ProfileStorage() from aa.py to the new profile_storage.py and make
it a class. The variable name in __init__() changes (profile -> self.data),
but the content stays the same.

The ProfileStorage class acts like a dict(), but has some additional
checks for unknown keys in place.

Also add some tests to make sure unknown keys really raise an exception.


Acked-by: Seth Arnold <seth.arnold@canonical.com>
2017-07-11 13:32:33 +02:00
Christian Boltz
cf86c9252d [1/3] Rename profile_storage() to ProfileStorage()
This is a preparation to make the next patch smaller and easier to
read ;-)


Acked-by: Seth Arnold <seth.arnold@canonical.com>
2017-07-11 13:30:29 +02:00
Christian Boltz
5b4001e810 Drop safety net for network rules in parse_profile_data()
Network rules are the only rule type that had this safety net - if
profile_data[profile][hat] really isn't initialized (which shouldn't
happen), things will break at lots of other places ;-)


Acked-by: Seth Arnold <seth.arnold@canonical.com>
2017-07-11 13:29:47 +02:00
Cameron Norman
52d41feeaf Merged two rule groups 2017-07-03 12:50:38 -07:00
Vincas Dargis
5b5da2b010 fix traceroute denies in tcp mode 2017-07-03 19:44:14 +03:00
intrigeri
89c0051304 abstractions/gnome: allow reading GLib schemas.
Based on Cameron Norman's initial work
(http://bazaar.launchpad.net/~cameronnemo/apparmor/gnome-abstraction/revision/3111) with the following changes:

 * don't include GTK+ 3.0 configuration: already done earlier
 * generalize to future GLib versions
 * support /usr/local
 * allow reading the parent directory as well, following the lead
   of usr.lib.telepathy: this is harmless and could be needed in some cases.
2017-07-03 09:44:43 +02:00
Christian Boltz
713b0d2b80 merge Jason Hennessey 2017-02-17 * Fix LP: #1665535 - Enable camera access in browser apparmor profile for WebRTC
https://code.launchpad.net/~henn/apparmor/fix-for-1665535/+merge/317680


Approved by Jamie Strandboge and intrigeri.

Acked-by: Christian Boltz <apparmor@cboltz.de>
2017-07-02 11:47:08 +02:00
Vincas Dargis
5d516bb4a9 fix user-write abstraction for non-latin file names 2017-07-02 12:22:21 +03:00
Christian Boltz
7360781a8f dovecot profile: add the attach_disconnected flag
Reported by pfak on IRC

[...] apparmor="DENIED" operation="sendmsg" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/dovecot" name="run/systemd/journal/dev-log" pid=20313 comm="dovecot" requested_mask="w" denied_mask="w" fsuid=0 ouid=0


Acked-by <timeout> for 2.9, 2.10, 2.11 and trunk.
2017-06-29 22:53:40 +02:00
Jamie Strandboge
16f16486ee Author: Jamie Strandboge <jamie@canonical.com>
Description: adjust the multiarch alternation rule in the perl abstraction for
 modern Debian and Ubuntu systems which store some modules under the
 architecture-specific perl-base directory instead of perl or perl5.

Signed-Off-By: Jamie Strandboge <jamie@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2017-06-26 14:33:44 -05:00
Christian Boltz
ce33d5af9a drop dead code from logparser.py parse_event_for_tree()
In parse_event_for_tree(), map_log_type() never gets called. Also,
aamode is never 'UNKNOWN'.

Proof for both: I have a local patch that raises an exception for both
cases since two years ;-)

This patch drops the call to map_log_type() and the function itsself.
It also adds a safety check for 'UNKNOWN' - instead of silently ignoring
it, raise an exception (which will most probably never happen).


Acked-by: Seth Arnold <seth.arnold@canonical.com>
2017-06-26 21:28:03 +02:00
Christian Boltz
673be01cdc drop dead code from tools.py
tools.py act() is only used by aa-cleanprof, therefore the else branch
(self.name != cleanprof) never gets used.

This patch drops the dead code and renames act() to cleanprof_act() to
make it clear that only aa-cleanprof calls this function.


Acked-by: Seth Arnold <seth.arnold@canonical.com>
2017-06-26 21:27:06 +02:00
Jamie Strandboge
e475e2d0b1 Author: Jamie Strandboge <jamie@canonical.com>
Description: adjust the multiarch alternation rule in the perl abstraction for
 modern Debian and Ubuntu systems which store some modules under the
 architecture-specific perl-base directory instead of perl or perl5.

Signed-Off-By: Jamie Strandboge <jamie@canonical.com>
2017-06-26 14:04:52 -05:00