Commit graph

3798 commits

Author SHA1 Message Date
Simon Deziel
c68d1b5795 usr.sbin.smbd: new lock dir used by recent versions (4.3.8) 2016-04-13 09:24:46 -04:00
Simon Deziel
245dd9b1b9 usr.sbin.smbd: give access to multiarch libs 2016-04-13 09:23:07 -04:00
Simon Deziel
9e680bd14f usr.sbin.smbd: sys_admin is needed when forcing ownership 2016-04-13 09:20:14 -04:00
Simon Deziel
0255afc67b usr.sbin.smbd: audit_write is needed when forcing perms 2016-04-13 09:19:51 -04:00
Tyler Hicks
184e2f8df8 profiles: Add attach_disconnected flag to dnsmasq profile
https://launchpad.net/bugs/1569316

When Ubuntu made the jump from network-manager 1.0.4 to 1.1.93, the
dnsmasq process spawned from network-manager started hitting a
disconnected path denial:

  audit: type=1400 audit(1460463960.943:31702): apparmor="ALLOWED"
    operation="connect" info="Failed name lookup - disconnected path"
    error=-13 profile="/usr/sbin/dnsmasq"
    name="run/dbus/system_bus_socket" pid=3448 comm="dnsmasq"
    requested_mask="wr" denied_mask="wr" fsuid=65534 ouid=0

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2016-04-12 16:36:43 -05:00
John Johansen
26b3bc5799 Enable dynamically scaling max jobs if new resources are brought online
BugLink: http://bugs.launchpad.net/bugs/1566490

This patch enables to parser to scale the max jobs if new resources are
being brought online by the scheduler.

It only enables the scaling check if there is a difference between the
maximum number of cpus (CONF) and the number of online (ONLN) cpus.

Instead of checking for more resources regardless, of whether the online
cpu count is increasing it limits its checking to a maximum of
MAX CPUS + 1 - ONLN cpus times. With each check coming after fork spawns a
new work unit, giving the scheduler a chance to bring new cpus online
before the next check.  The +1 ensures the checks will be done at least
once after the scheduling task sleeps waiting for its children giving
the scheduler an extra chance to bring cpus online.

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2016-04-11 16:22:12 -07:00
Christian Boltz
8b271d00d0 merge lp:~sdeziel/apparmor/dnsmasq-lxd-bridge:
Simon Deziel 2016-04-08 usr.sbin.dnsmasq: add lxd-bridge rules


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

References: https://bugs.launchpad.net/ubuntu/+source/apparmor/+bug/1566944
2016-04-09 00:24:13 +02:00
Simon Deziel
3d6843d975 usr.sbin.dnsmasq: add lxd-bridge rules 2016-04-08 16:23:47 -04:00
Christian Boltz
3e51e656b6 dovecot/auth: allow access to /var/run/dovecot/stats-user
Since the latest openSUSE Tumbleweed update (dovecot 2.2.21 -> 2.2.22),
dovecot/auth writes to /var/run/dovecot/stats-user.


Acked-by: Seth Arnold <seth.arnold@canonical.com> for trunk, 2.10 and 2.9.
2016-04-07 00:53:06 +02:00
Tyler Hicks
e815226675 parser: Fix dependency in Makefile
parser 'make install' failed if 'make' wasn't run before. This patch
adds the missing dependency 'install-indep: indep'.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2016-04-06 12:23:48 -05:00
Christian Boltz
cd38c9d111 Fix dependency in binutils Makefile
binutils 'make install' failed if 'make' wasn't run before.
This patch adds the missing dependency 'install-indep: indep'


Acked-by: Seth Arnold <seth.arnold@canonical.com>
2016-04-05 22:38:42 +02:00
Christian Boltz
425b76f3f1 Move binutils manpages to section 1
The binutils (aa-enabled and aa-exec) get installed into /usr/bin/ and
are meant to be used by non-root users. Therefore the manpages should be
in section 1 instead of 8 (which is for sysadmin commands).


