Commit graph

4494 commits

Author SHA1 Message Date
Christian Boltz
4a021ec203
change_profile_flags: use ', ' as flags delimiter
This looks better than a comma without whitespace.

Also adjust minitools_test.py to follow this change.
2018-07-25 21:33:22 +02:00
Christian Boltz
e80caa130a
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
2018-07-25 20:59:34 +02:00
Christian Boltz
604004c2b6
split off add_or_remove_flag() from change_profile_flags()
Also add some tests for add_or_remove_flag()
2018-07-25 20:44:39 +02:00
Christian Boltz
ce7ea062c5
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()
2018-07-25 20:36:45 +02:00
Christian Boltz
9d78694b00
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-07-25 17:41:42 +02:00
intrigeri
d5e72d2ef2 Merge branch 'mesa-shader-lock' into 'master'
mesa abstraction: allow locking .cache/mesa_shader_cache/??/*.

See merge request apparmor/apparmor!148
2018-07-25 07:43:58 +00:00
intrigeri
59865e54c5 mesa abstraction: allow locking .cache/mesa_shader_cache/??/*.
At least Totem needs it on current Debian sid.
2018-07-24 07:21:51 +00:00
Christian Boltz
04e5b9fb8a Merge branch 'wireshark-refresh' into 'master'
Wireshark refresh

See merge request apparmor/apparmor!143

Acked-by: Vincas Dargis <vindrg@gmail.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2018-07-23 15:17:04 +00:00
Steve Beattie
e162461f9d
parser: add missing break in load_profile()
Merge branch 'cboltz-parser-break' into 'master'

Signed-off-by: Steve Beattie <steve.beattie@canonical.com>
PR: https://gitlab.com/apparmor/apparmor/merge_requests/146
2018-07-17 22:33:50 -07:00
Simon Deziel
8684282a1b usr.bin.wireshark: allow saving pcaps with optional gzip compression 2018-07-17 17:26:34 -04:00
Simon Deziel
b077fccaef usr.bin.wireshark: allow creating QT compose cache 2018-07-17 17:15:15 -04:00
Simon Deziel
70a40566f5 usr.bin.wireshark: restrict hidden file creation under ~/.config/ 2018-07-17 17:14:17 -04:00
Simon Deziel
fa30238293 usr.bin.dumpcap: drop useless/redundant rules 2018-07-17 17:12:44 -04:00
Simon Deziel
e0ba7a4609 usr.bin.wireshark: fix access to configuration profiles 2018-07-17 17:02:28 -04:00
Simon Deziel
bf8222a361 usr.bin.wireshark: add a comment for QtProject.conf rules 2018-07-17 06:15:51 -04:00
Christian Boltz
c437e9d4a5
add missing 'break' in load_profile()
'case OPTION_OFILE' missed the 'break', which means if did fallthrough
to the default case.

Adding the 'break' means no longer executing another PERROR, and no
longer executing the 'exit(1)' in the default branch.

References: coverity #55994
2018-07-13 15:21:24 +02:00
Simon Deziel
0e38f51aad usr.bin.wireshark: mention that dri rules were backported from abstraction/dri-enumerate 2018-07-13 04:56:42 -04:00
Simon Deziel
5a8453fbe0 usr.bin.dumpcap: incorporate feedback from Talkless an cboltz 2018-07-12 05:13:55 -04:00
Simon Deziel
0c0a90be0b usr.bin.wireshark: refresh for 18.04 2018-07-11 12:29:36 -04:00
Simon Deziel
b765dab52e usr.bin.dumpcap: new profile 2018-07-11 12:29:12 -04:00
John Johansen
aa42e33860 kernel-patches: add v4.17-out-of-tree net compatibility patches
Add kernel patches that will NEVER be sent upstream. These provide abi
compatibility with the v2.x network and af_unix rules.

The 4.17 network mediation pull request deliberately broke abi
compatibility with the v2.x rules, and these are provided so that
distros who shipped the v2.x compatible patches can provide new
kernels on older releases that require v2.x network support.

Signed-off-by: John Johansen <john.johansen@canonical.com>
2018-07-10 22:18:48 -07:00
Steve Beattie
8fc0ff7ffc
utils: cleanup serialize_profile() and its callers
Merge branch 'cboltz-cleanup-serialize-profile'

Signed-off-by: Steve Beattie <steve.beattie@canonical.com>
PR: https://gitlab.com/apparmor/apparmor/merge_requests/138
2018-06-29 15:21:24 -07:00
Steve Beattie
640556637f adjust abstractions/python for python 3.7
Merge branch 'cboltz-python-version' into 'master'

Acked-by: Steve Beattie <steve@nxnw.org>
PR: https://gitlab.com/apparmor/apparmor/merge_requests/139/
2018-06-29 18:15:47 +00:00
Christian Boltz
01f41fbff8
adjust abstractions/python for python 3.7
Python 3.7 was released yesterday - and to make the abstraction
future-proof, also cover 3.8 and 3.9 in advance ;-)
2018-06-28 13:34:08 +02:00
Christian Boltz
e5ffa6815c Merge branch 'mesa' into 'master'
Add mesa abstraction

See merge request apparmor/apparmor!137


Acked-by: Christian Boltz <apparmor@cboltz.de>
2018-06-27 19:11:06 +00:00
Christian Boltz
b613860f14
serialize_profile: simplify setting of include_flags
Note that NO_FLAGS was an inverse option, therefore
- NO_FLAGS was changed to FLAGS (also in sync_profile() which is the
  only caller that sets FLAGS)
- the default for include_flags (if FLAGS is not set) is True
2018-06-25 22:55:26 +02:00
Christian Boltz
9865e112f7
serialize_profile(): simplify setting include_metadata 2018-06-25 22:47:30 +02:00
Christian Boltz
5ef95fff4f
serialize_profile(): add type check for options
This makes the "if options:" check superfluous, therefore remove it and
change the whitespace of the following lines
2018-06-25 22:43:39 +02:00
Christian Boltz
7e42135010
fix serialize_profile() calls to always use a dict for options 2018-06-25 21:42:29 +02:00
Christian Boltz
db7983aee5
simplify setting serialize_options 2018-06-25 21:39:47 +02:00
Vincas Dargis
a0c719df73 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-06-23 17:07:05 +03:00
Christian Boltz
b7a4f37cbb Merge branch 'cboltz-nested-child-error' into 'master'
parse_profile_start(): Error out on nested child profiles

See merge request apparmor/apparmor!136

Acked-by: John Johansen <john.johansen@canonical.com> for 2.10..master
2018-06-21 10:20:03 +00:00
Christian Boltz
82eb749b6f Merge branch 'cboltz-view-changes' into 'master'
use serialize_profile() for the new profile in (V)iew Changes

See merge request apparmor/apparmor!131

Acked-by: John Johansen <john.johansen@canonical.com>
2018-06-21 10:19:12 +00:00
Christian Boltz
f7ed8257c3 Merge branch 'cboltz-gitignore' into 'master'
add utils/test/common_test.pyc to gitignore

See merge request apparmor/apparmor!135

Acked-by: John Johansen <john.johansen@canonical.com>
2018-06-20 20:55:30 +00:00
Christian Boltz
48d7692c05 Merge branch 'cboltz-systemd-cache-loc' into 'master'
Adjust cache paths in apparmor.service

See merge request apparmor/apparmor!134

Acked-by: John Johansen <john.johansen@canonical.com>
2018-06-20 20:54:51 +00:00
Christian Boltz
6c8fff099f Merge branch 'cboltz-simplify-write-vars' into 'master'
simplify write_list_vars()

See merge request apparmor/apparmor!130

Acked-by: John Johansen <john.johansen@canonical.com>
2018-06-20 15:52:02 +00:00
Christian Boltz
50aa8204c9 Merge branch 'cboltz-ruleset-tests' into 'master'
add some tests for BaseRule/BaseRuleset

See merge request apparmor/apparmor!132

Acked-by: John Johansen <john.johansen@canonical.com>
2018-06-20 15:51:13 +00:00
Christian Boltz
e5eff3bbee Merge branch 'cboltz-apache-stapling' into 'master'
fix path for apache2 stapling-cache

See merge request apparmor/apparmor!133

Acked-by: John Johansen <john.johansen@canonical.com>
2018-06-20 15:50:28 +00:00
Christian Boltz
8462c39b14
parse_profile_start(): Error out on nested child profiles
The tools can't handle nested child profiles yet. Instead of failing
in funny[tm] ways (parse_profile_start() only returned the first two
segments of the profile name) better error out with a clear message.
2018-06-20 14:43:48 +02:00
Christian Boltz
63d17ecf16
add utils/test/common_test.pyc to gitignore
(cache file that gets created when running the tests with python2)
2018-06-19 15:27:16 +02:00
Christian Boltz
1185df3c65
fix path for apache2 stapling-cache
... to match the default apache settings

See also the discussion on the mailinglist:
https://lists.ubuntu.com/archives/apparmor/2018-June/011688.html
2018-06-17 16:16:22 +02:00
Christian Boltz
3a9b0fd74a
Adjust cache paths in apparmor.service
The initial apparmor.service assumed the profile cache is in
/var/lib/apparmor/ which was an openSUSE-specific path that was chosen
for historical reasons, but was far from perfect.

In the meantime, the profile cache moved to /var/cache/apparmor/ and the
read-only/packaged version was added in /usr/share/apparmor/cache/

This commit adjusts apparmor.service to use these paths.
2018-06-16 23:14:19 +02:00
Christian Boltz
2312873406
add some tests for BaseRule/BaseRuleset
These tests verify that
- _is_equal_aare() really raises an exception when it sees an invalid
  combination of other_value and other_all
- BaseRuleset.__repr__() works as expected

As a side effect, this commit pushes the test coverage of
apparmor/rule/__init__.py to 100% ;-)
2018-06-09 20:53:53 +02:00
Christian Boltz
82fc0b8239
delete now unused serialize_parse_profile_start()
(another function that was only used by
serialize_profile_from_old_profile())

Also delete the tests we had for that function.
2018-06-09 15:27:26 +02:00
Christian Boltz
0eb12a8cbd
delete serialize_profile_from_old_profile()
... which is unused since the last commit.

Also delete several functions that were only used by this function:
- write_change_profile()
- write_rlimits()
- write_capabilities()
- write_netdomain()
- write_dbus()
- write_signal()
- write_ptrace()
- write_file()

Finally, no longer import some functions from profile_storage:
- write_links
- write_mount
- write_pivot_root
- write_unix

BTW: Deleting these 460 lines improves test coverage of aa.py from
38% to 44%, and total test coverage from 63% to 66% :-)
2018-06-09 15:13:50 +02:00
Christian Boltz
469eb444de
use serialize_profile() for the new profile in (V)iew Changes
... instead of serialize_profile_from_old_profile()

This will give a realistic preview of the changes (serialize_profile()
is also used when actually writing the profile) and replaces the
known-buggy serialize_profile_from_old_profile() with known-working
code.

It also fixes the issue reported in
    https://bugs.launchpad.net/ubuntu/+source/apparmor/+bug/1528139
which means we no longer need the workaround of catching AttributeError
(verified in manual before/after test)

References:
- https://bugs.launchpad.net/apparmor/+bug/1394788
- https://bugs.launchpad.net/bugs/1528139
- https://bugs.launchpad.net/apparmor/+bug/1404893
2018-06-09 15:10:07 +02:00
Christian Boltz
af9490556d
get rid of superfluous variables in write_list_vars()
- rename prof_data parameter to ref
- drop empty allow, prefix and tail, and their usage in the format
  string
- inline sep into the format string
- replace usage of fn with the actual function name (var_transform)
2018-05-31 22:09:26 +02:00
Christian Boltz
5ae94391c5
inline set_ref_allow() into write_list_vars()
set_ref_allow() is only used by write_list_vars(). Inline it (actually
only the used, boring if branch) to simplify the code.
2018-05-31 22:00:50 +02:00
Christian Boltz
06eb65eb50
inline write_pair() into write_list_vars()
write_pair() is only used by write_list_vars(), so there's no need to
keep it as a separate function
2018-05-31 22:00:50 +02:00
Christian Boltz
c2a420d32b
let var_transform() sort variable content
This is needed to get a reproducible output.

Also adjust the tests in test-profile-storage.py and add some example
variable to cleanprof.in and cleanprof.out
2018-05-31 22:00:36 +02:00