From: David Lamparter <equinox@diac24.net>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org, linux-fsdevel@vger.kernel.org,
jamal <hadi@cyberus.ca>, Daniel Lezcano <daniel.lezcano@free.fr>,
Linux Containers <containers@lists.osdl.org>,
Renato Westphal <renatowestphal@gmail.com>
Subject: Identifying network namespaces (was: Network namespace manipulation with file descriptors)
Date: Wed, 18 May 2011 14:43:07 +0200 [thread overview]
Message-ID: <20110518124307.GD3762520@jupiter.n2.diac24.net> (raw)
In-Reply-To: <m1tyd7p7tq.fsf@fess.ebiederm.org>
On Fri, May 06, 2011 at 07:23:29PM -0700, Eric W. Biederman wrote:
> Today there are something things you can use namespaces to implement but
> the userspace code is unnecessarily complex and fragile because of
> limitations of the kernel interfaces.
(I hope I'm not duplicating stuff here, maybe this is already taken care
of...)
There still is the unresolved issue of identifying and/or equality
testing network namespaces. The problems I see are the following:
Problems
========
- there is no simple list of the existing namespaces
most importantly, network namespaces can be abused very sneakily to
provide trojans or other malicious software with a covert
communication channel.
Just create a macvlan device on the local ethernet, shift it into a
new namespace, grab an IP - and the admin of the host will be left
dumbfounded with his plain old netstat or ss as to where those weird
packets are coming from.
(Granted, this needs root privileges and you can still see everything
in /proc/<pid>/net/{tcp,udp,...})
- processes cannot easily be cross referenced with each other
in the case of user space stuff running astray - like management
software crashing, routing daemons screwing up, etc. - it becomes
fairly difficult to shut down a network namespace (or even reaquire
physical devices that have been reassigned)
- namespaces cannot adequately be identified to the user
for debugging, some kernel messages become useless. most prominently,
"unregister_netdevice: waiting for lo to become free. Usage count = 123"
could certainly use some clarification, *which* lo is meant...
So, considering this set of premises (feedback welcome) I looked for
some suitable means of identification. I discarded going for any process
identifiers since Eric's patches allow for network namespaces without
any process holding a reference, using bind mounts instead.
Solution?
=========
I do think I found another identifier suitable for both exporting a full
list and providing "getid" functionality: the "lo" interface index.
I am not fully sure on the rules here, but to my understanding the lo
interface index should be constant for the lifetime of a network
namespace, and furthermore the interface index namespace is global to
the kernel.
This can already be used right now:
- you can identify the init namespace since its lo index is 1
- you can use netlink (or SIOCGIFINDEX, ew.) to get your own ID
- as soon as you have the means to attach to a namespace, you
automatically also have the means to get its ID
What might need to be added:
1) a list of lo indices
2) a way to get a hold of the namespace using its lo index
3) maybe dmesg output on creation/destruction for the abuse case above
4) possibly a file in /proc/<pid>/net that just contains the lo index,
for ease of use
3) and 4) should be trivial; 1) and 2) could be solved by having a
directory in /proc (?) that has all the network namespace "files" with
their lo indices as names.
So, ... Opinions?
-David
next prev parent reply other threads:[~2011-05-18 12:43 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-07 2:23 [PATCH 0/7] Network namespace manipulation with file descriptors Eric W. Biederman
2011-05-07 2:24 ` [PATCH 1/7] ns: proc files for namespace naming policy Eric W. Biederman
2011-05-07 2:24 ` [PATCH 2/7] ns: Introduce the setns syscall Eric W. Biederman
2011-05-07 8:01 ` Rémi Denis-Courmont
2011-05-07 13:57 ` Eric W. Biederman
2011-05-07 22:39 ` Daniel Lezcano
2011-05-08 3:51 ` Matt Helsley
2011-05-11 19:21 ` Nathan Lynch
2011-05-11 20:33 ` Eric W. Biederman
2011-05-07 2:24 ` [PATCH 3/7] ns proc: Add support for the network namespace Eric W. Biederman
2011-05-07 22:41 ` Daniel Lezcano
2011-05-11 19:21 ` Nathan Lynch
2011-05-11 21:34 ` Eric W. Biederman
2011-05-11 21:42 ` Nathan Lynch
2011-05-07 2:24 ` [PATCH 4/7] ns proc: Add support for the uts namespace Eric W. Biederman
2011-05-07 22:42 ` Daniel Lezcano
2011-05-07 2:24 ` [PATCH 5/7] ns proc: Add support for the ipc namespace Eric W. Biederman
2011-05-07 22:44 ` Daniel Lezcano
2011-05-07 2:25 ` [PATCH 6/7] net: Allow setting the network namespace by fd Eric W. Biederman
2011-05-07 22:46 ` Daniel Lezcano
2011-05-07 2:25 ` [PATCH 7/7] ns: Wire up the setns system call Eric W. Biederman
2011-05-07 8:27 ` Geert Uytterhoeven
2011-05-07 14:09 ` Eric W. Biederman
2011-05-07 18:22 ` Geert Uytterhoeven
2011-05-07 13:59 ` Mike Frysinger
2011-05-07 20:06 ` James Bottomley
2011-05-08 2:19 ` Eric W. Biederman
2011-05-08 4:02 ` James Bottomley
2011-05-07 22:37 ` [PATCH 1/7] ns: proc files for namespace naming policy Daniel Lezcano
2011-05-11 19:20 ` Nathan Lynch
2011-05-11 22:52 ` Eric W. Biederman
2011-05-07 6:58 ` [PATCH 0/7] Network namespace manipulation with file descriptors Alex Bligh
2011-05-07 14:18 ` Eric W. Biederman
2011-05-08 12:31 ` Alex Bligh
2011-05-17 11:11 ` David Lamparter
2011-05-17 14:33 ` Eric W. Biederman
2011-05-17 15:35 ` David Lamparter
2011-05-22 4:19 ` Renato Westphal
2011-05-09 19:04 ` David Miller
2011-05-09 19:59 ` Eric W. Biederman
2011-05-09 20:40 ` David Miller
2011-05-09 20:54 ` Eric W. Biederman
2011-05-09 20:55 ` David Miller
2011-05-10 21:56 ` Luck, Tony
2011-05-10 23:02 ` Eric W. Biederman
2011-05-18 12:43 ` David Lamparter [this message]
2011-05-18 13:03 ` Identifying network namespaces (was: Network namespace manipulation with file descriptors) Alexey Dobriyan
2011-05-18 13:33 ` David Lamparter
2011-05-18 14:13 ` Alexey Dobriyan
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=20110518124307.GD3762520@jupiter.n2.diac24.net \
--to=equinox@diac24.net \
--cc=containers@lists.osdl.org \
--cc=daniel.lezcano@free.fr \
--cc=ebiederm@xmission.com \
--cc=hadi@cyberus.ca \
--cc=linux-arch@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=renatowestphal@gmail.com \
/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
all inboxes | Powered by JetHome®