Commit graph

3022 commits

Author SHA1 Message Date
Steve Beattie
37adff769c utils tests: restructure mount parse tests
Convert the mount parse tests to use common AAParseTest super class in
common_test.py.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2014-09-03 18:28:18 -07:00
Steve Beattie
59b5b8bab6 Subject: utils tests: restructure DBUS parse tests
Convert the DBUS parse tests to use common AAParseTest super class in
common_test.py.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2014-09-03 18:26:19 -07:00
Steve Beattie
365b6d603c utils tests: restructure Unix Parse tests
This patch abstracts out parse tests into a super class to inherit from
and converts the af_unix parse tests to use the super class.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2014-09-03 18:24:57 -07:00
Steve Beattie
74da13e7a3 utils: convert raw rules classes to subclass from _Raw_Rule
The patch that adds support for af_unix rules added a _Raw_Rule base
class to inherit from in rules.py. This patch converts the rest of the
raw rules classes to use the same.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2014-09-03 18:23:38 -07:00
Steve Beattie
b86d83759a Subject: utils tests: assign regex function at test setup
This patch moves the assignment of the regex function into the unittest
setUp() function rather than at script load time. If for some reason
the python utils library does not define the relevant function, without
this patch the script fails entirely; with it, each individual test
class that depends on the missing regex will fail each test case.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2014-09-03 18:22:04 -07:00
Steve Beattie
6d34893d4d utils: add limited support for af_unix rules
This patch adds limited support for af_unix rules in the python
utilities, of the "don't touch them, but don't throw a python backtrace
when coming across them, either" variety. Testcases are added as well.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2014-09-03 18:18:33 -07:00
Christian Boltz
9e4c01f8d3 Add a warning to aa-mergeprof --help that the syntax will change in the
future. Also remove --auto, which is not implemented yet.
2014-09-04 01:49:47 +02:00
John Johansen
29c776e4fc parser: fix rejecting of unix rules with listen or bind permissions
Only reject rules with explicit listen or bind permissions if a peer
conditional is specified.

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-09-03 16:09:06 -07:00
John Johansen
e119901e3a parser: fix output of listen and setopts commands
The listen and setopts commands have broken encodings because the
tmp stream they use to handle diverging from the other commands
has does not set its write position to to the end of the copied data.
Instead the write head is set to the beginning so that when the
new data for the command is written it overwrites the begging of
the command instead of appending to it.

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-09-03 16:04:31 -07:00
John Johansen
4a616e3545 parser: allow specifying the unix perm with peer perms
Fix to allow specifying the unix perm with peer perms. This is allowed
now and even supported, since for unix sockets the peer accept is
mediated in the unix_stream_connect hook (something that is not
possible in the lsm accept hook).

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-09-03 16:01:37 -07:00
John Johansen
4f80b4d5ca parser: change/fix the encoding for unix socket rules.
This changes/fixes the encoding for unix socket rules. The changes
look larger than they are because it refactors the code, instead
of duplicating.

The major changes are:
- it changes where the accept perm is stored
- it moves anyone_match_pattern to default_match_pattern
- it fixes the layout of the local addr only being written when local
  perms are present

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
2014-09-03 15:57:17 -07:00
Tyler Hicks
0005895e3d parser: Don't write the stream's address to the rule buffer
The writeu16() function was returning the address of the passed in
std::ostringstream and then the callers of that function were
incorrectly writing that address to the rule buffer.

Before:

  $ echo "/t { unix (connect,read,write) type=stream, }" |
