Commit graph

4874 commits

Author SHA1 Message Date
John Johansen
63cb46d20a library: fix dirat_for_each2() fd handling
The function was messing up its use of fds, it could get away with
it because the cb_dirfd passed to fdopendir was still valid until
closedir was called but if code was moved around, or fdopendir
code changed behavior it could easily break.

Also the check for dup failing was wrong fix it.

Reference: coverity #187003

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Time-out
2018-10-01 09:16:32 -07:00
Christian Boltz
a03badd822 Merge branch 'kde-qt5' into 'master'
Include qt5 into kde abstraction

See merge request apparmor/apparmor!209

Acked-by: Christian Boltz <apparmor@cboltz.de> for master and backporting to 2.10..2.13 (as soon as the qt5 abstraction is backported)
2018-09-30 17:43:04 +00:00
nl6720
6d670a3ca9 usr.sbin.dnsmasq: add /srv/tftp 2018-09-30 13:55:44 +03:00
Vincas Dargis
bd33cdd19a Include qt5 into kde abstraction
Currently, kde abstraction has rules relevant to Qt 3 and Qt 4
libraries, but are missing rules against latest Qt 5.

Include read-only Qt 5 abstraction to fix styling and similar issues for
software running on KDE 5 desktop.

Fixes https://bugs.launchpad.net/apparmor/+bug/1787201
2018-09-30 13:03:59 +03:00
John Johansen
395aed7259 Merge branch 'uid' into 'master'
Add uid and uids kernel var placeholders

Add @{uid} and @{uids} variables to allow migrating profiles in advance while awaiting path mediation implementation, based on current user id, in kernel side.

See merge request apparmor/apparmor!208

Acked-by: John Johansen <john.johansen@canonical.com>
2018-09-29 18:08:17 +00:00
Vincas Dargis
cba10db7e7 Add uid and uids kernel var placeholders
Add @{uid} and @{uids} variables to allow migrating profiles in advance
while awaiting path mediation implementation, based on current user id,
in kernel side.
2018-09-29 17:43:13 +03:00
Jamie Strandboge
141c2c1c47 Merge branch 'harden-abstractions-part-ii' into 'master'
Harden abstractions part ii

See merge request apparmor/apparmor!206
2018-09-27 20:25:57 +00:00
Jamie Strandboge
6e014ab8a9 similar change for user-files 2018-09-27 15:11:54 -05:00
Jamie Strandboge
bbe0f9af78 private-files{,-strict}: disallow writes to parent dirs too 2018-09-27 14:42:14 -05:00
Emerson Bernier
afdd4f2189 abstractions/private-files: disallow access to the dirs of private files
Reference:
https://launchpad.net/bugs/1794820
2018-09-27 19:07:21 +00:00
John Johansen
495c4ff30e Merge branch 'ubuntu-email-thunderbird' into 'master'
ubuntu-email: allow running Thunderbird wrapper script

See merge request apparmor/apparmor!204
2018-09-27 18:54:03 +00:00
Vincas Dargis
cee9527fa8 ubuntu-email: allow running Thunderbird wrapper script
gio-launch-desktop helper tries to execute /usr/bin/thunderbird wrapper
script, not the /usr/lib/thunderbird... directly.

