Commit graph

1074 commits

Author SHA1 Message Date
Paulo Gomes
d34f8bc63a Fix capability mispelling.
PR: https://gitlab.com/apparmor/apparmor/merge_requests/421
(cherry picked from commit 2d19d4d159)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2019-09-20 02:16:21 -07:00
Christian Boltz
7ce6ee2a19 Merge branch 'cboltz-unbalanced-parenthesis' into 'master'
Fix crash on unbalanced parenthesis in filename

See merge request apparmor/apparmor!402

Seth Arnold <seth.arnold@canonical.com> for 2.10..master

(cherry picked from commit db1f391844)

8f74ac02 Fix crash on unbalanced parenthesis in filename
2019-07-09 19:45:57 +00:00
Christian Boltz
0907446dbb Merge branch 'cboltz-fix-deny-hat' into 'apparmor-2.13'
[2.11..2.13] handle_children: Fix denying of adding a hat

See merge request apparmor/apparmor!378

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

(cherry picked from commit d2e83231f0)

87f91864 handle_children: Fix denying of adding a hat
2019-05-02 22:19:34 +00:00
Christian Boltz
52c3b487d0 aa-notify man page: update user's configuration file path
This is a backport of !239

    commit 2209e09aef
    Author: nl6720 <nl6720@gmail.com>

    aa-notify man page: update user's configuration file path

    Signed-off-by: nl6720 <nl6720@gmail.com>

PR: https://gitlab.com/apparmor/apparmor/merge_requests/243
(backported from commit 2209e09aef)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2018-10-21 19:40:43 -07:00
Christian Boltz
904536f7cf Add most abi/bad_*.sd tests to "exception not raised" list
Interestingly, abi/bad_6.sd is detected as invalid, and therefore not
added to the list.

PR: https://gitlab.com/apparmor/apparmor/merge_requests/238
(cherry picked from commit 5c54f66279)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2018-10-13 14:35:29 -07:00
Christian Boltz
69d3d71cd9 Merge branch 'cboltz-mergeprof-hasher-fun' into 'master'
Fix aa-mergeprof crash caused by accidentially initialzed hat

See merge request apparmor/apparmor!234

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

(cherry picked from commit 93445ca02d)

bc492533 Fix aa-mergeprof crash caused by accidentially initialzed hat
2018-10-11 19:50:05 +00:00
John Johansen
3e527d903f Merge branch 'cboltz-2.11-utils-abi' into 'apparmor-2.11'
2.11: 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.

BTW: Even serialize_profile_from_old_profile() can handle abi rules ;-)

This is a backport of 072d3e04 / !202 (merged) to
2.11 (with some adjustments because that commit didn't appy cleanly)

I propose this patch for 2.10 and 2.11.

PR: https://gitlab.com/apparmor/apparmor/merge_requests/223
Acked-by: John Johansen <john.johansen@canonical.com>
2018-10-05 07:09:46 +00:00
John Johansen
72232e0919 Merge branch 'cboltz-2.11-cache.d' into 'apparmor-2.11'
2.11/2.10: is_skippable_dir(): add 'cache.d' to exclude list

This excludes the /etc/apparmor.d/cache.d/ directory from aa-logprof
parsing because parsing the binary cache, well, takes a while :-/
Reported on the opensuse-factory mailinglist by Frank Krüger and
confirmed by others.

(cherry picked from commit 5b9497a8)

While this isn't strictly needed for 2.10 or 2.11 userspace, it makes testing these branches easier ;-)

I propose this cherry-pick for 2.11 (= this merge request) and 2.10.

https://gitlab.com/apparmor/apparmor/merge_requests/222
Acked-by: John Johansen <john.johansen@canonical.com>
2018-10-05 07:04:46 +00:00
John Johansen
7c6a592ceb Merge branch 'cboltz-2.11-utils-tests' into 'apparmor-2.11'
make 2.11 utils tests green

- switch minitools_test.py to a profile without alternation
- remove non-failing tests from unknown_line exception
- exclude several #include "does not exist" examples

PR: https://gitlab.com/apparmor/apparmor/merge_requests/220
2018-10-05 06:59:44 +00:00
nl6720
b0f55894f8 aa-notify: Read user's configuration file from XDG_CONFIG_HOME
Legacy path ~/.apparmor/notify.conf is preferred if it exists, otherwise
$XDG_CONFIG_HOME/apparmor/notify.conf, with fallback to
~/.config/apparmor/notify.conf, is used.

PR: https://gitlab.com/apparmor/apparmor/merge_requests/215
Signed-off-by: nl6720 <nl6720@gmail.com>
(cherry picked from commit 1fb9acc59e)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2018-10-04 23:40:13 -07:00
Christian Boltz
8a32ae5143
2.11: 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.

BTW: Even serialize_profile_from_old_profile() can handle abi rules ;-)