apparmor_parser -qQD dfa-states
  {1} <== (allow/deny/audit/quiet)
  {2} (0x 4/0/0/0)
  {3} (0x 4/0/0/0)
  {43} (0x 46/0/0/0)
  {44} (0x 46/0/0/0)
  
  {1} -> {2}: 0x2
  {1} -> {3}: 0x4
  {1} -> {2}: 0x7
  {1} -> {2}: 0x9
  {1} -> {2}: 0xa
  {1} -> {2}: 0x20 \ 
  {1} -> {4}: 0x34 4
  {3}  (0x 4/0/0/0) -> {5}: 0x0
  {4} -> {6}: 0x0
  {5} -> {7}: 0x1
  {6} -> {2}: 0x31 1
  {7} -> {8}: 0x30 0
  {8} -> {9}: 0x78 x
  {9} -> {10}: 0x37 7
  {10} -> {11}: 0x66 f
  {11} -> {12}: 0x66 f
  {12} -> {13}: 0x66 f
  {13} -> {14}: 0x31 1
  {14} -> {15}: 0x30 0
  {15} -> {16}: 0x34 4
  {16} -> {17}: 0x66 f
  {17} -> {18}: 0x33 3
  {18} -> {19}: 0x35 5
  {19} -> {20}: 0x31 1
  {20} -> {21}: 0x38 8
  {21} -> {22}: 0x0
  {22} -> {23}: 0x1
  {23} -> {24}: 0x30 0
  {24} -> {25}: 0x78 x
  {25} -> {26}: 0x37 7
  {26} -> {27}: 0x66 f
  {27} -> {28}: 0x66 f
  {28} -> {29}: 0x66 f
  {29} -> {30}: 0x31 1
  {30} -> {31}: 0x30 0
  {31} -> {32}: 0x34 4
  {32} -> {33}: 0x66 f
  {33} -> {34}: 0x33 3
  {34} -> {35}: 0x35 5
  {35} -> {36}: 0x31 1
  {36} -> {37}: 0x38 8
  {37} -> {38}: []
  {38} -> {39}: []
  {39} -> {40}: 0x0
  {39} -> {39}: []
  {40} -> {40}: 0x0
  {40} -> {41}: 0x1
  {40} -> {39}: []
  {41} -> {42}: 0x0
  {41} -> {39}: []
  {42} -> {40}: 0x0
  {42} -> {44}: 0x1
  {42} -> {43}: []
  {43}  (0x 46/0/0/0) -> {40}: 0x0
  {43}  (0x 46/0/0/0) -> {43}: []
  {44}  (0x 46/0/0/0) -> {42}: 0x0
  {44}  (0x 46/0/0/0) -> {43}: []

After:

  $ echo "/t { unix (connect,read,write) type=stream, }" |
apparmor_parser -qQD dfa-states
  {1} <== (allow/deny/audit/quiet)
  {2} (0x 4/0/0/0)
  {3} (0x 4/0/0/0)
  {15} (0x 46/0/0/0)
  {16} (0x 46/0/0/0)
  
  {1} -> {2}: 0x2
  {1} -> {3}: 0x4
  {1} -> {2}: 0x7
  {1} -> {2}: 0x9
  {1} -> {2}: 0xa
  {1} -> {2}: 0x20 \ 
  {1} -> {4}: 0x34 4
  {3}  (0x 4/0/0/0) -> {5}: 0x0
  {4} -> {6}: 0x0
  {5} -> {7}: 0x1
  {6} -> {2}: 0x31 1
  {7} -> {8}: 0x0
  {8} -> {9}: 0x1
  {9} -> {10}: []
  {10} -> {11}: []
  {11} -> {12}: 0x0
  {11} -> {11}: []
  {12} -> {12}: 0x0
  {12} -> {13}: 0x1
  {12} -> {11}: []
  {13} -> {14}: 0x0
  {13} -> {11}: []
  {14} -> {12}: 0x0
  {14} -> {16}: 0x1
  {14} -> {15}: []
  {15}  (0x 46/0/0/0) -> {12}: 0x0
  {15}  (0x 46/0/0/0) -> {15}: []
  {16}  (0x 46/0/0/0) -> {14}: 0x0
  {16}  (0x 46/0/0/0) -> {15}: []

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-09-03 15:46:39 -07:00
Tyler Hicks
b5c3ce638d parser: Adjust writeu16() to output escaped byte sequences
The writeu16() function was outputting unescaped byte sequences to the
rule buffer. That resulted the generation of in an incomplete rule if
one of those unescaped byte sequences contained 0x00.

