Commit graph

3842 commits

Author SHA1 Message Date
Launchpad Translations on behalf of apparmor-dev
17efc775cd Launchpad automatic translations update. 2017-02-22 05:32:03 +00:00
Launchpad Translations on behalf of apparmor-dev
c33b2bea09 Launchpad automatic translations update. 2017-02-21 05:29:27 +00:00
Launchpad Translations on behalf of apparmor-dev
79f41156e8 Launchpad automatic translations update. 2016-06-01 05:15:41 +00:00
Steve Beattie
abc3c22551 periodic translations branch sync-up with trunk 2016-05-24 13:13:09 -07:00
Steve Beattie
4d5a4675d8 translations: fix up msgfmt warnings
This commit touches up the .po files that generate warnings
when msgfmt processes them to create .mo files, at least with gettext
0.19.7-2ubuntu3 in Ubuntu 16.04 LTS. Example warning types cleaned up
include:

  ce.po:7: warning: header field 'Last-Translator' still has the initial default value
  ce.po:7: warning: header field 'Language' missing in header
  de.po:6: warning: header field 'Language-Team' still has the initial default value

This commit also fixes up po files where the Report-Msgid-Bugs-To:
field had not been updated, setting it with the email address
'AppArmor list <apparmor@lists.ubuntu.com>'

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2016-05-24 13:08:06 -07:00
Steve Beattie
ad65a4467e merge translations update from launchpad 2016-05-23 15:30:36 -07:00
Christian Boltz
e4cbcb4c85 Ignore file events with a request mask of 'send' or 'receive'
Those events are actually network events, so ideally we should map them
as such. Unfortunately this requires bigger changes, so here is a hotfix
that ignores those events and thus avoids crashing aa-logprof.

References: https://bugs.launchpad.net/apparmor/+bug/1577051
            https://bugs.launchpad.net/apparmor/+bug/1582374


Acked-by: Seth Arnold <seth.arnold@canonical.com> for trunk, 2.10 and 2.9
2016-05-23 23:31:43 +02:00
Christian Boltz
80bfb955ac [9/9] Add support for dbus events to aa-logprof
In detail, this means:
- handle ptrace events in logparser.py
- "translate" those events in aa.py - from log (logparser.py readlog())
  to prelog (handle_children()) to log_dict (collapse_log()))
- finally ask the user about the ptrace in ask_the_questions()
  (no code change needed there)

Note that these changes are not covered by tests, however they worked in
a manual test with the log examples in the libapparmor testsuite.
Unfortunately there's no example log for eavesdrop, so it might be a
good idea to a) add such a log line and b) test with it

Acked-by: Seth Arnold <seth.arnold@canonical.com>


Note: as discussed on #apparmor, I changed the mapping of peer_profile so
that it ends up in peer=(label=...) instead of the wrong peer=(name=...).
2016-05-23 23:24:30 +02:00
Christian Boltz
c91fd7688a [8/9] Add support for handling dbus rules everywhere
"Everywhere" means aa-mergeprof and aa-cleanprof. In theory also
aa-logprof, but that needs some code that parses dbus log events ;-)

Also add some dbus rules to the aa-cleanprof test profiles to ensure
superfluous dbus rules get deleted.


Acked-by: Seth Arnold <seth.arnold@canonical.com>
2016-05-23 23:21:13 +02:00
Christian Boltz
c32e4d8b84 [7/9] Remove the DBUS_Rule class
DBUS_Rule (in rules.py) was added in r2424 as a "this is how it should
look like" proof of concept, but was never used.

We have a "real" class for dbus rules now, so we can drop the proof of
concept class.


Also remove a commented, old version of RE_DBUS_ENTRY from aa.py


Acked-by: Seth Arnold <seth.arnold@canonical.com>
2016-05-23 23:19:59 +02:00
Christian Boltz
a293f066b5 [6/9] Use DbusRule and DbusRuleset
Change aa.py to use DbusRule and DbusRuleset in profile_storage,
parse_profile_data() and write_dbus. This also means we can drop the
now unused parse_dbus_rule() and write_dbus_rules() functions.