Add rule allowing to execute /usr/bin/thunderbird.
2018-09-27 21:04:32 +03:00
John Johansen
63ffb8ea64 Merge branch 'harden-abstractions' into 'master'
Harden abstractions

 Harden abstractions

    remove antiquated abstractions/launchpad-integration
    abstractions/opencl-nvidia: don't allow PUx on nvidia-modprobe
    abstractions/private-files-strict: disallow access to the dirs of private files
    abstractions/private-files: disallow writes to thumbnailer dir (LP: #1788929)
    ubuntu-browsers.d/user-files: disallow access to the dirs of private files

Nominating launchpad-integration and opencl-nvidia for 2.13. Nominating private-files-strict, private-files and user-files for 2.10 and higher

See merge request apparmor/apparmor!203

Acked-by: John Johansen <john.johansen@canonical.com>
2018-09-27 17:32:47 +00:00
Jamie Strandboge
5efd257585 we don't need to adjust keyring**. Thanks cboltz 2018-09-27 12:13:04 -05:00
Jamie Strandboge
ea2429dab5 ubuntu-browsers.d/user-files: disallow access to the dirs of private files 2018-09-27 12:09:09 -05:00
Jamie Strandboge
503d2904dc abstractions/private-files: disallow writes to thumbnailer dir (LP: #1788929) 2018-09-27 11:56:09 -05:00
Jamie Strandboge
d1937093f7 abstractions/private-files-strict: disallow access to the dirs of private files
Reference:
https://launchpad.net/bugs/1794820
2018-09-27 11:55:37 -05:00
Jamie Strandboge
8f9bd5b0e3 abstractions/opencl-nvidia: don't allow PUx on nvidia-modprobe 2018-09-27 11:38:51 -05:00
Jamie Strandboge
ae771b475a remove antiquated abstractions/launchpad-integration 2018-09-27 11:29:11 -05:00
Christian Boltz
072d3e0451
Add basic support for abi rules to the tools
Add basic "understand and keep" support for abi rules, where
"understand" means to not error out when seeing an abi rule, and "keep"
simply means to keep the original abi rule when serializing a profile.

On the long term, abi rules should be parsed (similar to include rules),
but for now, this patch is the smallest possible changeset and easy to
backport.

Note that the only added test is via cleanprof_test.* which is used by
minitools_test.py - and does _not_ run if you do a 'make check'.
Oh, and of course the simple_tests/abi/ files also get parsed by
test-parser-simple-tests.py.

Also note that serialize_profile_from_old_profile() (which no longer
exists in master, "only" in <= 2.13) would in theory also need support
for abi rules. In practise, making this another case of
"serialize_profile_from_old_profile() has known issues" is probably
fine, but we should at least test that "(V)iew changes" doesn't break if
an abi rule is present.
2018-09-26 22:09:17 +02:00
Christian Boltz
7e22b0a894 Merge branch 'zsh' into 'master'
add zsh to logprof.conf

See merge request apparmor/apparmor!201

Acked-by: Christian Boltz <apparmor@cboltz.de> for 2.10..master
2018-09-24 17:34:56 +00:00
Emerson Bernier
00871696f1 add zsh to logprof.conf 2018-09-24 16:51:11 +00:00
John Johansen
bfd5445870 Revert "Update ubuntu-email for launching Thunderbird wrapper script"
This reverts commit ab7459ed40.

This commit was meant to go to a branch to setup a merge request in
gitlab. Revert until the commit has gone through the regular review
process.

Signed-off-by: John Johansen <john.johansen@canonical.com>
2018-09-24 03:01:46 -07:00
Vincas Dargis
ab7459ed40 Update ubuntu-email for launching Thunderbird wrapper script 2018-09-21 16:46:48 +00:00
John Johansen
cac5a5d293 Merge branch 'cboltz-more-useful-simple-test-output' into 'master'
make simple.pl / parser make check output more useful

Instead of printing the (useless) numbers of no-longer-failing tests
marked as TODO, let prove print out the actual test names.

A side effect is that really unfixed TODOs and disabled tests get
printed (lists about 10 tests), but that's much better than having to
hunt down the no-longer-failing TODOs.

This change will print out lines like (the first one is still a TODO,
the second one got fixed at some time)

not ok 71447 - TODO: ./simple_tests//vars/vars_profile_name_13.sd: reference variables that are the profile name and attachment # TODO Unfixed testcase.

ok 71448 - TODO: ./simple_tests//vars/vars_profile_name_14.sd: reference variables in rules that also have alternations # TODO Unfixed testcase.
before printing the test summary.

I propose this patch for master and (optionally) the maintained branches.

See merge request apparmor/apparmor!194

Acked-by: John Johansen <john.johansen@canonical.com>
2018-09-19 06:42:37 +00:00
Christian Boltz
e9b25c4969
make simple.pl / parser make check output more useful
Instead of printing the (useless) numbers of no-longer-failing tests
marked as TODO, let `prove` print out the actual test names.

A side effect is that really unfixed TODOs and disabled tests get
printed (lists about 10 tests), but that's much better than having to
hunt down the no-longer-failing TODOs.

This change will print out lines like (the first one is still a TODO,
the second one got fixed at some time)

```
not ok 71447 - TODO: ./simple_tests//vars/vars_profile_name_13.sd: reference variables that are the profile name and attachment # TODO Unfixed testcase.
ok 71448 - TODO: ./simple_tests//vars/vars_profile_name_14.sd: reference variables in rules that also have alternations # TODO Unfixed testcase.
```

before printing the test summary.
2018-09-18 21:42:14 +02:00
John Johansen
884041605c Merge branch 'profile-usr.sbin.ntpd' into 'master'
usr.sbin.ntpd: add openntpd drift and socket files

See merge request apparmor/apparmor!192

Acked-by: John Johansen <john.johansen@canonical.com>
2018-09-18 11:35:28 +00:00
John Johansen
50c9901d62 Merge branch 'profile-usr.sbin.dnsmasq' into 'master'
usr.sbin.dnsmasq: add paths for NetworkManager connection sharing

dnsmasq needs to access additional paths when used for connection sharing by NetworkManager.
Additionally it needs read permissions to /usr/share/dnsmasq/trust-anchors.conf which contains the DNSSEC trust anchors.

See merge request apparmor/apparmor!193

Acked-by: John Johansen <john.johansen@canonical.com>
2018-09-18 11:34:13 +00:00
John Johansen
20de92c5d6 Merge branch 'qt-settings-write' into 'master'
Add qt5 writing abstractions

Qt-based applications stores QFileDialog (latest browsed directory) and
other shared user settings inside ~/.config/QtProject.conf. Currently
available qt abstraction only allows to read it (by design), so this
patch introduces abstraction that grants permissions for writing.
Relevant denies discovered with KDE Dragon Player:
/var/log/audit/audit.log.1:type=AVC msg=audit(1533485161.999:981): apparmor="DENIED" operation="mknod" profile="/usr/bin/dragon" name="/home/vincas/.config/QtProject.conf.lock" pid=29911 comm="dragon" requested_mask="c" denied_mask="c" fsuid=1000 ouid=1000
type=AVC msg=audit(1533486419.266:1141): apparmor="DENIED" operation="file_lock" profile="/usr/bin/dragon" name="/home/vincas/.config/QtProject.conf.lock" pid=30406 comm="dragon" requested_mask="k" denied_mask="k" fsuid=1000 ouid=1000
/var/log/audit/audit.log.1:type=AVC msg=audit(1533485206.575:1006): apparmor="DENIED" operation="link" profile="/usr/bin/dragon" name="/home/vincas/.config/QtProject.conf.Gflpds" pid=29946 comm="dragon" requested_mask="l" denied_mask="l" fsuid=1000 ouid=1000 target="/home/vincas/.config/#12982163"
In addition, added new qt-compose-cache-write abstraction as some applications wants to write compose cache. qt5 abstraction is appended with read-only rule (that's enough for LibreOffice using KDE file dialog).

See merge request apparmor/apparmor!159

Acked-by: John Johansen <john.johansen@canonical.com>
2018-09-18 10:03:08 +00:00
nl6720
5bc7a9fbd6 usr.sbin.dnsmasq: add paths for NetworkManager connection sharing
Also add /usr/share/dnsmasq/, DNSSEC trust anchors are kept there.
2018-09-18 12:57:22 +03:00
nl6720
b3c4a73e2f usr.sbin.ntpd: add openntpd drift and socket files 2018-09-18 11:53:36 +03:00
John Johansen
50658a9409 Merge branch 'cboltz-parser-tests-configfile' into 'master'
use empty parser/tst/parser.conf in all parser and profile tests

See merge request apparmor/apparmor!191

Without this, the system-wide parser.conf gets used, which causes test
failures if for example caching is enabled and the cache dir isn't
writeable for the user running the tests.

I propose this for all branches where the parser understands --config-file.

Acked-by: John Johansen <john.johansen@canonical.com>
2018-09-17 09:43:47 +00:00
Christian Boltz
fdfcd47baa
Use parser/tst/parser.conf in profiles 'make check'
This avoids problems if the system-wide parser.conf has caching enabled,
and the cache location is not writeable for the user running 'make check'.
2018-09-16 22:06:46 +02:00
Christian Boltz
5a18fd7c89
use empty parser/tst/parser.conf in all parser tests
Without this, the system-wide parser.conf gets used, which causes test
failures if for example caching is enabled and the cache dir isn't
writeable for the user running the tests.
2018-09-16 21:58:28 +02:00
John Johansen
b4f6711f4e Merge branch 'cboltz-logprof-python3.7' into 'master'
add python3.7 to logprof.conf

See merge request apparmor/apparmor!190

 add python3.7 to logprof.conf

I propose this patch for at least 2.12..master, maybe also 2.10 and 2.11 (even if it's unlikely that someone uses the latest python3 on a distro with old AppArmor)

Acked-by: John Johansen <john.johansen@canonical.com>
2018-09-14 23:51:52 +00:00
Christian Boltz
db096135eb
add python3.7 to logprof.conf 2018-09-15 00:32:48 +02:00
Tyler Hicks
be29aac40c Merge branch 'doc-improvements' into 'master'
Doc improvements

See merge request apparmor/apparmor!188

Acked-by: Christian Boltz <apparmor@cboltz.de>
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
2018-09-13 17:49:22 +00:00
Tyler Hicks
f26afb5b55 README: Point to the security vuln section of the wiki
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
2018-09-13 17:01:32 +00:00
Tyler Hicks
35e59af532 README: Point to the new email address for security bug reports
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
2018-09-13 17:00:22 +00:00
Tyler Hicks
1f935c4145 README: Improve the bug reporting instructions
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
2018-09-13 16:59:29 +00:00
Tyler Hicks
f91235ca6a README: Move project contact info into the main README
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
2018-09-13 16:54:09 +00:00
Tyler Hicks
a97fe6337a parser: Remove mention of wiretrip vulnerability handling policy
It looks as if the wiretrip domain has changed hands. The linked policy
page no longer exists.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
2018-09-13 16:48:49 +00:00
Tyler Hicks
2f0a773506 utils: Point to the correct Profiles wiki page
The URL redirect ends up at a page in the new wiki that doesn't exist.
We have to link directly to the gitlab URL here since the current URL
redirect doesn't let us use a wiki.apparmor.net URL and still reach the
expected Profiles page.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
2018-09-13 16:46:10 +00:00
Tyler Hicks
eb8975e0cc all: Use HTTPS links for apparmor.net
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
2018-09-13 16:41:32 +00:00
John Johansen
25f98537db libapparmor: fix readdirfd to memory checks and cleanup on failure
The open-coded readdirfd fn used to replace scandirat skipped
checks for memory allocation failures and cleaning on faulures,
fix this.

Acked-by: Tyler Hicks <tyhicks@canonical.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
2018-09-12 16:20:03 -07:00
Patrick Steinhardt
259a4bad50 libapparmor: replace scandirat with open-coded variant
The `scandirat` function is a nonstandard GNU extension, which opens a
directory relative to a file descriptor. musl libc does not implement
that function and thus cannot be used to compile libapparmor.

All our uses of `scandirat` directly scan the directory the file
descriptor is referring to, not any directory beneath the FD. Implement
a function `readdirfd()`, which gets as arguments the directory FD, the
location where to put the list of directory entries as well as a
function pointer to a comparing function. `readdirfd` will then scan all
directory entries except "." and ".." and return them via an allocated
array. The array is sorted in case the comparing function is set.

PR: https://gitlab.com/apparmor/apparmor/merge_requests/107
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: John Johansen <john.johansen@canonical.com>
2018-09-12 10:45:58 -07:00
John Johansen
474be603c4 parser: fix cache write message when stdin is used
Using stdin with --write-cache set results in

  # apparmor_parser --show-cache --write-cache
  Cache: added primary location '/var/cache/apparmor'
  Warnung aus stdin (Zeile 1): Cache: added readonly location '/usr/share/apparmor/cache'
  Warnung aus stdin (Zeile 1): apparmor_parser: cannot use or update cache, disable, or force-complain via stdin
  Cache miss: stdin
  Wrote cache: /var/cache/apparmor/9b2cd0d0.0/(null)

The "Wrote cache:" message is referencing a null value and should not
be displayed.

BugLink: http://bugs.launchpad.net/bugs/1787717
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Timeout
2018-09-11 18:31:06 -07:00
John Johansen
c6e704529d Merge branch 'cboltz-php-icu' into 'master'
abstractions/php: allow ICU (unicode support) data tables

See merge request apparmor/apparmor!184

  abstractions/php: allow ICU (unicode support) data tables

  Reported by darix on IRC, and also something I noticed in my own usage of PHP.

  I propose this addition for 2.10..master.

Acked-by: John Johansen <john.johansen@canonical.com>
2018-09-12 00:19:06 +00:00
John Johansen
a75d5503cf Merge branch 'cboltz-pyflakes2' into 'master'
remove unused exception binding in sandbox.py

See merge request apparmor/apparmor!178

Acked-by: John Johansen <john.johansen@canonical.com>
2018-09-12 00:16:30 +00:00
Christian Boltz
ce8038f602 Merge branch 'void' into 'master'
profiles: support void-specific binary names for openntp and traceroute

See merge request apparmor/apparmor!183

Acked-by: Christian Boltz <apparmor@cboltz.de>
2018-09-11 18:41:03 +00:00