This patch uses u8 pointers, instead of char pointers, when writing out
the big endian u16 value. More importantly, it casts the u8 values to
unsigned ints, which is what's needed to get the properly escaped byte
sequences.

Before:

  $ echo "/t { unix (connect,read,write) type=stream, }" |
apparmor_parser -qQD dfa-states
  {1} <== (allow/deny/audit/quiet)
  {2} (0x 4/0/0/0)
  {3} (0x 4/0/0/0)
  {5} (0x 46/0/0/0)
  
  {1} -> {2}: 0x2
  {1} -> {3}: 0x4
  {1} -> {2}: 0x7
  {1} -> {2}: 0x9
  {1} -> {2}: 0xa
  {1} -> {2}: 0x20 \ 
  {1} -> {4}: 0x34 4
  {3}  (0x 4/0/0/0) -> {5}: 0x0
  {4} -> {6}: 0x0
  {6} -> {2}: 0x31 1
  

After (the next patch fixes the pointer values that are being written
out):

  $ echo "/t { unix (connect,read,write) type=stream, }" |
apparmor_parser -qQD dfa-states
  {1} <== (allow/deny/audit/quiet)
  {2} (0x 4/0/0/0)
  {3} (0x 4/0/0/0)
  {43} (0x 46/0/0/0)
  {44} (0x 46/0/0/0)
  
  {1} -> {2}: 0x2
  {1} -> {3}: 0x4
  {1} -> {2}: 0x7
  {1} -> {2}: 0x9
  {1} -> {2}: 0xa
  {1} -> {2}: 0x20 \ 
  {1} -> {4}: 0x34 4
  {3}  (0x 4/0/0/0) -> {5}: 0x0
  {4} -> {6}: 0x0
  {5} -> {7}: 0x1
  {6} -> {2}: 0x31 1
  {7} -> {8}: 0x30 0
  {8} -> {9}: 0x78 x
  {9} -> {10}: 0x37 7
  {10} -> {11}: 0x66 f
  {11} -> {12}: 0x66 f
  {12} -> {13}: 0x66 f
  {13} -> {14}: 0x31 1
  {14} -> {15}: 0x30 0
  {15} -> {16}: 0x34 4
  {16} -> {17}: 0x66 f
  {17} -> {18}: 0x33 3
  {18} -> {19}: 0x35 5
  {19} -> {20}: 0x31 1
  {20} -> {21}: 0x38 8
  {21} -> {22}: 0x0
  {22} -> {23}: 0x1
  {23} -> {24}: 0x30 0
  {24} -> {25}: 0x78 x
  {25} -> {26}: 0x37 7
  {26} -> {27}: 0x66 f
  {27} -> {28}: 0x66 f
  {28} -> {29}: 0x66 f
  {29} -> {30}: 0x31 1
  {30} -> {31}: 0x30 0
  {31} -> {32}: 0x34 4
  {32} -> {33}: 0x66 f
  {33} -> {34}: 0x33 3
  {34} -> {35}: 0x35 5
  {35} -> {36}: 0x31 1
  {36} -> {37}: 0x38 8
  {37} -> {38}: []
  {38} -> {39}: []
  {39} -> {40}: 0x0
  {39} -> {39}: []
  {40} -> {40}: 0x0
  {40} -> {41}: 0x1
  {40} -> {39}: []
  {41} -> {42}: 0x0
  {41} -> {39}: []
  {42} -> {40}: 0x0
  {42} -> {44}: 0x1
  {42} -> {43}: []
  {43}  (0x 46/0/0/0) -> {40}: 0x0
  {43}  (0x 46/0/0/0) -> {43}: []
  {44}  (0x 46/0/0/0) -> {42}: 0x0
  {44}  (0x 46/0/0/0) -> {43}: []

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-09-03 15:10:41 -07:00
Steve Beattie
4ed3dd090d parser: let unix keyword accept bare send, receive keywords
Let unix keyword accept bare send, receive keywords and add more
simple unix acceptance test cases.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-09-03 15:05:56 -07:00
Steve Beattie
ab93c858d3 parser: initialize perms in unix_rule constructor
Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-09-03 15:03:05 -07:00
John Johansen
e811d8f2bf parser: map net permission set into a form compatible with the old dfa table
The old dfa table format has 2 64 bit permission field used to store
all of allow, quiet, audit, owner/!owner and transition mask. This
leaves 7 bits for entry + a few other special bits.