Raw_DBUS_Rule in rules.py is now also unused and can be dropped.


Also shorten the list of known-failing tests in
test-parser-simple-tests.py. Even if the list of removals doesn't look
too long, the generated_dbus/* removals mean 1989 tests now cause the
expected failures.

OTOH, I had to add 4 tests to the known-failing list:
- 3 tests with a "wrong" order of the conditionals which the parser
  accepts (which is slightly surprising, because usually we enforce the
  order of rule parts)
- one test fails because the path in the path= conditional doesn't start
  with / or a variable. Instead, it starts with an alternation, which
  wouldn't be allowed in file rules.

Those 4 failures need more investigation, but shouldn't block this
patchset.


Finally, adjust test-regex_matches.py to import RE_PROFILE_DBUS from
apparmor.regex instead of apparmor.aa.


Acked-by: Seth Arnold <seth.arnold@canonical.com>
2016-05-23 23:17:37 +02:00
Christian Boltz
e924168708 [5/9] Add tests for DbusRule and DbusRuleset
The tests include the two tests from test-dbus_parse.py, therefore
delete this file.

As usual, we have 100% coverage :-)

Also addd an explicit str() conversion to common_test.py to avoid
    TypeError: not all arguments converted during string formatting


Acked-by: Seth Arnold <seth.arnold@canonical.com>
2016-05-23 23:15:19 +02:00
Christian Boltz
3ebc9d9bb3 [4/9] Add support for dbus events in parse_event()
Add the dbus-specific details to the event data returned by parse_event().


Acked-by: Seth Arnold <seth.arnold@canonical.com>
2016-05-23 23:14:09 +02:00
Christian Boltz
3e1ef00d47 [3/9] Add DbusRule and DbusRuleset classes
Those classes will be used to parse and handle dbus rules.
They understand the syntax of dbus rules.

Note that get_clean() doesn't output superfluos things, so
  dbus ( send ),
will become
  dbus send,


Acked-by: Seth Arnold <seth.arnold@canonical.com>
2016-05-23 23:13:19 +02:00
Christian Boltz
18b5894888 [2/9] Add strip_parenthesis() to regex.py
Some dbus rule conditionals come with optional parenthesis. Instead of
making the regex even more complicated, use a small function to strip
those parenthesis.

Also add some tests for strip_parenthesis() to test-regex.py.


Acked-by: Kshitij Gupta <kgupta8592@gmail.com>
2016-05-23 23:12:07 +02:00
Christian Boltz
2e2aa861d2 [1/9] add a named match group to RE_PROFILE_DBUS
As a preparation for the DbusRule class, add a <details> match group
to RE_PROFILE_DBUS.

Also adjust test-regex_matches.py for the added group.

Note: RE_PROFILE_DBUS is only used in aa.py, and only matches[0..2]
are used. 0 and 1 are audit and allow/deny and 2 is and stays the whole
rule (except audit and allow/deny). Therefore no aa.py changes are
needed.


Acked-by: Kshitij Gupta <kgupta8592@gmail.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2016-05-23 23:10:48 +02:00
Christian Boltz
bdf5a2facc Document empty quotes ("") as empty value of a variable
Acked-by: Seth Arnold <seth.arnold@canonical.com> for all branches where this makes sense :)
2016-05-22 14:51:19 +02:00
Christian Boltz
08471c5b08 allow inet6 in ping profile
The latest iputils merged ping and ping6 into a single binary that does
both IPv4 and IPv6 pings (by default, it really does both).
This means we need to allow network inet6 raw in the ping profile.

References: https://bugzilla.opensuse.org/show_bug.cgi?id=980596
            (contains more details and example output)


Acked-by: Steve Beattie <steve@nxnw.org> for trunk, 2.10 and 2.9
2016-05-18 21:18:10 +02:00
Christian Boltz
472d534a0d test-translations.py: add two button sets used in aa-mergeprof
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2016-05-14 13:25:15 +02:00
Seth Arnold
d3774684c0 dbus-session-strict: allow access to the user bus socket
From: Simon McVittie <simon.mcvittie@collabora.co.uk>
Date: Wed, 4 May 2016 13:48:36 +0100
Subject: dbus-session-strict: allow access to the user bus socket

If dbus is configured with --enable-user-bus (for example in the
dbus-user-session package in Debian and its derivatives), and the user
session is started with systemd, then the "dbus-daemon --session" will be
started by "systemd --user" and listen on $XDG_RUNTIME_DIR/bus. Similarly,
on systems where dbus-daemon has been replaced with kdbus, the
bridge/proxy used to provide compatibility with the traditional D-Bus
protocol listens on that same socket.

In practice, $XDG_RUNTIME_DIR is /run/user/$uid on all systemd systems,
where $uid represents the numeric uid. I have not used /{var/,}run here,
because systemd does not support configurations where /var/run and /run
are distinct; in practice, /var/run is a symbolic link.

Based on a patch by Sjoerd Simons, which originally used the historical
path /run/user/*/dbus/user_bus_socket. That path was popularized by the
user-session-units git repository, but has never been used in a released
version of dbus and should be considered unsupported.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2016-05-11 16:01:41 -07:00
Seth Arnold
5781ad05aa syscall_sysctl test: correctly skip if CONFIG_SYSCTL_SYSCALL=n
From: Simon McVittie <simon.mcvittie@collabora.co.uk>
Date: Wed, 11 May 2016 13:52:56 +0100
Subject: syscall_sysctl test: correctly skip if CONFIG_SYSCTL_SYSCALL=n

