Commit graph

4617 commits

Author SHA1 Message Date
Christian Boltz
5e4c68712f 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

(cherry picked from commit 7e22b0a894)

00871696 add zsh to logprof.conf
2018-09-24 17:35:10 +00:00
nl6720
ddee796d70 usr.sbin.dnsmasq: add paths for NetworkManager connection sharing
Also add /usr/share/dnsmasq/, DNSSEC trust anchors are kept there.

(cherry picked from commit 5bc7a9fbd6)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2018-09-19 00:08:03 -07:00
nl6720
9d841a2291 usr.sbin.ntpd: add openntpd drift and socket files
(cherry picked from commit b3c4a73e2f)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2018-09-19 00:08:03 -07:00
Cameron Nemo
9cb010f746 profiles: support void-specific binary names for openntpd, traceroute, and ping
(cherry picked from commit 6e28a94ace)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2018-09-19 00:08:03 -07:00
Cameron Nemo
645545048c profiles: support distributions which merge sbin into bin
Closes #8

(cherry picked from commit 9ab45d811e)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2018-09-19 00:08:03 -07:00
John Johansen
540aa94418 parser: fix build warning for assigning default cache location
The compiler is spitting out the warning

parser_main.c:1291:16: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
    char *tmp = "/var/cache/apparmor";

fix this by constifying the cacheloc array.

Signed-off-by: John Johansen <john.johansen@canonical.com>
(cherry picked from commit e7949d09fa)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2018-09-18 02:46:00 -07:00
intrigeri
affc7a9fb4 Move the cache to /var/cache
Let's not store a bunch of automatically generated binary files in /etc.
AppArmor 3.0 will store the cache in /var/cache and most distros
(openSUSE, Debian, and soon Ubuntu) moved it there already.

Bug-Debian: https://bugs.debian.org/904637
(cherry picked from commit 3d21cf0e32)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2018-09-18 02:46:00 -07:00
Christian Boltz
6f5c61e6af 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'.

PR: https://gitlab.com/apparmor/apparmor/merge_requests/191
(cherry picked from commit fdfcd47baa)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2018-09-17 02:49:56 -07:00
Christian Boltz
b86f313281 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.

PR: https://gitlab.com/apparmor/apparmor/merge_requests/191
(cherry picked from commit 5a18fd7c89)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2018-09-17 02:48:57 -07:00
John Johansen
4167497738 parser: add empty config file for parser caching tests
The caching tests will fail if a warning is thrown. Some setups may
not have a parser config file in the default location which results
in the warning
  config file '/etc/apparmor/parser.conf' not found

which causes the tests to fail.

PR: https://gitlab.com/apparmor/apparmor/merge_requests/175
Acked-by: Seth Arnold <seth.arnold@canonical.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
(cherry picked from commit 657495fa55)
2018-09-17 02:42:17 -07:00
John Johansen
5cc04694bf parser: update option parsing so --config-file does not have to be first
Requiring --config-file to be first in the option list is not user
friendly fix the option parsing so that --config-file can be specified
anywhere in the option list.

This also fixes a bug where even when the --config-file option is
first the option parsing fails because the detection logic is broken
for some option cases.

PR: https://gitlab.com/apparmor/apparmor/merge_requests/175
Acked-by: Seth Arnold <seth.arnold@canonical.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
(cherry picked from commit af1818c053)
2018-09-17 02:41:43 -07:00
John Johansen
b54929b0e0 parser: group parser number of config options together
To help avoid the duplicate option problem in the future sort and group
the config options using numbers at the end of the option table.

PR: https://gitlab.com/apparmor/apparmor/merge_requests/173
Acked-by: Seth Arnold <seth.arnold@canonical.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
(cherry picked from commit 9a8e7e58d2)
2018-09-17 02:41:26 -07:00
John Johansen
e0f7594c73 parser: fix collision of --config-file and --compile-features options
Unfortunately both --config-file and --compile-features are using
139 to indicate the feature which breaks one or the other depending
on how the switch state that processes the options is compiled.

PR: https://gitlab.com/apparmor/apparmor/merge_requests/173
Acked-by: Seth Arnold <seth.arnold@canonical.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
(cherry picked from commit 3da52f7515)
2018-09-17 02:39:48 -07:00
John Johansen
a17775b821 parser: Add fixes to --config-file option
After the config file patch was committed to 2.13 a couple of
improvements were suggested by intrigeri and cboltz. These have
been done as a separate patch so they can be applied to both
dev and 2.13.

PR: https://gitlab.com/apparmor/apparmor/merge_requests/170
Acked-by: Christian Boltz <apparmor@cboltz.de>
Signed-off-by: John Johansen <john.johansen@canonical.com>
(cherry picked from commit 2c0d7e608c)
2018-09-17 02:39:35 -07:00
John Johansen
e97b1e732a parser: allow specifying the parser config file
The parser config file can affect the parsers behavior during tests.
Allow overriding the default location with the option

  --config-file=

