Commit graph

32 commits

Author SHA1 Message Date
Christian Boltz
608f6493be delete traces of program-chunks directory from apparmor.d(5)
Acked-by: Tyler Hicks <tyhicks@canonical.com>
2015-02-26 18:44:22 +01:00
Christian Boltz
5af5ebc412 fix network rule description in apparmor.d.pod
Acked-by: John Johansen <john.johansen@canonical.com>
2014-12-19 02:14:26 +01:00
Tyler Hicks
d336d23e4d parser: Sync mount options parsing and documentation
There are a number of differences between what the apparmor.d(5) man
page lists as valid AppArmor mount rule options and what apparmor_parser
looks for when parsing mount rules. There are also typos in the man page
and parser around mount options. Here's the breakdown of problems and
fixes made in this patch:

 * The apparmor.d(5) man page improperly documented a "nodirsync"
   option.
   - That mount option does not exist and the parser did not honor it.
     Remove the mention from the apparmor.d(5) man page.
 * The loud option was typoed as "load" in both the man page and parser
   - There's no sense in preserving backwards compatibility. "load" is
     simply wrong and should not be honored. The man page and parser are
     updated to only use "loud".
 * The rbind option wasn't listed in the man page.
   - Add rbind to the man page. No change needed for the parser.
 * The documented unbindable, private, slave, and shared options were
   not correctly parsed. The parser expected
   make-{unbindable,private,slave,shared}.
   - The parser is updated to accept both the documented
     {unbindable,private,slave,shared} options and their variants
     prefixed with "make-". The man page will not document the "make-"
     variants.
 * The recursive {runbindable,rprivate,rslave,rshared} options were not
   documented and were only recognized by the parser if they were
   prefixed with "make-".
   - The man page is updated to document the option strings that are not
     prefixed with "make-". The parser still accepts the "make-"
     variants.
 * The man page documented a "rec" option but the parser didn't honor
   it. The MS_REC macro is used by the mount utility to be bitwise OR'ed
   with MS_{UNBINDABLE,PRIVATE,SLAVE,SHARED} to indicate the
   corresponding recursive mount options.
   - This is not an option that should be exposed in the AppArmor policy
     since we already allow have the
     {runbindable,rprivate,rslave,rshared} options.
 * The man page typoed the {no,}relatime options as {no,}relative.
   - The man page is updated to document the correct option strings. The
     parser requires no change.

Bug: https://bugs.launchpad.net/bugs/1401619

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: John Johansen <john.johansen@canonical.com>
2014-12-12 08:20:31 -06:00
Tyler Hicks
a154d14f5a parser: Sync parser and man page regarding local and peer perms
This patch updates the parser code to reject rules that contain local
socket permissions and peer conditional elements. The error message for
that condition is also corrected to resolve a copy and paste mistake
from the D-Bus rule parsing code.

The patch also updates the man page to correctly describe the two sets
of socket permissions and fixes an example rule that resulted in a
parser error after the change described above.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
2014-09-22 11:34:32 -05:00
Steve Beattie
c48d7dc71f manpages: incorporate podchecker; fix errors and (most) warnings
This patch adds a 'check_pod_files' make target to the common make
rules, and then fixes the errors it highlighted as well as most of
the warnings. It will cause 'make check' in most of the directories to
fail if there are errors in a pod file (but not if there are warnings).

Common issues were:

  - using an '=over/=back' pair for code-like snippets that did not
    contain any =items therein; the =over keyword is intended for
    indenting lists of =item entries, and generates a warning if
    there isn't any.

  - not escaping '<' or '>'

  - blank lines that contained spaces or tabs

The second -warnings flag passed to podchecker is to add additional
warnings, un-escaped '<' and '>' being of them.