This test attempts to auto-skip the sysctl() part if that syscall
was not compiled into the current kernel, via
CONFIG_SYSCTL_SYSCALL=n. Unfortunately, this didn't actually work,
for two reasons:

* Because "${test} ro" wasn't in "&&", "||", a pipeline or an "if",
  and it had nonzero exit status, the trap on ERR was triggered,
  causing execution of the error_handler() shell function, which
  aborts the test with a failed status. The rules for ERR are the
  same as for "set -e", so we can circumvent it in the same ways.
* Because sysctl_syscall.c prints its diagnostic message to stderr,
  but the $() operator only captures stdout, it never matched
  in the string comparison. This is easily solved by redirecting
  its stderr to stdout.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2016-05-11 15:52:58 -07:00
Christian Boltz
f6d2ef85f5 load variables in ask_the_questions()
Variables can be used in several rule types (from the existing *Rule
classes: change_profile, dbus, ptrace, signal). It seems nobody uses
variables with those rules, otherwise we'd have received a bugreport ;-)

I noticed this while working on FileRule, where usage of variables is
more common. The file code in bzr (not using a *Rule class) already
loads the variables, so old versions don't need changes for file rule
handling.

However, 2.10 already has ChangeProfileRule and therefore also needs
this fix.


Acked-by: Seth Arnold <seth.arnold@canonical.com> for trunk and 2.10.
2016-05-10 14:32:46 +02:00
Christian Boltz
b7449494de Run utils tests with C locale
While running test-translations.py with the fixed german translations,
I noticed that I still get errors about hotkey conflicts

It turned out that test-translations.py reads the system-wide
apparmor-utils.mo in addition to the in-tree translations.
(I have the 2.11 beta1 translations installed, which contain hotkey
conflicts for the german translations).

This is surprising because test-translations.py explicitely sets the
locale path. Interestingly, this happens only 4 times (checked with a
temp profile with audit for those files) while test-translations.py has
9 tests).

(Any idea if this behaviour is normal or a bug?)


This patch adds LC_ALL=C to the make check and make coverage commandline
so that the system-wide translations don't get used.

I checked with a modified de.po that in-tree hotkey conflicts still get
detected.