the option must be the first option in the commands argument list.

Also provile a
  --print-config-file

option to display what the parser is using for a config file.

BugLink: http://bugs.launchpad.net/bugs/1277711
Acked-by: Christian Boltz <apparmor@cboltz.de>
Signed-off-by: John Johansen <john.johansen@canonical.com>
(cherry picked from commit b1967c892a)
2018-09-17 02:38:59 -07:00
John Johansen
bc133dd9b5 Revert "parser: allow specifying the parser config file"
The version of --config-file that landed in apparmor-2.13 has bugs
and the upstream version evolved before it was committed (it is
not just commits on top of the 2.13 patch).

So to backport the newer version with fixes,
revert commit 56b8e16698.

Signed-off-by: John Johansen <john.johansen@canonical.com>
2018-09-17 02:35:44 -07:00
Christian Boltz
2f658e2422 add python3.7 to logprof.conf
(cherry picked from commit db096135eb)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2018-09-14 16:56:22 -07:00
John Johansen
730b346fde Merge branch 'mesa-abstraction-2.13' into 'apparmor-2.13'
Backport Mesa abstraction to 2.13

See merge request apparmor/apparmor!189
2018-09-14 07:29:15 +00:00
intrigeri
51a7041f85 mesa abstraction: allow locking .cache/mesa_shader_cache/??/*.
At least Totem needs it on current Debian sid.
2018-09-14 06:26:13 +00:00
Vincas Dargis
d55b94642c Add mesa abstraction
Add mesa abstraction to allow writing to the Mesa-specific cache
locations and listing devices. Abstraction is needed for applications
utilizing OpenGL API with Mesa implementation available on the system.
2018-09-14 06:26:09 +00:00
John Johansen
8b79ce540c infrasture: update branch name for release builds
When apparmor-2.13 was branched from master the branch name was not
updated in the Makefile. Fix it.

Signed-off-by: John Johansen <john.johansen@canonical.com>
2018-09-13 16:04:53 -07:00
John Johansen
866aaa1687 Documentation: Sync Readme.md with master branch updates
Sync Readme.md with master branch updates and to add badge, build and
coverage badges.

Signed-off-by: John Johansen <john.johansen@canonical.com>
2018-09-13 15:44:40 -07:00
Tyler Hicks
08412a8a39 README: Point to the security vuln section of the wiki
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
2018-09-13 11:45:59 -07:00
Tyler Hicks
1f99202c26 README: Point to the new email address for security bug reports
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
2018-09-13 11:45:59 -07:00
Tyler Hicks
14744e83a6 README: Improve the bug reporting instructions
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
2018-09-13 11:45:59 -07:00
Tyler Hicks
69800c435a README: Move project contact info into the main README
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
2018-09-13 11:45:59 -07:00
Tyler Hicks
50ae9a1884 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 11:45:59 -07:00
Tyler Hicks
e27df656f0 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 11:45:59 -07:00
Tyler Hicks
2bef2e23d1 all: Use HTTPS links for apparmor.net
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
2018-09-13 11:45:59 -07:00
John Johansen
ed1fd20aa9 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>
(cherry picked from commit 25f98537db)
2018-09-12 16:20:52 -07:00
Patrick Steinhardt
ffb051db51 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>
(cherry picked from commit 259a4bad50)
2018-09-12 10:47:27 -07:00
John Johansen
e45a46d47d 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:33:47 -07:00
Christian Boltz
f651633281 abstractions/php: allow ICU (unicode support) data tables
Reported by darix on IRC, and also something I noticed in my own usage
of PHP.

PR: https://gitlab.com/apparmor/apparmor/merge_requests/184
(cherry picked from commit e396f9dae9)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2018-09-11 18:22:59 -07:00
Christian Boltz
02ab39208b remove unused exception binding in sandbox.py
pyflakes 2.0 is more strict and found that 'e' is never used.

References: https://build.opensuse.org/request/show/629206 (comment
section)

PR: https://gitlab.com/apparmor/apparmor/merge_requests/178
(cherry picked from commit 51482c33f5)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2018-09-11 18:21:25 -07:00
John Johansen
fac81098fa Merge branch 'cboltz-fix-complain-named-profiles' into 'master'
set_profile_flags(): allow named profiles without attachment

See merge request apparmor/apparmor!142

Acked-by: John Johansen <john.johansen@canonical.com>


(cherry picked from commit c66a1a972c)

0dca959c set_profile_flags(): allow named profiles without attachment
2018-09-11 21:02:04 +00:00
John Johansen
2fbb1ed2df Merge branch 'cboltz-change-flags-2.13' into 'apparmor-2.13'
2.13:  prevent that aa-complain etc. overwrites flags in child profiles if they differ from the main profile

See merge request apparmor/apparmor!185

Acked-by: John Johansen <john.johansen@canonical.com>
2018-09-11 18:29:53 +00:00
Christian Boltz
65c1a6cae2
let change_profile_flags() change flags in child profiles
... instead of overwriting them with the flags of the main profile.

This fixes a longstanding issue with aa-complain, aa-enforce and
aa-audit which broke the flags of child profiles and hats if they
differed from the main profile.

It also fixes several issues documented in the tests (which obviously
need adjustment to match the fixed behaviour).

Also change the "no profile found" cases to AppArmorException - errors
in a profile are not worth triggering AppArmorBug ;-)

(cherry picked from commit b00aab0843)
2018-09-02 17:05:24 +02:00
Christian Boltz
529985973d
change_profile_flags: raise AppArmorBug on empty new flag
(cherry picked from commit d26ffbdd29)
2018-09-02 17:05:16 +02:00
Christian Boltz
7349a9cb03
merge set_profile_flags() into change_profile_flags()
(and adjust a few comments in profile_storage.py)

(cherry picked from commit c016fc6656)
2018-09-02 17:05:08 +02:00
Christian Boltz
fb7a5983bc
rewrite set_profile_flags() tests to use change_profile_flags()
All callers call change_profile_flags(), so it makes sense to test this
function instead of set_profile_flags().

Besides that, set_profile_flags() will be merged into
change_profile_flags() in the next commit ;-)

Note that this commit adds some '# XXX' notes to the tests. These will
be addressed in later commits.

(cherry picked from commit abd124c00d)
2018-09-02 17:04:58 +02:00
Christian Boltz
f4c722c739
change_profile_flags: use ', ' as flags delimiter
This looks better than a comma without whitespace.

Also adjust minitools_test.py to follow this change.

(cherry picked from commit 4a021ec203)
2018-09-02 17:04:49 +02:00
Christian Boltz
267c18e725
extend add_or_remove_flag() to handle str for old flags
If the old flags are given as str (or None), call split_flags() to
convert them to a list.

This allows to simplify change_profile_flags() which now doesn't need to
call split_flags() on its own.

Also add some tests with a str for the old flags

(cherry picked from commit e80caa130a +
 conflict resolution)
2018-09-02 17:04:29 +02:00
Christian Boltz
41eae89869
split off add_or_remove_flag() from change_profile_flags()
Also add some tests for add_or_remove_flag()

(cherry picked from commit 604004c2b6 +
 conflict resolution)
2018-09-02 17:00:55 +02:00
Christian Boltz
e13569fecb
move splitting flags into profile_storage split_flags() function
... and change change_profile_flags() to use it instead of doing it
itsself

Also add some tests for split_flags()

Cherry-picked from ce7ea062c5 + conflict
resolution
2018-09-02 16:55:45 +02:00
Christian Boltz
1c570118ed
activate_repo_profiles(): use change_profile_flags
... instead of set_profile_flags() to keep possibly existing flags like
attach_disconnected.

Note that this function is unused (meant to be used with the
no-longer-existing profile repo), therefore nobody noticed that
set_profile_flags() was called with the wrong number of parameters ;-)
2018-09-02 16:50:17 +02:00
Vincas Dargis
ec0c5d470a Add kde-icon-cache-write abstraction
KIconLoader uses ~/.cache/icon-cache.kcache, and it is opened in
read-write mode. Because access to it does not seem to be critical, and
read-only mode is not used, rules for accessing this cache is added to
it's own new "write" abstraction, instead of making kde abstraction more
permissive by default.

(cherry picked from commit 94014c09f0)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2018-08-14 16:56:04 -07:00
Vincas Dargis
925cf94cdc Add kde-language-write abstraction
Currently, kde abstraction only allows reading
~/.config/klanguageoverridesrc file (by design). Some KDE applications
has option to change language for it's interface, and this needs write
access. This is fixed by introducing new abstraction.

(cherry picked from commit 7345f61e9c)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2018-08-14 16:55:42 -07:00
Vincas Dargis
090e9986f1 Add kde-globals-write abstraction
Currently, kde abstraction only allows reading ~/.config/kdeglobals (by
design), though some applications might need to update it's contents
such as KFileDialog settings. This patch fixes it by introducing new
abstraction.

(cherry picked from commit fae93f1b6c)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2018-08-14 16:55:16 -07:00
Vincas Dargis
2eb9ab0913 Add recent-documents-write abstraction
Add abstraction for updating recent documents list.

(cherry picked from commit 4fe8ae97c4)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2018-08-14 16:38:22 -07:00
Christian Boltz
7f0aed7fb8 add dehydrated certificate location to ssl_* abstractions
I don't use dehydrated myself, therefore this is based on the comments
on https://build.opensuse.org/request/show/533380

(cherry picked from commit 2e8b902248)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2018-08-07 23:55:16 -07:00