Commit graph

4418 commits

Author SHA1 Message Date
Tyler Hicks
19c6c3310b all: Use the MAKE variable
https://www.gnu.org/software/make/manual/html_node/MAKE-Variable.html

We should be using the $(MAKE) variable when calling the make command
from Makefiles since we use Makefile recursion.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
2017-11-01 23:22:53 +00:00
Steve Beattie
29b20fd688
git conversion: move .bzrignore to .gitignore
Signed-off-by: Steve Beattie <steve.beattie@canonical.com>
2017-10-27 22:46:03 -07:00
Steve Beattie
df0f20f32b parser+libapparmor: partially address issues building with musl
adjust macros and header inclusion to make progress on building with the
musl C library.

Acked-by: Steve Beattie <steve@nxnw.org>
2017-10-27 17:12:24 -07:00
Steve Beattie
c4a4e5bb82 profiles: add attach_disconnected flags to example apache profile
Without it, seeing rejections like:

  apparmor="ALLOWED" operation="file_mmap" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/apache2" name="" pid=13777 comm="apache2" requested_mask="rw" denied_mask="rw" fsuid=0 ouid=0

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

Bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=875892
2017-10-27 10:59:33 -07:00
Steve Beattie
d2f7f21b04 profiles: update wireshark profile for modern releases
Acked-by: Steve Beattie <steve@nxnw.org>
2017-10-26 16:58:26 -07:00
John Johansen
eab153a7e9 Bump version 2.11.95 for 2.12 beta
Signed-off-by: John Johansen <john.johansen@canonical.com>
2017-10-26 10:50:19 -07:00
Steve Beattie
f737cc3444 profiles: allow OpenAL HRTF support in audio abstraction
The files are "head-related transfer function" data sets, used by
OpenAL for better spatialization of sounds when headphones are detected.

Bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=874665
2017-10-26 10:18:58 -07:00
Christian Boltz
7aeebcbb60 Keep JSON version at 2.12
We never did a release with the JSON code, and YaST (the only known user
of the JSON interface) will work with the added 'changes' dialog type
from r3721 without needing changes.

Also add a better comment/reason why a response for 'changes' is
expected, but gets ignored.


Reviewed-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
Acked-by: Steve Beattie <steve@nxnw.org>
2017-10-26 18:49:32 +02:00
Steve Beattie
62e91696ee utils: stop rewriting shbang lines in setup script
The python setup tools script is set to rewrite the shbang line of
scripts installed in ${PREFIX}/bin/ if the PYTHON environment variable
is set. Unfortunately, this (a) only covers the aa-easyprof script
as the rest are installed in ${PREFIX}/sbin/, and (b) we've deprecated
python 2 support, and hardcoded python3 as the interpreter for all of
the python scripts in the utils/ directory.

The only use for this feature would be if for some reason the utils did
not work properly with the default python3 interpreter and a specific
version was needed to be set, but I don't think that warrants keeping
the extra bit of code complexity around (and indeed, the snippet that
does this is forcibly disabled in Debian/Ubuntu).

Therefore, drop the shbang rewriting entirely.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: John Johansen <john.johansen@canonical.com>
2017-10-26 00:52:31 -07:00
Steve Beattie
ffeb6c02a5 binutils: honor ${CFLAGS} and ${CPPFLAGS}
Acked-by: Steve Beattie <steve@nxnw.org>
2017-10-26 00:45:22 -07:00
Steve Beattie
ad94da321b profiles: tunables/global - accept seven digit pids
On 64bit systems, /proc/sys/kernel/pid_max can be set to PID_MAX_LIMIT,
(2^22), which results in seven digit pids. Adjust the @{PID} variable in
tunables/global to accept this.

Acked-by: intrigeri <intrigeri@boum.org>
Acked-by: Steve Beattie <steve@nxnw.org>
2017-10-25 23:17:33 -07:00
Goldwyn Rodrigues
9a69ec2c48 [2/2] Add JSON interface to UI_Changes
Provides the filename in the json format, which can be
directly read by Yast. Increased the protocol version; perhaps
it should go in the next release.

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


[cboltz] fix "unused variable" warning and add a comment about ignoring
         the JSON response



