From: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
To: Daniel Borkmann <dborkman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: <pablo-Cap9r6Oaw4JrovVCs/uTlw@public.gmane.org>,
<netfilter-devel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
<cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH nf-next v3] netfilter: xtables: lightweight process control group matching
Date: Sat, 28 Dec 2013 09:33:45 +0800 [thread overview]
Message-ID: <52BE2A79.6040504@huawei.com> (raw)
In-Reply-To: <52BD34D1.1040708-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
On 2013/12/27 16:05, Daniel Borkmann wrote:
> On 12/27/2013 04:13 AM, Li Zefan wrote:
>> On 2013/12/24 1:41, Daniel Borkmann wrote:
>>> It would be useful e.g. in a server or desktop environment to have
>>> a facility in the notion of fine-grained "per application" or "per
>>> application group" firewall policies. Probably, users in the mobile,
>>> embedded area (e.g. Android based) with different security policy
>>> requirements for application groups could have great benefit from
>>> that as well. For example, with a little bit of configuration effort,
>>> an admin could whitelist well-known applications, and thus block
>>> otherwise unwanted "hard-to-track" applications like [1] from a
>>> user's machine. Blocking is just one example, but it is not limited
>>> to that, meaning we can have much different scenarios/policies that
>>> netfilter allows us than just blocking, e.g. fine grained settings
>>> where applications are allowed to connect/send traffic to, application
>>> traffic marking/conntracking, application-specific packet mangling,
>>> and so on.
>>>
>>> Implementation of PID-based matching would not be appropriate
>>> as they frequently change, and child tracking would make that
>>> even more complex and ugly. Cgroups would be a perfect candidate
>>> for accomplishing that as they associate a set of tasks with a
>>> set of parameters for one or more subsystems, in our case the
>>> netfilter subsystem, which, of course, can be combined with other
>>> cgroup subsystems into something more complex if needed.
>>>
>>> As mentioned, to overcome this constraint, such processes could
>>> be placed into one or multiple cgroups where different fine-grained
>>> rules can be defined depending on the application scenario, while
>>> e.g. everything else that is not part of that could be dropped (or
>>> vice versa), thus making life harder for unwanted processes to
>>> communicate to the outside world. So, we make use of cgroups here
>>> to track jobs and limit their resources in terms of iptables
>>> policies; in other words, limiting, tracking, etc what they are
>>> allowed to communicate.
>>>
>>> In our case we're working on outgoing traffic based on which local
>>> socket that originated from. Also, one doesn't even need to have
>>> an a-prio knowledge of the application internals regarding their
>>> particular use of ports or protocols. Matching is *extremly*
>>> lightweight as we just test for the sk_classid marker of sockets,
>>> originating from net_cls. net_cls and netfilter do not contradict
>>> each other; in fact, each construct can live as standalone or they
>>> can be used in combination with each other, which is perfectly fine,
>>> plus it serves Tejun's requirement to not introduce a new cgroups
>>> subsystem. Through this, we result in a very minimal and efficient
>>> module, and don't add anything except netfilter code.
>>>
>>
>> I'd suggest splitting cls_cgroup code into 2 parts. The first part
>> is to manage cgroupfs and classid, and should be put into net/core/
>> and add a new config like NET_CGROUP_CLASSID for it. The second part
>> is specific cls_cgroup code.
>
> Sure, if this is wished, I'd do this as a follow-up as it doesn't affect
> any of this code in netfilter here.
>
We should clean up the code before introducing a new feature, not the
other way.
And I wish by touching the code outside netfilter we'll get more eyes
on whether it's ok to reuse cls cgroup for netfilter.
next prev parent reply other threads:[~2013-12-28 1:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1387815795.git.dborkman@redhat.com>
[not found] ` <cover.1387815795.git.dborkman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-12-23 17:41 ` [PATCH nf-next v3] netfilter: xtables: lightweight process control group matching Daniel Borkmann
2013-12-27 3:13 ` Li Zefan
[not found] ` <52BCF04B.3070908-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2013-12-27 8:05 ` Daniel Borkmann
[not found] ` <52BD34D1.1040708-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-12-28 1:33 ` Li Zefan [this message]
2013-12-28 8:17 ` Daniel Borkmann
[not found] ` <52BE8936.6000001-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-12-28 8:44 ` Daniel Borkmann
[not found] ` <52BE8F50.4080005-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-12-28 9:20 ` Li Zefan
[not found] ` <52BE97DC.5090807-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2013-12-28 9:54 ` Li Zefan
2013-12-28 18:04 ` Daniel Borkmann
2013-12-28 18:37 ` Daniel Borkmann
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=52BE2A79.6040504@huawei.com \
--to=lizefan-hv44wf8li93qt0dzr+alfa@public.gmane.org \
--cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=dborkman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=netfilter-devel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=pablo-Cap9r6Oaw4JrovVCs/uTlw@public.gmane.org \
--cc=tj-DgEjT+Ai2ygdnm+yROfE0A@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).