All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jacek <wampir990-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: netfilter-devel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: apparmor-nLRlyDuq1AZFpShjVBNYrg@public.gmane.org
Subject: Apparmor netfiter support?
Date: Mon, 7 Jan 2019 11:16:13 +0100	[thread overview]
Message-ID: <91b5b9f7-bb9a-29d9-bc72-b0077b885726@gmail.com> (raw)


[-- Attachment #1.1.1.1: Type: text/plain, Size: 2434 bytes --]

Hi

Apparmor hasn't a Netfilter firewall support module.

Network rules is a good choice for applications that have AA-profiles,
but it does not protect unconfined processes for forbidden network
outgoing connections.

I mean the function of the Security netfiter tables for SElinux, but the
easy way similar to xt_gradm, part of the Grsecurity project:
https://grsecurity.net/stable/grsecurity-2.2.0-iptables.patch

Proposed solution (userspace):
NFtables (next Linux firewall):

nft insert rule ip filter output meta apparmor aapolicy unconfined drop
nft insert rule ip filter output meta apparmor aapolicy enforce accept
nft insert rule ip filter output meta apparmor aapolicy complain log accept

Iptables (current/old Linux firewall):
iptables -I OUTPUT ! -o lo -m apparmor --aapolicy unconfined -j DROP
iptables -A OUTPUT ! -o lo -m apparmor --aapolicy enforce  -j ACCEPT
iptables -A OUTPUT ! -o lo -m apparmor --aapolicy complain  -j LOG
--log-prefix "$PROFILE_NAME - complain: $APP_NAME"
iptables -A OUTPUT ! -o lo -m apparmor --aapolicy complain  -j ACCEPT



Example log from LSM Integrity IMA (Apparmor Variables - enforce)

/audit: type=1800 audit(1546855115.951:3766): pid=12211 uid=0 auid=1001
ses=4 subj==/bin/kmod (enforce) op=appraise_data
cause=IMA-signature-required comm="modprobe"
name="/lib64/modules/4.19.13-gt5/kernel/net/sched/sch_codel.ko"
dev="sdb1" ino=1334797 res=0/

/where:/

Apparmor Profile name & policy:/   //subj==/bin/kmod (enforce) /
Real aplication name:  /comm="modprobe" /

AA-variables - unconfined:

[ 1703.396288] audit: type=1800 audit(1546855383.896:3777): pid=12347
uid=0 auid=1001 ses=4 subj==unconfined op=appraise_data
cause=IMA-signature-required comm="modprobe"
name="/lib64/modules/4.19.13-gt5/kernel/net/sched/sch_codel.ko"
dev="sdb1" ino=1334797 res=0

where:

AA-policy: subj==unconfined

aplication name:    comm="modprobe"

AA-variables - complain:

audit: type=1800 audit(1546855552.256:3785): pid=12402 uid=0 auid=1001
ses=4 subj==/bin/kmod (complain) op=appraise_data
cause=IMA-signature-required comm="insmod" 
name="/lib64/modules/4.19.13-gt5/kernel/net/sched/sch_codel.ko"
dev="sdb1" ino=1334797 res=0

where:

AA - profile & policy:  subj==/bin/kmod (complain)

App name: comm="insmod"

I'm not a programmer, is there any chance of adding a similar module in
Apparmor?

Cheers





[-- Attachment #1.1.1.2: Type: text/html, Size: 3349 bytes --]

[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 138 bytes --]

-- 
AppArmor mailing list
AppArmor@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor

             reply	other threads:[~2019-01-07 10:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-07 10:16 Jacek [this message]
     [not found] ` <91b5b9f7-bb9a-29d9-bc72-b0077b885726-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-01-07 16:51   ` Apparmor netfiter support? John Johansen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=91b5b9f7-bb9a-29d9-bc72-b0077b885726@gmail.com \
    --to=wampir990-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=apparmor-nLRlyDuq1AZFpShjVBNYrg@public.gmane.org \
    --cc=netfilter-devel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.