Acked-by: Christian Boltz <apparmor@cboltz.de>
2017-10-26 00:36:48 +02:00
Goldwyn Rodrigues
6ce2768115 [1/2] Introduce UI_Changes functions
This is a preparation patch to use for JSON mode of conveying
diff filename. In this patch we move diff generation functions to UI.
In the process, I have cleaned up the code to reduce code and enable reuse.

Remove unused function get_profile_diff().

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


Acked-by: Christian Boltz <apparmor@cboltz.de>




[cboltz] Also adjust aa-mergeprof to the new function name/location

Acked-by: Seth Arnold <seth.arnold@canonical.com>
2017-10-26 00:34:40 +02:00
Goldwyn Rodrigues
4961fcb6ba Fix crash in serialize_profile_from_old_profile()
The crash was caused by the more strict ProfileStorage in bzr trunk
(older versions use hasher() which is more forgiving, but also very
 "useful" to hide quite some bugs)


Acked-by: Christian Boltz <apparmor@cboltz.de>
2017-10-25 21:54:57 +02:00
John Johansen
881cf7bddc Add python3.6 line to utils/logprof.conf
Author: Adam Conrad <adconrad@ubuntu.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
2017-10-23 08:02:38 -07:00
John Johansen
74178418ad Raises the self-test timeout to 4 minutes for really slow machines.
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=699774
Author: Kees Cook <kees@debian.org>
Signed-off-by: John Johansen <john.johansen@canonical.com>
2017-10-23 07:53:56 -07:00
intrigeri
a32a9aa6d1 Add python3.6 line to utils/logprof.conf.
Patch by Adam Conrad <adconrad@ubuntu.com>.
2017-10-23 16:31:25 +02:00
intrigeri
12fc3f0d4d Raise the self-test timeout to 4 minutes for really slow machines.
Original author: Kees Cook <kees@debian.org>

Fixes https://bugs.debian.org/699774.
2017-10-23 15:28:48 +02:00
Christian Boltz
1d896e014c Allow reading /etc/netconfig in abstractions/nameservice
/etc/netconfig is required by the tirpc library which nscd and several
other programs use.

References: https://bugzilla.opensuse.org/show_bug.cgi?id=1062244


Acked-by: Seth Arnold <seth.arnold@canonical.com> for 2.9, 2.10, 2.11 and trunk
2017-10-20 22:53:09 +02:00
Steve Beattie
76a8923ce4 libapparmor: fix swig test_apparmor.py for zero length ptrace records
The added testcase for a ptrace target with an empty string
(ptrace_garbage_lp1689667_1.in) was causing the swig python test script
to fail. The generated python swig record for libapparmor ends up
setting a number of fields to None or other values that indicate the
value is unset, and the test script was checking if the value in the
field didn't evaluate to False in a python 'if' test.

Unfortunately, python evaluates the empty string '' as False in 'if'
tests, resulting in the specific field that contained the empty string
to be dropped from the returned record. This commit fixes that by
special case checking for the empty string.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: John Johansen <john.johansen@canonical.com>
2017-10-18 16:54:56 -07:00
Christian Boltz
fce8d81d7f Fix save_profiles() for YaST
YaST has two issues in the "save changed profiles" dialog:
- when using "save selected", the list of profiles doesn't get updated.
  Update q.options inside the loop to fix this.
- the list of profiles is displayed as "["/usr/bin/foo", true]" instead
  of just "/usr/bin/foo". Use changed.keys() instead of changed to fix
  this. (text-mode aa-logprof doesn't change, it always displayed
  "/usr/bin/foo" and continues to do so.)

References: https://bugzilla.opensuse.org/show_bug.cgi?id=1062667 part a)


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

Note that 2.11 needs a slightly different patch (whitespace diff).
2017-10-12 13:27:47 +02:00
Steve Beattie
7ed6ad7254 Merge fixes to Indonesian translations from lp translations branch
Merge fixes from Christian to address conflicting apparmor-utils
hotkeys in the Indonesian translation. Plus the usual lp timestamp
update.