I did not fix all of the warnings in apparmor.d.pod, as I have not come
up with a good warning-free way to express the BNF of the language
similar in format to what is currently generated. The existing
libapparmor warnings (complaints about duplicate =item definition
names) are actually a result of passing the second -warnings flag.
The integration into libapparmor is suboptimal due to automake's
expectation that there will be a test driver program(s) for make check
targets; that's why I added the podchecker call to the manpage
generation point.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
---
 changehat/mod_apparmor/Makefile         |    3 
 changehat/mod_apparmor/mod_apparmor.pod |   28 ++-
 common/Make.rules                       |    4 
 libraries/libapparmor/doc/Makefile.am   |    7 
 parser/Makefile                         |    2 
 parser/apparmor.d.pod                   |  275
+++++++++++++-------------------
 utils/Makefile                          |    3 
 utils/aa-cleanprof.pod                  |    2 
 utils/aa-complain.pod                   |    2 
 utils/aa-decode.pod                     |    2 
 utils/aa-easyprof.pod                   |   69 +++-----
 utils/aa-enforce.pod                    |    2 
 utils/aa-genprof.pod                    |    2 
 utils/aa-logprof.pod                    |    6 
 utils/aa-sandbox.pod                    |   64 ++-----
 utils/logprof.conf.pod                  |    2 
 utils/vim/Makefile                      |    2 
 17 files changed, 212 insertions(+), 263 deletions(-)
2014-09-15 11:30:47 -07:00
Jamie Strandboge
5bd93faf73 man page updates for abstract, anonymous and netlink sockets
- fix typo
- fix whitespace
- add netlink
- update for change from path to addr
- remove TODO items
- add and document examples
- remove undocumented 'unix server addr=@foo,' example

Signed-off-by: Jamie Strandboge <jamie@canonical.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-09-04 10:53:13 -07:00
Steve Beattie
e85777a57c parser: Convert af_unix rules to support addr= rather than path=
This patch converts the path= modifier to the af_unix rules to use
addr= instead.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-09-03 14:02:25 -07:00
John Johansen
dd44858e60 parser: first step implementing fine grained mediation for unix domain sockets
This patch implements parsing of fine grained mediation for unix domain
sockets, that have abstract and anonymous paths. Sockets with file
system paths are handled by regular file access rules.

The unix network rules follow the general fine grained network
rule pattern of

  [<qualifiers>] af_name [<access expr>] [<rule conds>] [<local expr>] [<peer expr>]

specifically for af_unix this is

  [<qualifiers>] 'unix' [<access expr>] [<rule conds>] [<local expr>] [<peer expr>]

  <qualifiers> = [ 'audit' ] [ 'allow' | 'deny' ]

  <access expr> = ( <access> | <access list> )

  <access> = ( 'server' | 'create' | 'bind' | 'listen' | 'accept' |
               'connect' | 'shutdown' | 'getattr' | 'setattr' |
	       'getopt' | 'setopt' |
               'send' | 'receive' | 'r' | 'w' | 'rw' )
  (some access modes are incompatible with some rules or require additional
   parameters)

  <access list> = '(' <access> ( [','] <WS> <access> )* ')'

  <WS> = white space

  <rule conds> = ( <type cond> | <protocol cond> )*
     each cond can appear at most once

  <type cond> = 'type' '='  ( <AARE> | '(' ( '"' <AARE> '"' | <AARE> )+ ')' )

  <protocol cond> = 'protocol' '='  ( <AARE> | '(' ( '"' <AARE> '"' | <AARE> )+ ')' )

  <local expr> = ( <path cond> | <attr cond> | <opt cond> )*
     each cond can appear at most once

  <peer expr> = 'peer' '=' ( <path cond> | <label cond> )+
     each cond can appear at most once

  <path cond> = 'path' '=' ( <AARE> | '(' '"' <AARE> '"' | <AARE> ')' )

  <label cond> = 'label' '=' ( <AARE> | '(' '"' <AARE> '"' | <AARE> ')')

  <attr cond> = 'attr' '=' ( <AARE> | '(' '"' <AARE> '"' | <AARE> ')' )

  <opt cond> = 'opt' '=' ( <AARE> | '(' '"' <AARE> '"' | <AARE> ')' )

  <AARE> = ?*[]{}^ ( see man page )

 unix domain socket rules are accumulated so that the granted unix
 socket permissions are the union of all the listed unix rule permissions.

 unix domain socket rules are broad and general and become more restrictive
 as further information is specified. Policy may be specified down to
 the path and label level. The content of the communication is not
 examined.

 Some permissions are not compatible with all unix rules.

 unix socket rule permissions are implied when a rule does not explicitly
 state an access list. By default if a rule does not have an access list
 all permissions that are compatible with the specified set of local
 and peer conditionals are implied.

 The 'server', 'r', 'w' and 'rw' permissions are aliases for other permissions.
 server = (create, bind, listen, accept)
 r = (receive, getattr, getopt)
 w = (create, connect, send, setattr, setopt)

