The following examples illustrate possible network-related rules to be used in AppArmor
profiles. Note that the syntax of the two last ones is not currently supported by the
AppArmor tools.
network
❶
,
network inet
❷
,
network inet6
❸
,
network inet stream
❹
,
network inet tcp
❺
,
network tcp
❻
,
❶
Allow all networking. No restrictions applied with regards to domain, type, or
protocol.
❷
Allow general use of IPv4 networking.
❸
Allow general use of IPv6 networking.
❹
Allow the use of IPv4 TCP networking.
❺
Allow the use of IPv4 TCP networking, paraphrasing the rule above.
❻
Allow the use of both IPv4 and IPv6 TCP networking.
2.1.2 Paths and Globbing
AppArmor explicitly distinguishes directory path names from file path names. Use a
trailing
/
for any directory path that needs to be explicitly distinguished:
/some/random/example/* r
Allow read access to files in the
/some/random/example
directory.
/some/random/example/ r
Allow read access to the directory only.
/some/**/ r
Give read access to any directories below
/some
.
/some/random/example/** r
Give read access to files and directories under
/some/random/example
.
/some/random/example/**[^/] r
Give read access to files under
/some/random/example
. Explicitly exclude
directories (
[^/]
).
Profile Components and Syntax
15