This is a backport of 072d3e0451 / !202 to
2.11 (with some adjustments because that commit didn't appy cleanly)
2018-10-03 21:28:44 +02:00
Christian Boltz
cdaf5075cb
is_skippable_dir(): add 'cache.d' to exclude list
This excludes the /etc/apparmor.d/cache.d/ directory from aa-logprof
parsing because parsing the binary cache, well, takes a while :-/

Reported on the opensuse-factory mailinglist by Frank Krüger and
confirmed by others.

(cherry picked from commit 5b9497a8c6)
2018-10-03 20:25:33 +02:00
Christian Boltz
9fb21a702c
switch minitools_test.py to a profile without alternation
... instead of backporting support for alternations in profile names to
2.11
2018-10-03 19:35:11 +02:00
Christian Boltz
d55d99cbf1
remove non-failing tests from unknown_line exception
bare_include_tests/ok_30.sd and ok_31.sd don't fail with the 2.11 tools.
Remove them from the unknown_line exception.

(Interestingly newer branches fail on these tests, but I didn't check why.)
2018-10-03 19:31:55 +02:00
Christian Boltz
e07ec63313
exclude several #include "does not exist" examples
These tests were added with the cherry-picked commit 4184b0c363

They are expected to fail, but don't fail with the 2.11 tools because
the regex only matches   #include <...>   which means   #include "..."
is considered to be a comment.
2018-10-03 19:27:24 +02:00
Christian Boltz
09050a8a8b Merge branch 'cboltz-2.12-fix-utils-po' into 'apparmor-2.12'
Remove accidently added text from utils/po/Makefile

See merge request apparmor/apparmor!217

Acked-by: Tyler Hicks <tyhicks@canonical.com>

(cherry picked from commit fa82a51523)

15770576 Remove accidently added text from utils/po/Makefile
2018-10-03 16:30:11 +00:00
Christian Boltz
ca5386c09e 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:31 +00:00
Christian Boltz
c0328fc460 add python3.7 to logprof.conf
(cherry picked from commit db096135eb)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2018-09-14 16:57:31 -07:00
Tyler Hicks
3350d482fe 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:52:11 -07:00
Tyler Hicks
7d3c022651 all: Use HTTPS links for apparmor.net
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
2018-09-13 11:52:11 -07:00
Christian Boltz
c5bec9c0b5 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:28:05 -07:00
Christian Boltz
6c81024701 aa-genprof: don't crash if setting printk_ratelimit fails
When running aa-genprof in a lxd instance, printk_ratelimit is readonly
and writing to it fails. Instead of crashing with a backtrace, only
print a warning.

References: https://bugs.launchpad.net/apparmor/+bug/1785391
(cherry picked from commit 961e69afe5)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2018-08-07 03:05:32 -07:00
Christian Boltz
e82683d3f5 make message about notify-send package cross-distro compatible
PR: !144
References: https://bugzilla.opensuse.org/show_bug.cgi?id=1100779
(cherry picked from commit 44ee1d5090)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2018-08-07 02:32:31 -07:00
Christian Boltz
6e068f9e25 comment out use_group to remove group restrictions
use_group is only honored if it is defined.

The "real" permission check is reading the logfile - the group check
in aa-notify is just an annoying additional check, and the default
"admin" only works on Ubuntu (other distributions typically use
"wheel").

This commit comments out use_group in the default config, which allows
everybody to use aa-notify. Permissions for reading the log file are of
course still needed.

PR: https://gitlab.com/apparmor/apparmor/merge_requests/82
References: https://bugzilla.opensuse.org/show_bug.cgi?id=1058787
(cherry picked from commit 86ec3dd658)
Acked-by: Christian Boltz <apparmor@cboltz.de>
Signed-off-by: John Johansen <john.johansen@canonical.com>
2018-07-11 22:45:42 -07:00
Christian Boltz
84b9b46fb0 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

(cherry picked from commit b7a4f37cbb)

8462c39b parse_profile_start(): Error out on nested child profiles
2018-06-21 10:20:52 +00:00
Christian Boltz
93922246df
utils: fix writing alias rules
write_pair() ignored the 'tail' parameter, which resulted in writing
invalid alias rules (without the trailing comma).

Also add an alias to test/cleanprof.* to ensure it doesn't break again.

(cherry picked from commit ae4ab62855)

Acked-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
PR: https://gitlab.com/apparmor/apparmor/merge_requests/119
2018-05-08 08:00:33 -07:00
Christian Boltz
ae29fb0749
utils: fix writing "link subset" rules
Writing a "link subset" rule missed a space, which resulted in something
like
  link subset/foo -> /bar,

Also add a test rule to tests/cleanprof.* to ensure this doesn't break
again.

(cherry picked from commit 514535608f)

Acked-by: Steve Beattie <steve@nxnw.org>
PR: https://gitlab.com/apparmor/apparmor/merge_requests/117
2018-05-06 22:40:28 -07:00
Christian Boltz
3bdb7b1754 Merge branch 'cboltz-utils-test-ignore-include-if-exists' into 'master'
utils tests: ignore tests for 'include if exists'

See merge request apparmor/apparmor!78

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

(cherry picked from commit e6ef536957)

dc7c7021 utils tests: ignore tests for 'include if exists'
2018-03-16 21:38:38 +00:00
Christian Boltz
c0786268f3 Merge branch 'cboltz-skip-git-dir' into 'master'
ignore .git in is_skippable_dir()

See merge request apparmor/apparmor!77

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

(cherry picked from commit 3b5683be29)

f9eb3fea ignore .git in is_skippable_dir()
2018-03-16 21:36:20 +00:00
Kees Cook
236c851bfe aa-status: split profile from exec name
Right now, if you have a named profile with regular expressions to
match binaries, the profile will be shown in aa-status under the
"process list", which doesn't make sense. Instead, show the actual
executable name, and if the profile name differs, report it at the
end (or as a separate field in the json output mode).

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: John Johansen <john.johansen@canonical.com>
2018-03-01 15:57:34 -08:00
Christian Boltz
65c010ccc3 Merge branch 'cboltz-notify-dbus-env' into 'master'
set DBUS_SESSION_BUS_ADDRESS, needed by notify-send

See merge request apparmor/apparmor!53


Acked-by: intrigeri <intrigeri@debian.org> for 2.9..master

(cherry picked from commit 0eefeeb0e7)

cb5cdf26 set DBUS_SESSION_BUS_ADDRESS, needed by notify-send
2018-02-17 16:03:46 +00:00
Christian Boltz
4a76852648 tools: Mark profiles with multiple rules in one line as known-failing
The tools don't support having multiple rules in one line (they expect
\n after each rule), therefore mark some of the bare_include_tests as
known failures.

(cherry picked from commit 26af640fda)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2018-01-24 00:19:18 -08:00
John Johansen
1a3c0cd277 aa-decode: add the ability to support PROCTITLE string
buglink: https://bugs.launchpad.net/apparmor/+bug/1736841

Signed-off-by: John Johansen <john.johansen@canonical.com>
(cherry picked from commit 3afbfed9ee)
2017-12-24 00:26:17 -08:00
John Johansen
0ecc171de9 Merge branch 'cboltz-inherit-mr' into 'master'
handle_children(): automatically add m permissions on ix rules

See merge request apparmor/apparmor!22

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


(cherry picked from commit b2df42f55b)

7a49f37c handle_children(): automatically add m permissions on ix rules
2017-12-12 22:53:27 +00:00
John Johansen
d4218f6ca4 Merge branch 'cboltz-file-w-covered-by-a' into 'master'
FileRule: detect that 'a' is covered by 'w'

See merge request apparmor/apparmor!23

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


(cherry picked from commit 6483c627d2)

1857f07d test-file.py: Document that w doesn't cover a yet
a0d4e246 FileRule: detect that 'a' is covered by 'w'
2017-12-12 22:52:10 +00:00
Tyler Hicks
e9287e066b Merge branch 'exit-from-Makefile-shell-snippets' into 'master'
binutils, parser, utils: Exit from Makefile shell snippets

See merge request apparmor/apparmor!27

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

(cherry picked from commit debc4e3ffe)

2c04f44a binutils, parser, utils: Exit from Makefile shell snippets
2017-12-05 17:47:29 +00:00
Tyler Hicks
fca085a352 utils: Gracefully handle a missing parser in the check target
The test-aa-easyprof.py script relies on the parser to be built so the
check target of the utils/test/Makefile should detect if the parser
exists before running any tests.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Reported-by: Christian Boltz <apparmor@cboltz.de>
2017-12-04 23:12:14 +00:00
Christian Boltz
2d0ab611b2 Merge branch 'cherry-pick-794d1c4a' into 'apparmor-2.11'
Merge branch 'cboltz-double-read-inactive' into 'master'

See merge request apparmor/apparmor!19

Acked-by: Seth Arnold seth.arnold@canonical.com for trunk, 2.11 and 2.10
2017-12-01 22:24:32 +00:00
Christian Boltz
bfbda33038 Merge branch 'cboltz-remove-unknown-newline' into 'master'
Don't print a literal '\n' in aa-remove-unknown help

See merge request apparmor/apparmor!21

Acked-by: Tyler Hicks tyhicks@canonical.com for 2.9..trunk

(cherry picked from commit 3d40bc6f23)

4d4228d1 Don't print a literal '\n' in aa-remove-unknown help
2017-12-01 10:09:58 +00:00
Christian Boltz
b4310a9366 Merge branch 'cboltz-double-read-inactive' into 'master'
Let read_inactive_profiles() do nothing when calling it the second time

See merge request apparmor/apparmor!17

(cherry picked from commit 794d1c4a07)

b307e535 Let read_inactive_profiles() do nothing when calling it the second time
2017-11-28 21:56:38 +00:00
Christian Boltz
535b3074ab
Remember selected profile in save_profiles()
After using "view changes", the selection got reset to the first changed
profile. This could mislead the user into saving the wrong profile.

This patch ensures the selection is kept.

Cherry-picked from master 051be5dec0
(+ whitespace adjustments)

Acked-by: Tyler Hicks <tyhicks@canonical.com> for master and 2.11
2017-11-14 21:19:25 +01:00
Christian Boltz
50b7db4e3d
Fix sorted() regression in save_profiles()
The last change in save_profiles() sorted() the order in which the
changed profiles get displayed. However, it did not honor the sorting
when displaying changes or saving the selected profile, leading to the
wrong profile displayed or saved.

This patch fixes picking the selected profile, and at the same time
replaces the duplicated code for doing this with a single instance.

Note that the 2.11 branch needs a slightly different patch (different
indentation).

Also note that this regression made it into 2.11.1, so distributions
shipping 2.11.1 should add this patch.

Cherry-picked from master fe1fb7caa3
(+ whitespace adjusted)

Acked-by: Tyler Hicks <tyhicks@canonical.com> for master and 2.11
2017-11-14 21:19:17 +01:00
Christian Boltz
90e086986d Add python3.6 line to utils/logprof.conf
This is a backport of trunk r3718 by intrigeri


Acked-by: John Johansen <john.johansen@canonical.com> for 2.11 and 2.10 (on IRC)
2017-10-23 20:05:39 +02:00
Christian Boltz
bc5634f2af Fix save_profiles() for YaST
YaST has two issues in the "save changed profiles" dialog:
- when using "save selected", the list of profiles doesn't get updated.
  Update q.options inside the loop to fix this.
- the list of profiles is displayed as "["/usr/bin/foo", true]" instead
  of just "/usr/bin/foo". Use changed.keys() instead of changed to fix
  this. (text-mode aa-logprof doesn't change, it always displayed
  "/usr/bin/foo" and continues to do so.)

References: https://bugzilla.opensuse.org/show_bug.cgi?id=1062667 part a)


Acked-by: Seth Arnold <seth.arnold@canonical.com> for trunk and 2.11.

Note that 2.11 needs a slightly different patch (whitespace diff).
2017-10-12 13:28:51 +02:00
Christian Boltz
1f82a98029 Add network 'smc' keyword in NetworkRule and apparmor.d manpage
'smc' seems to be new in kernel 4.12.


Note that the 2.10 apparmor.d manpage also misses the 'kcm' keyword, so
the patch also adds it there.


Acked-by: Seth Arnold <seth.arnold@canonical.com> for trunk, 2.11 and 2.10.
2017-08-30 11:06:56 +02:00
Christian Boltz
3b490f9450 Prevent 'wa' conflicts for file rules
get_file_perms() and propose_file_rules() happily collect all file
permissions. This could lead to proposing 'wa' permissions in
aa-logprof, which then errored out because of conflicting permissions.

This patch adds a check to both functions that removes 'a' if 'w' is
present, and extends the tests to check this.


Acked-by: Seth Arnold <seth.arnold@canonical.com> for trunk and 2.11.

Note: Both functions (including this bug) were introduced together with
FileRule, so older releases are not affected.
2017-08-04 22:27:16 +02:00
Christian Boltz
66928660f5 Carry over all autodep-generated rules in handle_children()
When creating a new child profile, handle_children() did only copy over
include and path rules. While this was correct in the past, path rules
got changed to FileRule in the meantime and were therefore lost.
(In practise, this means the "$binary mr," rule wasn't added to the new
child profile, causing a "superfluous" question in aa-logprof.)

This patch changes handle_children() to carry over the complete new
child profile instead of only cherry-picking include and path rules.


Acked-by: Steve Beattie <steve@nxnw.org> for trunk and 2.11.

Older versions (with path as hasher) are not affected.
2017-08-02 13:26:49 +02:00
Jamie Strandboge
d2fc6ff1cc update aa-status.pod for updated podchecker
Bug-Ubuntu: https://launchpad.net/bugs/1707614

Signed-Off-By: Jamie Strandboge <jamie@canonical.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2017-07-31 10:22:33 -05:00
Christian Boltz
a90238e7c6 Add --no-reload to various utils manpages
This option exists in several aa-* tools since 2.9, but isn't mentioned
in the manpage.

Also drop some trailing whitespace in the manpages.


Acked-by: John Johansen <john.johansen@canonical.com>
for 2.9, 2.10, 2.11 and trunk.
2017-07-23 21:30:56 +02:00
Christian Boltz
7777b1418e Ignore ptrace log events without denied_mask
This fixes a crash in the tools.

Reported by peetaur on IRC.


Acked-by: John Johansen <john.johansen@canonical.com> for trunk and 2.11.
2017-05-20 01:06:39 +02:00