Since policydb entries when using old style dfa permission format
don't use support the !owner permission entries we can map, the
high net work permission bits to these entries.

This allows us to enforce base network permissions on system with
only support for the old dfa table format.

  Bits 0-7 inclusive stay put
  Bits 8-9 inclusive move (14 - 8) = 6 to 14-15 GETATTR | SETATTR
  Bits 20-22 inclusive move -4 to 16-18  ACCEPT | BIND | LISTEN  (notice 22 not 23)
  Bit 23 is skipped, hence the need to shift 5 for 24-25 instead of 4
  Bits 24-25 inclusive move -5 to 19-20

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
2014-09-03 14:50:22 -07:00
John Johansen
19c942e5c2 parser: split accept perm processing from rule parsing
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-09-03 14:40:08 -07:00
John Johansen
fb53ec793b parser: Refactor add_new_state into two versions
Refactor add_new_state into two versions, one that splits anodes from
nnodes, and one for use when anodes and nnodes are presplit

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-09-03 14:36:08 -07:00
John Johansen
df961a3e02 parser: Refactor the process_work_queue code into its own fn
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-09-03 14:32:52 -07:00
John Johansen
e86f850d59 parser: Refactor accept nodes to be common to a shared node type
The shared node type will be used in the future to add new capabilities

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
2014-09-03 14:29:35 -07:00
John Johansen
ee7bf1dc28 parser: Refactor rule accumulation to use some helper functions
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-09-03 14:24:37 -07:00
John Johansen
73c74d044d parser: Move nodeset caching into expr-tree.h
We need to rework permission type mapping to nodesets, which means we
need to move the nodeset computations earlier in the dfa creation
processes, instead of a post step of follow(), so move the nodeset
into expr-tree

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-09-03 14:21:18 -07:00
Steve Beattie
831db5985f parser: update test features file for af_unix feature
This patch tells the parser to do af_unix processing while running the
parser sanity tests, letting the af_unix tests generate the correct
results.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: John Johansen <john.johansen@canonical.com>
2014-09-03 14:12:50 -07:00
Steve Beattie
ade71dc171 parser: Fix segfault in af_unix rule processing
This patch fixes a segfault that was occurring in testing over the
weekend. The problem existed in the original patch that adds af_unix
rules (lp:apparmor commit 2615).

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: John Johansen <john.johansen@canonical.com>
2014-09-03 14:08:48 -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
Tyler Hicks
5b46e3b334 parser: Fix AF_UNIX stub rule creation
The patch titled "parser: Add support for unix domain socket rules."
modified the code the creates the stub rules for rule types that the
parser supports.

It added new stub rules for extended network and AF_UNIX rule types but
it also changed the stub rules for all existing rule types. That change
causes the kernel to not enforce some rule types.

This patch fixes the stub rule creation so that existing rule types
continue to be enforced, as well as AF_UNIX rule types when the parser
and kernel both support them.

Here's the DFA states generated before applying the patch mentioned
above:

$ echo "/t { /f r, }" | ./apparmor_parser -qQD dfa-states
{1} <== (allow/deny/audit/quiet)
{3} (0x 10004/0/0/0)

{1} -> {2}: 0x2f /
{2} -> {3}: 0x66 f

