Commit graph

84 commits

Author SHA1 Message Date
Christian Boltz
977af8c5ac
Add 'mctp' network domain keyword
Reported as comment on https://build.opensuse.org/request/show/951354
(update to glibc 2.35)
2022-02-08 19:09:24 +01:00
Christian Boltz
1459f49b7a
Fix typo in manpage
Fixes: https://gitlab.com/apparmor/apparmor/-/issues/192
2021-08-17 19:43:53 +02:00
Christian Boltz
cc2d71023b
Improve AARE documentation in apparmor.d manpage
... as discussed on the mailinglist
2021-03-01 19:40:50 +01:00
intrigeri
d6e18b0db8 Fix typos
Spotted by Lintian.
2020-10-25 11:54:56 +00:00
John Johansen
0a52cf81e3 parser: add support for autobind sockets
af_unix allows for sockets to be bound to a name that is autogenerated.
Currently this type of binding is only supported by a very generic
rule.

  unix (bind) type=dgram,

but this allows both sockets with specified names and anonymous
sockets. Extend unix rule syntax to support specifying just an
auto bind socket by specifying addr=auto

eg.

  unix (bind) addr=auto,

It is important to note that addr=auto only works for the bind
permission as once the socket is bound to an autogenerated address,
the addr with have a valid unique value that can be matched against
with a regular

  addr=@name

expression

Fixes: https://bugs.launchpad.net/apparmor/+bug/1867216
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/521
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-09-29 03:34:56 -07:00
John Johansen
acb45dc4b0 parser: fix abi rule and pinned feature file interaction
In AppArmor 2 distros could pin the feature file being used by setting
the feature-file option in the config file.

With AppArmor 3 policy is now explicitly tagged with an abi rule.

The problem is the interaction on systems that have a mixture of
AppArmor 2 and AppArmor 3 policy and use feature pinning.

The feature pinning is required to make the apparmor 2 policy behave
as expected but it also overrides the abi rules that are explicitly
set as part of the policy. This means we either have the apparmor 2
pinned policy working as desired or the apparmor 3 policy, but not
both.

To fix this make setting the flag on command line or in config file
lower priority than an abi rule specified in policy. The ability
to override abi rules will be added in a separate patch.

The Priority ordering to determine the policy abi to use is
1. Use abi rules if present
2. if no abi rule use command line option
3. if no abi rule or command line option use config setting
4. if none of the above use the default abi

PR: https://gitlab.com/apparmor/apparmor/-/merge_requests/579
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-08-20 01:22:03 -07:00
John Johansen
0c9884550c parser: support enforce, kill and unconfined profile modes
The enforce profile mode is the default but specifying it explicitly
has not been supported. Allow enforce to be specified as a mode. If
no mode is specified the default is still enforce.

The kernel has supported kill and unconfined profile modes for a
long time now. And support to the parser so that profiles can make
use of these modes.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/440
Fixes: https://gitlab.com/apparmor/apparmor/-/issues/7
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <sbeattie@ubuntu.com>
2020-06-10 05:35:37 -07:00
John Johansen
162da1ba48 parser: add basic support for feature abis
Add basic support for policy to specify a feature abi. Under the
current implementation the first feature abi specified will be
used as the policy abi for the entire profile.

If no feature abi is defined before rules are processed then the
default policy abi will be used.

If multiple feature abi rules are encountered and the specified
abi is different then a warning will be issued, and the initial abi
will continue to be used. The ability to support multiple policy
feature abis during a compile will be added in a future patch.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/491
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <sbeattie@ubuntu.com>
2020-05-29 00:23:37 -07:00
John Johansen
7ca90ab637 Docs: man apparmor.d: Document the profile header
Documentation of the profile header: name, attachments and flags
is missing. Add basic documentation describing the header and
it components.