In addition it supports the v7 kernel abi semantics around generic
network rules. The v7 abi removes the masking unix and netlink
address families from the generic masking and uses fine grained
mediation for an address type if supplied.

This means that the rules

  network unix,
  network netlink,

are now enforced instead of ignored. The parser previously could accept
these but the kernel would ignore anything written to them. If a network
rule is supplied it takes precedence over the finer grained mediation
rule. If permission is not granted via a broad network access rule
fine grained mediation is applied.

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-09-03 13:22:26 -07:00
Jamie Strandboge
24210c084d Author: John Johansen <john.johansen@canonical.com>,
Jamie Strandboge <jamie@canonical.com>
Description: man page updates for signals, ptrace and new variables

Acked-By: Jamie Strandboge <jamie@canonical.com>
Acked-by: John Johansen <john.johansen@canonical.com>
2014-05-15 17:22:21 -05:00
Tyler Hicks
ea4cbd68e7 parser: Document that pivot_root arguments must end in '/'
Mention, in the apparmor.d man page, that pivot_root arguments must end
with a '/' character since they are directories.

The parser currently allows pivot_root arguments that do not end in '/',
but those rules will always fail to match.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-05-05 11:36:00 -05:00
Tyler Hicks
46586a6334 parser: Add example dbus rule for unconfined peers
It may not be obvious that the peer label can be "unconfined". Provide
an example rule, in the apparmor.d man page, demonstrating the
peer=(label=unconfined) conditional.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-05-05 11:35:50 -05:00
Tyler Hicks
d44a16e1f0 parser: Document pivot_root in the apparmor.d(5) man page
This patch separates pivot_root rules from mount rules, since the syntax
of the two types of rules is very different. It also documents the
missing "oldroot=" prefix required for the conditional corresponding to
the put_old parameter. Finally, it briefly describes pivot_root rules
and provides some examples.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-04-14 21:52:02 -05:00
Tyler Hicks
99e509065f parser: Document eavesdropping permission syntax in apparmor.d(5)
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2013-12-06 11:18:17 -08:00
Tyler Hicks
1aba3394a3 parser: Update man page for DBus rules
Document the DBus rule syntax and provide several examples.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2013-07-31 09:03:15 -07:00
Jamie Strandboge
852907e1cc clarifications for mount rules
Acked-By: Jamie Strandboge <jamie@canonical.com>
Acked-By: Steve Beattie <sbeattie@ubuntu.com>
Acked-by: John Johansen <john.johansen@canonical.com>
2012-04-11 16:34:22 -05:00
Jamie Strandboge
50aa2335eb remove unintended comma from parser/apparmor.d.pod
Acked-By: Jamie Strandboge <jamie@canonical.com>
Acked-By: Steve Beattie <sbeattie@ubuntu.com>
2012-04-11 11:53:16 -05:00
Jamie Strandboge
24e46508d5 parser/apparmor.d.pod: add mount rule syntax and usage. Refinements and
clarifications thanks to Steve Beattie.