{1} <== (allow/deny/audit/quiet)
{2} (0x 4/0/0/0)

{1} -> {2}: 0x2
{1} -> {2}: 0x7
{1} -> {2}: 0x9
{1} -> {2}: 0xa
{1} -> {2}: 0x20 \

Here are the DFA states generated after applying the patch mentioned
above:

$ echo "/t { /f r, }" | ./apparmor_parser -qQD dfa-states
{1} <== (allow/deny/audit/quiet)
{3} (0x 10004/0/0/0)

{1} -> {2}: 0x2f /
{2} -> {3}: 0x66 f

{1} <== (allow/deny/audit/quiet)
{4} (0x 4/0/0/0)

{1} -> {2}: 0x0
{1} -> {3}: 0x34 4
{2} -> {4}: 0x2
{2} -> {4}: 0x4
{2} -> {4}: 0x7
{2} -> {4}: 0x9
{2} -> {4}: 0xa
{2} -> {4}: 0x20 \
{3} -> {4}: 0x31 1

Here are DFA states generated after applying this patch:

$ echo "/t { /f r, }" | ./apparmor_parser -qQD dfa-states
{1} <== (allow/deny/audit/quiet)
{3} (0x 10004/0/0/0)

{1} -> {2}: 0x2f /
{2} -> {3}: 0x66 f

{1} <== (allow/deny/audit/quiet)
{2} (0x 4/0/0/0)

{1} -> {2}: 0x2
{1} -> {2}: 0x4
{1} -> {2}: 0x7
{1} -> {2}: 0x9
{1} -> {2}: 0xa
{1} -> {2}: 0x20 \
{1} -> {3}: 0x34 4
{3} -> {4}: 0x0
{4} -> {2}: 0x31 1

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: John Johansen <john.johansen@canonical.com>
2014-09-03 13:45:44 -07:00
Steve Beattie
019de74059 parser: fix logic error and incorrect reference from previous commit
Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: John Johansen <john.johansen@canonical.com>
2014-09-03 13:34:10 -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
0d4f802572 r2606 had updates for the dbus-session-strict and X abstractions but
mistakenly did not incorporate feedback from Seth Arnold. Specifically, don't
specify label=unconfined on the abstract sockets.

Acked-By: Jamie Strandboge <jamie@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-09-03 15:11:05 -05:00
John Johansen
0b355ebaac parser: fix build dependencies from .c to .cc
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
2014-09-03 13:05:43 -07:00
Steve Beattie
72cde9a4f4 utils/tests: fix bashisms in runtests-py2.sh
Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-09-03 13:00:33 -07:00
Jamie Strandboge
288fc40d1a mdnsd update for fine-grained netlink mediation
Update mdnsd for fine-grained netlink mediation. A mdnsd binary was not
available to test but code inspection showed it set up the socket the same as
avahi, which uses SOCK_DGRAM type instead of SOCK_RAW with netlink.