PR: https://gitlab.com/apparmor/apparmor/-/merge_requests/505
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <steve.beattie@canonical.com>
2020-05-04 18:59:42 -07:00
nl6720
452b5b8735 Add "run" variable
Signed-off-by: nl6720 <nl6720@gmail.com>
2020-02-13 13:45:45 +02:00
Christian Boltz
e5fdf8275e
Fix apparmor_xattrs typo in apparmor.d manpage 2020-02-02 17:12:40 +01:00
Ian Johnson
f4220a19be docs: fix typo in man doc of unix rules
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
2020-01-30 12:51:09 -08:00
John Johansen
095efb821f docs: update apparmor.d language description
Update the language description to provide some over arching
principles, such as the policy is declarative.

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
Acked-by: Steve Beattie <steve.beattie@canonical.com>
2019-11-09 14:05:22 -08:00
Tyler Hicks
7df48adae5 parser: Fix typoed example dbus rule in apparmor.d(5) man page
Remove extra closing parenthesis.

Bug: https://launchpad.net/bugs/1838991
Fixes: 46586a6334 ("parser: Add example dbus rule for unconfined peers")
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
2019-08-05 15:14:35 +00:00
Christian Boltz
115a1d890e
Drop 'to' option for link rules from manpage
The apparmor.d manpage listed 'to' as an alternative for '->' in link
rules.

However, the parser doesn't accept 'to', none of our examples and tests
include it, and nobody ever complained about it. Therefore I'll call
this a documentation bug ;-) and simply adjust the manpage to only list
'->' as valid syntax.
2019-04-22 12:46:37 +02:00
John Johansen
cfe20d2b63 Add support for profiles with xattrs matching
Add userland support for matching based on extended file attributes. This
leverages DFA based matching already in the kernel:

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=8e51f908
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=73f488cd