Acked-by: Seth Arnold <seth.arnold@canonical.com>
2016-05-10 14:31:25 +02:00
Launchpad Translations on behalf of apparmor-dev
584f63d56b Launchpad automatic translations update. 2016-05-07 04:31:30 +00:00
Christian Boltz
a1e4212d12 Add a test to check for hotkey conflicts
This test builds and installs the apparmor-utils translations into a
tempdir, and then checks if there's any hotkey conflict in one of the
languages. This is based on a manually maintained list of "buttons" that
are displayed at the same time.

To make things a bit easier to test, add CMD_CANCEL to ui.py CMDS[].
Also replace hardcoded usage of '(Y)es', '(N)o' and '(C)ancel' with
CMDS['CMD_YES'], CMDS['CMD_NO'] and CMDS['CMD_CANCEL'].



Acked-by: Seth Arnold <seth.arnold@canonical.com>
2016-05-06 22:19:34 +02:00
Christian Boltz
e4219861e6 accept hostname with dots
Some people have the full hostname in their syslog messages, so
libapparmor needs to accept hostnames that contain dots.


References: https://bugs.launchpad.net/apparmor/+bug/1453300 comments
            #1 and #2 (the log samples reported by scrx in #apparmor)



Acked-by: Seth Arnold <seth.arnold@canonical.com>
Acked-by: John Johansen <john.johansen@canonical.com>
for trunk, 2.10 and 2.9.
2016-05-05 11:57:57 +02:00
Seth Arnold
43cc512e51 Simon Deziel 2016-04-29 usr.sbin.sshd: allow reading blacklisted host keys 2016-04-29 14:55:00 -07:00
Simon Deziel
6bdd2c34dc usr.sbin.sshd: allow reading blacklisted host keys 2016-04-29 14:25:53 -04:00
Launchpad Translations on behalf of apparmor-dev
47aa6baad3 Launchpad automatic translations update. 2016-04-29 05:14:00 +00:00
Launchpad Translations on behalf of apparmor-dev
99d189d8e2 Launchpad automatic translations update. 2016-04-22 05:13:38 +00:00
Simon Deziel
5931538103 usr.sbin.sshd: deny net_admin that is not strictly required
Matthew Dawson explained why:

> sshd doesn't actually require the net_admin capability. libpam-systemd tries
> to use it if available to set the send/receive buffers size, but will fall
> back to a non-privileged version if it fails.

https://lists.ubuntu.com/archives/apparmor/2016-April/009586.html
2016-04-21 17:58:04 -04:00
John Johansen
22738991ac Fix: parser: incorrect output of child profile names
BugLink: http://bugs.launchpad.net/bugs/1551950

The apparmor_parser is incorrectly outputting the names of child profiles
and hats, by adding a : between the parent and the child profile name

  Eg.
    /usr/sbin/httpd{,2}-prefork
    /usr/sbin/httpd{,2}-prefork://DEFAULT_URI
    /usr/sbin/httpd{,2}-prefork://HANDLING_UNTRUSTED_INPUT

  instead of what it should be
    /usr/sbin/httpd{,2}-prefork
    /usr/sbin/httpd{,2}-prefork//DEFAULT_URI
    /usr/sbin/httpd{,2}-prefork//HANDLING_UNTRUSTED_INPUT

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2016-04-18 13:26:53 -07:00
Seth Arnold
c9f254610b Simon Deziel 2016-04-14 abstractions/user-mail: /var/mail/* should only be accessible to their owners 2016-04-14 14:42:37 -07:00
Simon Deziel
2829aaf87b abstractions/user-mail: /var/mail/* should only be accessible to their owners 2016-04-14 15:15:36 -04:00
Seth Arnold
341143c956 Merge samba fixes from Simon Deziel 2016-04-13 11:12:44 -07:00
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
Simon Deziel
cb011cd974 usr.sbin.sshd: remove commented-out hat related rules 2016-04-05 15:47:54 -04:00
Simon Deziel
3c21cd8a40 usr.sbin.sshd: allow ptrace tracing to cope with recent kernel/AA changes 2016-04-05 15:46:26 -04:00
Simon Deziel
aedce34542 usr.sbin.sshd: add cgroup-related rules 2016-04-05 15:46:05 -04: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