Acked-By: Jamie Strandboge <jamie@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-09-03 14:49:50 -05:00
Jamie Strandboge
95c393ae29 update kde abstraction for /etc/xdg/Trolltech.conf
Acked-By: Jamie Strandboge <jamie@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-09-03 14:48:41 -05:00
Jamie Strandboge
e1ef7e5582 identd pid file location on Debian/Ubuntu
Acked-By: Jamie Strandboge <jamie@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
2014-09-03 14:47:33 -05:00
Jamie Strandboge
9dfa9611ea update to allow /usr/sbin/dovecot access to /usr/share/dovecot/protocols.d/**
Acked-By: Jamie Strandboge <jamie@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
2014-09-03 14:45:56 -05:00
Jamie Strandboge
8566ed0a0a add unix rules for syslog
Acked-By: Jamie Strandboge <jamie@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-09-03 14:24:00 -05:00
Jamie Strandboge
1f003c0120 abstraction updates for abstract, anonymous and netlink
- the base abstraction for common abstract and anonymous rules (comments
  included per rule)
- dbus-session-strict to add a rule for connecting to the dbus session
  abstract
  socket. I used 'peer=(label=unconfined)' here, but I could probably lose the
  explicit label if people preferred that
- X to add a rule for connecting to the X abstract socket. Same as for
  dbus-session-strict
- nameservice to add a rule for connecting to a netlink raw. This change could
  possibly be excluded, but applications using networking (at least on Ubuntu)
  all seem to need it. Excluding it would mean systems using nscd would need to
  add this and ones not using it would have a noisy denial

Acked-By: Jamie Strandboge <jamie@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-09-03 14:21:31 -05:00
Jamie Strandboge
1245d9c287 update avahi-daemon for fine-grained netlink mediation
Acked-By: Jamie Strandboge <jamie@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-09-03 14:16:32 -05:00
Seth Arnold
c4d40cede0 Fix Debian bug 756807, clang inline functions
Fix clang warnings about inline functions needing either a non-inline
definition or 'static' if they aren't used outside a translation unit.
http://clang.llvm.org/compatibility.html#inline
http://clang.debian.net/status.php?version=3.4.2&key=UNDEF_REF

Signed-off-by: Seth Arnold <seth.arnold@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
2014-08-29 17:40:30 -07:00
John Johansen
659e5ff11d fix: [patch 05/12] Make the af type protocol mappings available for use
before the af type protocol mappings patch was applied, a single rule could
result in multiple rule entries being created. The af type protocol mappings
patch broke this by apply only the first of the mappings that could be
found.

Restore the previous behavior by search through the entire table until
all matches have been made.

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
2014-08-25 15:29:20 -07:00
Kshitij Gupta
9e37c3278e Fix the value being set in nt_name when allowed path exist
The patch:
- sets nt_name to the path, if it is allowed.

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

(acked on IRC based on a link to the ML archive[1])

[1] https://lists.ubuntu.com/archives/apparmor/2014-August/006194.html
2014-08-26 03:13:42 +05:30
Christian Boltz
a620f18cf0 aa.py / ask_the_question() - simplify duplicate option prevention
add a add_to_options() helper function to aa.py which
- adds newpath to options if it's not already there
- returns the updated options and the index of newpath

This removes duplicated code for CMD_GLOB and CMD_GLOBEXT in 
ask_the_question()

It also adds duplicate prevention to CMD_NEW.


Acked-by: Kshitij Gupta <kgupta8592@gmail.com>
2014-08-25 22:49:29 +02:00
Christian Boltz
4608322da9 better error message in aa.py when reaching EOF unexpectedly
When reaching EOF while still in a profile (syntax-wise), there are two
possible reasons:
- missing "}"
- missing "," in the last rule (which means that, thanks to multiline 
  rule handling, the "}" is considered to be part of the last rule)

This patch improves the error message in aa.py to cover a missing ","


Acked-by: Kshitij Gupta <kgupta8592@gmail.com>.
2014-08-25 22:05:45 +02:00
John Johansen
1930675a9b Make the af type protocol mappings available for use
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
2014-08-24 00:00:28 -07:00
John Johansen
bccca11bf6 add generic lookup of af_name mappings
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-08-23 23:57:55 -07:00
John Johansen
f5704761b5 provide a mapping of sock type and name and a fn to look access the mapping
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
2014-08-23 23:55:33 -07:00
John Johansen
54655cf9a4 Add network.c, network.h, missing from previous ci 2014-08-23 23:55:12 -07:00
John Johansen
d3c229fc48 group network rule bits into their own file
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-08-23 23:52:15 -07:00
John Johansen
9fe1e72c44 put the gettext define in one place
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
2014-08-23 23:50:43 -07:00
Jamie Strandboge
0465bdbf81 Update perl abstraction to allow reading /usr/lib/@{multiarch}/perl{,5}/**
Acked-By: Jamie Strandboge <jamie@canonical.com>
2014-08-21 07:28:44 -05:00