Acked-By: Jamie Strandboge <jamie@canonical.com>
Acked-By: Steve Beattie <sbeattie@ubuntu.com>
2012-04-11 11:10:29 -05:00
John Johansen
e61b7b9241 Update the copyright dates for the apparmor_parser
Signed-off-by: John Johansen <john.johansen@canonical.com>
2012-02-24 04:21:59 -08:00
Christian Boltz
c5dca95504 apparmor.d.pod:
- fix ALPHANUMERIC to include 0...9 instead of 1...9
- enforce linebreaks for network example rules

Acked-By: Steve Beattie <sbeattie@ubuntu.com>
2011-04-01 20:35:14 +02:00
Steve Beattie
f8b43d5ba9 The parser's lexer supports variables defined matching the regex
'[[:alpha:]][[:alnum:]_]*' (i.e. a single alpha followed by any number
of alphanumerics or underscores). Unfortunately, the code that expends
variables inside a profile does not match this, it incorrectly matched
'([[:alpha:]]|_)+' (one or more alphas or underscores). This patch
corrects the behavior there as well as synchronizing the expected
variable names in the apparmor.d manpage and apparmor.vim syntax file.

It also adds unit tests and testcases to verify the behavior.

Signed-off-by: Steve Beattie <sbeattie@ubuntu.com>
2011-03-28 10:52:02 -07:00
Kees Cook
723a20ba7d as ACKed on IRC, drop the unused $Id$ tags everywhere 2010-12-20 12:29:10 -08:00
Jamie Strandboge
49f27414e0 update the man pages to:
* add Canonical to the headers of the pod files touched
  * use aa_change_hat() instead of change_hat() (LP: #692216)
  * use http://wiki.apparmor.net in the SEE ALSO
  * use http://https://bugs.launchpad.net/apparmor/+filebug for bugs
  * prefix 'aa-' in SEE ALSO section for utilities (eg, 'aa-complain' for
    'complain')
2010-12-20 13:47:09 -06:00
Jamie Strandboge
e5f4aa4140 parser/apparmor.d.pod: more fully document child profiles, including:
- cx and Cx
  - change_profile()
2010-12-20 13:40:59 -06:00
Jamie Strandboge
289dcfb492 add [^] 2010-12-20 12:50:53 -06:00
Jamie Strandboge
79828d1f10 LP: #349049: document audit, deny and owner rule qualifiers 2010-12-20 12:48:26 -06:00
Jamie Strandboge
2ade2782d4 parser/apparmor.d.pod: clarify alias rules 2010-12-20 08:34:12 -06:00
Jamie Strandboge
d98c8ae8b5 add commented, but blank tunables/alias
profiles/apparmor.d/tunables/global: include tunables/alias
parser/apparmor.d.pod: add alias rules and home.d. clean up
 HOMEDIRS
2010-01-11 14:19:35 -06:00
John Johansen
486bb79ef7 merge over r1088 - Add descriptiion of append, lock and network rules to the man page 2008-02-19 10:19:28 +00:00
Steve Beattie
3216755358 Patch by jjohansen@suse.de
Acked-By: Steve Beattie <sbeattie@suse.de>

Use correct terminology; convert unconstrained to unconfined.
2007-07-27 20:45:45 +00:00
Seth Arnold
a48588ef80 clean up the BNF-ish language description; indicate the trailing-slash requirement for directories; add a few new change_hat applications 2007-04-11 23:47:58 +00:00
John Johansen
cd79c1ac77 update copyright dates 2007-04-11 08:12:51 +00:00
Steve Beattie
24606ec70b Subject: Add manpages to the parser package
Move the apparmor.d(5), apparmor(7), apparmor_parser(8),
subdomain.conf(5) and apparmor.vim(5) (for lack of a better location)
into the apparmor-parser package.
2007-04-03 19:04:10 +00:00
Renamed from docs/apparmor.d.pod (Browse further)