Matching is exposed via flags on the profile:

    /usr/bin/* xattrs=(user.foo=bar user.bar=foo) {
        # ...
    }

xattr values are appended to the existing xmatch via a null transition.

    $ echo '/usr/bin/* xattrs=(user.foo=foo user.bar=bar) {}' | \
        ./parser/apparmor_parser -QT -D expr-tree
    DFA: Expression Tree
    /usr/bin/[^\0000/]([^\0000/])*(\0000bar)?(\0000foo)?< 0x1>
    DFA: Expression Tree
    (\a|(\n|(\0002|\t)))< 0x4>

Tested manually on a 4.19 kernel via QEMU+KVM.

TODO:

  * ~~Add regression tests~~ (EDIT: done)
  * ~~EDIT: add support in the tools~~ (EDIT: done)

Questions for reviewers:

  * ~~parser/libapparmor: regex construction probably needs cleaning up~~ (EDIT: done)
  * ~~parser/parser_regex.c: confused what xmatch length is for~~ (EDIT: done)

/cc @mjg59

PR: https://gitlab.com/apparmor/apparmor/merge_requests/270
Signed-off-by: John Johansen <john.johansen@canonical.com>
2019-03-21 08:12:07 +00:00
Christian Boltz
6b2765637e
apparmor.d manpage: update list of network domain keywords
- add 'qipcrtr' and 'xdp'
- sort other keywords to the order in apparmor.vim
2019-03-14 21:54:30 +01:00
Eric Chiang
02da244316 parser: add a man page for xattrs
Signed-off-by: Eric Chiang <ericchiang@google.com>
2019-03-14 10:47:54 -07: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
2ea3309942 parser: add support for conditional includes
This is a minimal patch to add conditional includes to the profile
language.

The syntax for conditional includes is similar to regular includes
except with the addition of "if exists" after "include"

  include if exists <foo/bar>
  include if exists "foo/bar"
  include if exists "/foo/bar"
  include if exists foo/bar

Note: The patch is designed to be backportable with minimum
effort. Cleanups and code refactoring are planned for follow up
patches that won't be back ported.

Signed-off-by: John Johansen <john.johansen@canonical.com>
2018-01-20 00:32:20 -08:00
Christian Boltz
347715da30 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:19 +02:00
Christian Boltz
d8de3a1e20 Fix 'alias' rule description in apparmor.d manpage
The apparmor.d description about alias rules was broken in multiple
ways. The manpage
- didn't include the   alias   keyword
- listed alias rules in the "COMMA RULES" section - while that's correct
  for the comma requirement, it's also wrong because COMMA RULES is
  meant to be inside a profile
- didn't list alias rules in the PREAMBLE section

This patch fixes this.

It also moves the definition of VARIABLE, VARIABLE ASSIGNMENT (both
unchanged) and ALIAS RULE next to PREAMBLE.


Acked-by: Seth Arnold <seth.arnold@canonical.com> for trunk and 2.10
2016-11-16 20:38:54 +01:00
Christian Boltz
e0134514e2 add network 'kcm' keyword to apparmor.d manpage
I already did this in the python code a month ago, and now realized that
we should also update the apparmor.d manpage ;-)


Acked-by: Seth Arnold <seth.arnold@canonical.com> for trunk and 2.10.
2016-10-14 20:32:48 +02:00
Christian Boltz
c3bcdc32fb Document aliases for dbus send and receive in apparmor.d
Acked-by: Tyler Hicks <tyhicks@canonical.com>
2016-06-01 22:55:14 +02:00
Tyler Hicks
138a9bf9ef parser: Document change_profile exec modes in apparmor.d man page
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: John Johansen <john.johansen@canonical.com>
2016-05-31 15:38:36 -05: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
Steve Beattie
e69891c222 man page touchups
This makes some of the references to functions in the aa_query_label(2)
manpage more consistent and fixes a couple of grammar issues. It also
tries to make the qualifying statements in apparmor.d(5) more distinct,
and also fixes some typos there as well.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Tyler Hicks <tyhicks@canonical.com>
2016-03-19 01:48:11 -07:00
Christian Boltz
f139b522ef apparmor.d.pod: document 'deny x'
deny rules don't allow ix, Px, Ux etc. - only 'deny /foo x,' is allowed.


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


Note: Seth mentioned in the mail that he doesn't like the 'deny x'
section too much, but we didn't find a better solution when discussing
it on IRC. Therefore I keep the patch unchanged, but will happily
review a follow-up patch if someone sends one ;-)
2016-02-12 21:43:00 +01:00
Christian Boltz
1d51eef8ca Add realtime signals to SIGNALS list in apparmor.d
Acked-by: Seth Arnold <seth.arnold@canonical.com> for trunk, 2.10 and 2.9.
2015-12-02 22:05:21 +01:00
Christian Boltz
c1082b7b13 Add realtime signal example to the apparmor.d manpage
Acked-by: Steve Beattie <steve@nxnw.org> for trunk, 2.10 and 2.9.
2015-12-02 20:09:47 +01:00
Christian Boltz
5755576b17 Add missing variables to the apparmor.d manpage
@{pids} and @{apparmorfs} was not mentioned in the apparmor.d manpage.


Acked-by: John Johansen <john.johansen@canonical.com> for trunk, 2.10 and 2.9
2015-11-28 21:44:51 +01:00
Christian Boltz
68854c5faa Add network mpls and ib to rule/network.py and the apparmor.d manpage
Those two showed up in apparmor.vim when building on latest openSUSE
tumbleweed.


Acked-by: Kshitij Gupta <kgupta8592@gmail.com>
2015-08-25 13:27:18 +02:00
Christian Boltz
4acfa81c17 Fix rlimit time units in apparmor.d.pod
- fix double | | between 's' and 'sec'
- remove 'm' which is not supported by the code
- add missing 'd'


Acked-by: Steve Beattie <steve@nxnw.org>
2015-07-11 16:56:07 +02:00
John Johansen
5fd832f004 fix: rlimit unit parsing for time
currently the parser supports ambiguous units like m for time,
which could mean minutes or milliseconds. Fix this and refactor the
time parsing into a single routine.

Signed-off-by: John Johansen <john.johansen@canonical.com>
Signed-off-by: Steve Beattie <steve@nxnw.org>
2015-07-10 18:16:09 -07:00
Christian Boltz
1b670fef6c Fix NETWORK RULE in apparmor.d manpage
It's allowed to only specify a TYPE without specifying a DOMAIN.

Also add a missing "]" for QUALIFIERS.


Acked-by: Seth Arnold <seth.arnold@canonical.com>
2015-06-26 12:46:46 +02:00
Christian Boltz
5e0d6456e2 Add quotes around '->' at various places in apparmor.d.pod.
Also fix a Cux that should be CUx.


Acked-By: Seth Arnold <seth.arnold@canonical.com> for 2.9 and trunk
2015-06-13 01:01:55 +02:00
Steve Beattie
23a2d8b68c This patch fixes several formatting issues with the apparmor.d man page:
- missing formatting code prefixes, usually I for BNFish arguments
 - added blank lines before preformatted sections as the html formatter
   wasn't treating them as seperate from the preceding text (also, they
   generated podchecker warnings)
 - fixed a grammar issue
 - fixed link description text block that was mistakenly indented and
   thus treated as preformatted text
 - moved the "Qualifier Blocks" subsection out of the =over/=back as
   all the pod tools did not like this and it caused podchecker to exit
   with an error, breaking builds that ran make check on the parser
   tree.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2015-06-02 16:05:37 -07:00
John Johansen
4afcf91162 Add documentation of qualifier blocks to apparmor.d man page
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2015-06-02 01:00:29 -07:00
John Johansen
04dfc5d975 Add missing I<ALIAS RULE> to B<COMMA RULES> pattern
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2015-06-02 01:00:29 -07:00
John Johansen
d506ecfd4d apparmor.d.pod: refactor profile file, profile, subprofile, hat patterns
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2015-06-02 01:00:29 -07:00
John Johansen
8ffec9357d apparmor.d.pod: create RULES grouping and cleanup profile PROFILE rule
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2015-06-02 01:00:29 -07:00
Christian Boltz
332ee0cba7 Update list of network domains in apparmor.d manpage
Add several missing network DOMAINs to the apparmor.d manpage.

The list is based on the list that utils/vim/Makefile generates.


Acked-by: John Johansen <john.johansen@canonical.com>
2015-04-27 21:37:47 +02:00
John Johansen
471f90e499 Fix unresolved Merge conflict in apparmor.d.pod RLIMIT RULE
Signed-off-by: John Johansen <john.johansen@canonical.com>
2015-03-24 14:56:40 -07:00
John Johansen
553d98cf9c Add basic documentation of apparmor rlimit controls
buglink: https://launchpad.net/bugs/1429202

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2015-03-24 03:54:10 -07:00
John Johansen
ebef7d0ca1 update apparmor.d man page to file rule pattern
Update the file rule pattern to show it is possible to specify a bare
file rule. Eg.

  file,

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2015-03-24 03:53:03 -07:00
John Johansen
a41a887c17 Fix use of FILEGLOB in apparmor.d.pod
Refactor FILEGLOB so that it means both quoted and unquoted file globs.

Also
FILEGLOB was uncorrectly referenced in a few places where it should have
allowed for quoting.

There were also a few places that provided a parameter description with
FILEGLOB without defining that that is full equivalent to FILEGLOB.

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2015-03-24 03:52:58 -07:00
John Johansen
4ba7f860ac Add basic info about link rules to apparmor.d man page
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2015-03-24 03:52:51 -07:00
John Johansen
c92b5c71e5 Update apparmor.d man page to document file rules with leading permissions
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2015-03-24 03:52:43 -07:00
John Johansen
6c5cf445c4 Update exec transition documentation.
Add miss ix and ux fallback permission modes, named profile transitions.
Also fix the file access modes and rule pattern to properly reflect
what is allowed.

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2015-03-24 03:52:36 -07:00
John Johansen
cf68b13042 Add basic documentation of change_profile rules to apparmor.d man page
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2015-03-24 03:52:31 -07:00