Acked-by: Seth Arnold <seth.arnold@canonical.com>
2016-04-05 21:15:14 +02:00
Tyler Hicks
e313eb5d1f tests: Allow stacking tests to use system programs and libraries
The stacking tests worked fine when using in-tree programs and libraries
but the tests unexpectedly failed when USE_SYSTEM=1 was specified. This
patch makes use of the addimage:$test argument to mkprofile.pl to
generate the correct file permissions needed to use the system binaries.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
2016-03-29 11:17:53 -05:00
Christian Boltz
733d5faa78 Don't store exec modes in transtions[]
exec choices are stored in transitions[], but that's never used
(and I don't see a need for it), therefore stop storing it.


Note: hat choices (CMD_ADDHAT, CMD_USEDEFAULT and CMD_DENY) get still
stored in transitions[], and that information is used if the same hat
name appears again.


Acked-by: Steve Beattie <steve@nxnw.org>
2016-03-29 12:58:15 +02:00
Christian Boltz
86017c770d Update abstractions/ssl_* for acmetool-generated certificates
acmetool is an alternative client for Let's Encrypt.
(https://github.com/hlandau/acme/)

It stores the certificates etc. in the following directory layout:

    /var/lib/acme/live/<domain> -> ../certs/<hash>
    /var/lib/acme/certs/<hash>/cert
    /var/lib/acme/certs/<hash>/chain
    /var/lib/acme/certs/<hash>/privkey -> ../../keys/<hash>/privkey
    /var/lib/acme/certs/<hash>/url
    /var/lib/acme/certs/<hash>/fullchain
    /var/lib/acme/keys/<hash>/privkey

This patch adds the needed permissions to the ssl_certs and ssl_keys
abstractions so that the certificates can be used.


Acked-by: Seth Arnold <seth.arnold@canonical.com> for trunk, 2.10 and 2.9.
2016-03-28 21:42:39 +02:00
Steve Beattie
3fb3b1054b Merge JSON output options for aa-status.
Thanks to Max Timchenko <maxvt@pagerduty.com> for the patch.

Acked-by: Steve Beattie <steve@nxnw.org>
2016-03-25 12:18:52 -07:00
Tyler Hicks
f82344d7ff parser: Allow debugedit to work on apparmor_parser
https://launchpad.net/bugs/1561939

The debugedit program is unable to cope with the extra slash in the
LIBAPPARMOR_SRC variable.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Suggested-by: Christian Svensson <blue@cmd.nu>
2016-03-25 10:28:52 -05:00
Tyler Hicks
7c142666db tests: Adjust stacking tests build check for 2.11 Beta 1 release
I configured the stacking test binary to only be built when libapparmor
2.11 is present. The versioning of the 2.11 Beta 1 release (2.10.95)
causes that check to fail and the stacking tests to not be used.

This patch adjusts the libapparmor version check to be aware of the 2.11
Beta 1 versioning.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2016-03-24 11:59:11 -05:00
Max Timchenko
cefadd8da1 Add a JSON output option to aa-status
Automated infrastructure management tools, such as Chef, Puppet, and so
on, could use a way to check AppArmor status that is both high-level
(meaning it does not rely on kernel interfaces in /proc) and machine-
readable (meaning it does not require the complexity of parsing output 
of tools originally intended for human consumption).

Adding a JSON variant of the standard aa-status output achieves both.
2016-03-24 10:59:45 -04:00
Christian Boltz
fa35aaa1c4 nscd profile: allow paranoia mode
In /etc/nscd.conf there is an option allowing to restart nscd after a
certain time. However, this requires reading /proc/self/cmdline -
otherwise nscd will disable paranoia mode.


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


Acked-By: Jamie Strandboge <jamie@canonical.com> for trunk, 2.10 and 2.9
2016-03-21 21:30:19 +01:00
Steve Beattie
95321544b1 Merge utils/ DE translations from Launchpad. 2016-03-19 04:06:57 -07:00
Steve Beattie
8a03fe54dc Update version in preparation for 2.11 beta release (aka 2.10.95) 2016-03-19 04:05:21 -07:00
Steve Beattie
4dcfa7db35 parser: eliminate redundant/dead code
The debugging code for profile entries contains a check to ensure that
it's not NULL, but the list iterator macro already ensures that the
iteration will stop if the item is NULL, making the check redundant.

Coverity CID #55983

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Tyler Hicks <tyhicks@canonical.com>
2016-03-19 01:52:45 -07:00
Steve Beattie
90b352c2ae Subject: libapparmor: don't close invalid fd
It's possible to end up unreferencing a kernel_interface object that
has ->dirfd set to -1. This patch avoids calling close(2) on that fd.
(close(-1) will just return EBADF anyway.)

Coverity CIDs #55996 and #55997

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Tyler Hicks <tyhicks@canonical.com>
2016-03-19 01:51:00 -07:00
Steve Beattie
e69891c222 man page touchups
This makes some of the references to functions in the aa_query_label(2)
manpage more consistent and fixes a couple of grammar issues. It also
tries to make the qualifying statements in apparmor.d(5) more distinct,
and also fixes some typos there as well.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Tyler Hicks <tyhicks@canonical.com>
2016-03-19 01:48:11 -07:00
Steve Beattie
fd8ccd3dd7 tests: support more complex change_profile tests
This adds support to the profile generator script for change_profile
rules, giving the ability to write the 3 factor version of the rule
(e.g. "change_profile /t -> A_PROFILE") which was significantly more
difficult using straight raw rules, which is why we don't have any 3
factor rule tests.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Tyler Hicks <tyhicks@canonical.com>
2016-03-19 01:39:07 -07:00
Steve Beattie
37f5eab9b1 tests: onexec test needs signal permission to stop itself
Now that the onexec test program notices that it failed to send SIGSTOP
to itself, causing a whole bunch of tests to be detected as failing,
grant the ability to send and receive signals to the onexec tests.
(The onexec tests are not tests intended to verify signal mediation.)

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Tyler Hicks <tyhicks@canonical.com>
2016-03-19 01:37:46 -07:00
Steve Beattie
0e2bbc98b8 tests: onexec - check and report signal failure
The onexec test was ignoring errors from the kill() call, so it didn't
notice when it had failed to send SIGSTOP to itself.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Tyler Hicks <tyhicks@canonical.com>
2016-03-19 01:35:42 -07:00
Steve Beattie
b6e42015a6 tests: check for early task exit in onexec tests
Based on a patch by John Johansen <john.johansen@canonical.com>

(I converted the check to look for the process directory in /proc
rather than sending signal 0 to the task, as John had done in a patch
sent to me, to prevent failures in signal delivery from blocking the
check from working correctly.)

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Tyler Hicks <tyhicks@canonical.com>
2016-03-19 01:34:18 -07:00
Steve Beattie
91022dae85 tests: add more details when reporting onexec failures
Based on a patch by John Johansen <john.johansen@canonical.com>

Add more details to the checks in the regression tests onexec tests,
to make debugging failures easier. Also, use more local variables
to indicate what and how many arguments are expected to the onexec
check_* functions.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Tyler Hicks <tyhicks@canonical.com>
2016-03-19 01:32:40 -07:00
Tyler Hicks
c8fe0b2518 profiles: Allow CAP_CHOWN in usr.lib.apache2.mpm-prefork.apache2
https://launchpad.net/bugs/1210514

It looks plausible to me that prefork_open_logs() ->
ap_proc_mutex_create() -> ap_unixd_set_proc_mutex_perms() -> chown().

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
2016-03-19 03:10:00 -05:00
Tyler Hicks
f16e6ad89a profiles: Add deluge-{gtk,console} to ubuntu-bittorrent-clients abstraction
https://launchpad.net/bugs/1501913

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
2016-03-19 03:08:52 -05:00
Tyler Hicks
e9f8ba9e3b libapparmor: prepare libtool versioning for impending 2.11 release
The aa_stack_profile() and aa_stack_onexec() functions were added to
libapparmor since 2.10.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
2016-03-19 03:03:18 -05:00
Tyler Hicks
a23dd56e03 parser: Update features.all file for new kernel features
The audit_read capability, mpls address family, and profile stacking are
all new features advertised by the latest AppArmor kernel features file.

Without this change, the parser tests will fail because parsing profiles
that utilize stacking results in an error when the features file
indicates that stacking is not supported by the kernel.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
2016-03-19 03:03:18 -05:00
Tyler Hicks
cdbe3f088b tests: Conditionalize when to build/run stacking tests
The stacking test binary links against libapparmor for
aa_stack_profile() and aa_stack_onexec(), which will be present in 2.11.
This means that regression test builds using the system libapparmor
should not build the stacking test binary unless the libapparmor 2.11 or
newer is present.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
2016-03-19 03:03:18 -05:00
Tyler Hicks
6050d110e1 tests: Mark cross policy ns changeprofile test as xpass on older kernels
Policy namespaces are not well supported in older parsers and kernels.
This is a case where the kernel support doesn't seem to be working.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
2016-03-19 03:03:18 -05:00
Tyler Hicks
fc4941d6b0 tests: Add exec_stack regression tests
Add tests for px stacking transitions.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
2016-03-19 03:03:06 -05:00
Tyler Hicks
86cf1c7b22 tests: Add stackonexec regression tests
Add tests for the aa_stack_onexec() libapparmor function.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
2016-03-19 02:29:22 -05:00
Tyler Hicks
04d1f17445 tests: Add stackprofile regression tests
Add tests for the aa_stack_profile() libapparmor function.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
Bug: https://launchpad.net/bugs/1507469
2016-03-19 01:45:13 -05:00
Tyler Hicks
e7d21c1cf8 tests: Create a program for stacking tests to use
Stacking is a complex feature and, in order to sufficiently test all
aspects of stacking, a relatively complex test program is needed.

This patch adds a program that can call
aa_stack_onexec()/aa_stack_profile(), perform file IO on a given file
path, verify that the current confinement context is what it is expected
to be, and/or execute itself or another program.

The confinement context verification can handle stacked labels with any
ordering.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
2016-03-19 01:44:51 -05:00
Tyler Hicks
e9895c70aa tests: Clean up do_open() in changehat.h
Some tidying up is needed in order to reuse do_open(). This patch
eliminates the chance of returning 0 due to errno being not set. It also
adjusts the file string to be const.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
2016-03-19 01:02:51 -05:00
Tyler Hicks
5ae1275eec tests: Add changeprofile regression tests for stacking
The idea is that the $test profile grants $file access and the
$othertest profile grants $subfile access. Both profiles grant
$stacktest access. The tests verify that after changing to the stacked
$othertest//&$test profile, only $stacktest can be accessed.

Similar tests are also added for stacking with a namespaced profile.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
2016-03-19 01:02:51 -05:00
Launchpad Translations on behalf of apparmor-dev
a5b8ebebb4 Launchpad automatic translations update. 2016-03-19 05:19:32 +00:00
Tyler Hicks
974e2a693b tests: Adjust expected errno upon aa_change_profile() failure
The kernel patches that implement AppArmor profile stacking made changes
that allow the the backed for change_profile to detect if the target
profile does not exist prior to checking if the current profile allows
the change_profile.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: John Johansen <john.johansen@canonical.com>
2016-03-18 17:28:51 -05:00
Tyler Hicks
1a7663e89a parser: Check kernel stacking support when handling stacked transitions
Check if the current kernel supports stacking. If not, ensure that named
transitions (exec, change_profile, etc.) do not attempt to stack their
targets.

Also, set up the change_profile vector according to whether or not the
kernel supports stacking. Earlier kernels expect the policy namespace to
be in its own NUL-terminated vector element rather than passing the
entire label (namespace and profile name) as a single string to the
kernel.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2016-03-18 17:28:51 -05:00
Tyler Hicks
00fb4e94ab parser: Support stacking in exec and change_profile rules
Allow for a leading '&' character to be present in the named transition
target strings to indicate that the transition should stack the current
profile with the specified profile.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: John Johansen <john.johansen@canonical.com>
2016-03-18 17:28:51 -05:00
Tyler Hicks
a83d03a6a7 parser: Stop splitting the namespace from the named transition targets
The parser was splitting up the namespace and profile name from named
transition targets only to rejoin it later when creating the binary
policy. This complicated the changes needed to support the stacking
identifier '&' in named transition targets.

To keep the stacking support simple, this patch keeps the entire named
transition target string intact from initial profile parsing to writing
out the binary.

All of these changes are straightforward except the hunk that removes
the namespace string addition to the vector in the process_dfa_entry()
function. After speaking with John, kernels with stacking have support
for consuming the namespace with the profile name.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: John Johansen <john.johansen@canonical.com>
2016-03-18 17:28:51 -05:00
Tyler Hicks
a49c988c03 parser: Create a label parsing function that doesn't exit or malloc
This patch separates the label parsing functionality from the program
termination and memory allocation duties of parse_label(). This will
ultimately help in creating simple helper functions that simply need to
check if a label contains a namespace.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: John Johansen <john.johansen@canonical.com>
2016-03-18 17:28:51 -05:00
Tyler Hicks
280b6107a6 parser: parser clean up add_named_transition()
The add_named_transition function was written in a way that is difficult
to understand while attempting to read the function. This patch attempts
to clean it up.

First, this patch removes this confusing code flow issue:

  if (!entry->ns) { ... }
  if (entry->ns) { ... } else { ... }

It then unifies the way that the ns and nt_name strings of the cod_entry
struct are handled prior to calling add_entry_to_x_table() and/or
returning. ns and nt_name are now guaranteed to be NULL before
performing either of those actions.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: John Johansen <john.johansen@canonical.com>
2016-03-18 17:28:50 -05:00
Tyler Hicks
f8535c1d09 parser: Copy the named transition when copying a cod_entry
The copy_cod_entry() function was not copying the nt_name field of the
cod_entry struct.

This was discovered during code review and I'm not certain if it causes
any real world bugs.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: John Johansen <john.johansen@canonical.com>
2016-03-18 17:28:50 -05:00