Acked-by: Steve Beattie <steve@nxnw.org>
2017-10-11 10:01:30 -07:00
Launchpad Translations on behalf of apparmor-dev
49ec85b4fa Launchpad automatic translations update. 2017-10-11 05:15:02 +00:00
Launchpad Translations on behalf of apparmor-dev
860c880454 Launchpad automatic translations update. 2017-10-10 05:13:52 +00:00
Steve Beattie
ec39158ce8 sync back with apparmor-master (pre-git conversion) 2017-10-09 15:51:28 -07:00
Steve Beattie
b926125618 Translations: merge updates from launchpad
Updates to the following translations:

  * binutils - add and update an entry to de.po
  * utils
    - de.po: add several entries
    - en_GB.po: add many entries
    - es.po: add non-existing(?) entry
    - id.po: add many entries
    - sv.po: update and add correct a number of entries

All other changes are the usual nonsense of launchpad updating
timestamps and export information.
2017-10-09 14:23:37 -07:00
John Johansen
112af14dd5 Remove the use of dbus from comments and policy from unix tests
Note one use of dbus is left because it is represnative of a unix
socket name used for communication with dbus

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2017-10-09 13:18:08 -07:00
Steve Beattie
f2831c875e merge from apparmor trunk 2017-10-05 16:52:55 -07:00
Vincas Dargis
630cb2a981 Allow seven digit pid 2017-09-30 15:28:15 +03:00
Christian Boltz
dd852138d6 Allow /var/run/dovecot/login-master-notify* in dovecot imap-login profiles
Acked-by: Seth Arnold <seth.arnold@canonical.com> for trunk, 2.11, 2.10 and 2.9.
2017-09-28 17:47:20 +02:00
Patrick Steinhardt
ca42518c1d parser: include <limits.h> for PATH_MAX macro
The macro `PATH_MAX` macro is typically defined in the <limits.h>
header by the system's libc implementation. While we do not
include it right now, glibc indirectly includes it via other
headers already and thus compilation of the file succeeds. For
other libc implementations this may not be the case, which would
then lead to a compilation error. This is the case for musl libc.

Explicitly include <limits.h> to fix this.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
2017-09-27 11:38:35 +02:00
Patrick Steinhardt
41c1e30e9b parser: fix compilation with missing RLIMIT macros
The define `RLIMIT_OFILE` is a historic macro originating from
the BSDs, which is nowadays an alias for `RLIMIT_NOFILE`. On some
implementations, it has thus been dropped in favor of the new
define, but we still assume it will always be defined in our
rlimit keywords table. Wrap it in an `ifdef` to fix compilation
on systems where it does not exist.

For the second macro `RLIMIT_RTTIME`, we do check for its
existence in our keywords table, but then forgot to do so in the
YACC rules. Wrap it into an `ifdef`, as well.

Both patches serve the goal to fix compilation on musl libc.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
2017-09-27 11:31:10 +02:00
Patrick Steinhardt
b973c9b473 libapparmor: do not use __BEGIN_DECLS/__END_DECLS macros
The macros __BEGIN_DECLS and __END_DECLS are not conforming to
any standard, but are a custom extension of the glibc library. As
such, it may not be available in other libc implementations, with
one example being musl libc. So compiling libapparmor won't work
with a strictly standards-conforming library.

These macros are typically used for header files which might be
included in a C++ project. Depending on whether the header is
seen by a C or C++ compiler, it will hint that functions have C
linkage. The macros themselves are rather simple:

#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else 
# define __BEGIN_DECLS
# define __END_DECLS
#endif

To fix compilation with musl libc, simply expand those macros to
explicitly use `extern "C"`. This is already used in other parts
of apparmor and should thus be safe to use.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
2017-09-27 11:26:51 +02:00
intrigeri
c79dd88edb apache2: use attach_disconnected
Otherwise we fail with:

   apparmor="ALLOWED" operation="file_mmap" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/apache2" name="" pid=13777 comm="apache2" requested_mask="rw" denied_mask="rw" fsuid=0 ouid=0

Patch by Guido Günther <agx@sigxcpu.org>.
2017-09-20 16:45:09 +02:00
John Johansen
40bf479666 Add the LSS and container con presentations for the last few years
Signed-off-by: John Johansen <john.johansen@canonical.com>
2017-09-16 23:51:08 -07:00
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
intrigeri
b64edfc92b abstractions/audio: allow read-only access to OpenAL's "head-related transfer function" data sets.
These files are used by OpenAL for better spatialization of sounds
when headphones are detected.

Bug and patch by Simon McVittie <smcv@debian.org>:
https://bugs.debian.org/874665
2017-09-10 09:09:10 +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