From: Johannes Berg <johannes@sipsolutions.net>
To: netdev@vger.kernel.org
Cc: greg@kroah.com, linux-kernel@vger.kernel.org
Subject: sysfs vs. d80211 configuration
Date: Mon, 14 Aug 2006 15:10:58 +0200 [thread overview]
Message-ID: <44E07662.8070506@sipsolutions.net> (raw)
Hey,
In my seemingly never-ending quest to actually use the d80211 stack for
something useful I just wanted to write a small setuid tool that:
* creates and opens a new monitor interface
* drops priviledges
* ... does things with received frames ... (not interesting for this
discussion)
* removes new monitor interface
So I figured I'd just keep an fd open to
/sys/class/net/mymonitorinterface/remove_iface to which I could write
the interfaces name after I was done with it. However, when writing to
that fd I got -EACCESS because it checks for CAP_NET_ADMIN.
That seems to make sense. However, it also means that I can simply not
write the tool that way, it can't drop priviledges. Of course it could
re-exec itself with a special parameter to tell it to remove the
interface, but that'd allow anyone to use it to remove any interface.
Not good either.
Hence, it seems that in order to properly solve this I should simply add
a new sysfs "remove" property for each d80211 virtual interface that
triggers a removal whenever anything is written to it. And it should not
have a check for CAP_NET_ADMIN so I can use it after dropping
priviledges. Sounds great, right? So why isn't there a patch attached to
this mail?
Well, it isn't too great. See, if you think about it again, removing an
interface *should* require CAP_NET_ADMIN. But if I want to enable above
use-case, then I have to check for CAP_NET_ADMIN when *opening* the
sysfs attribute file, not writing to it. But that doesn't seem possible
to do. Hence, I lose capability granularity. But it seems that sysfs
doesn't allow me to do that. [Nor does a configuration system via
netlink. hmm]
Do I lose? Or put from my kernel developer perspective: should we even
be enabling such a use?
johannes
next reply other threads:[~2006-08-14 13:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-14 13:10 Johannes Berg [this message]
2006-08-14 23:05 ` sysfs vs. d80211 configuration Alexey Toptygin
2006-08-15 0:07 ` Mike Kershaw
2006-08-15 7:41 ` Johannes Berg
2006-08-15 10:02 ` Johannes Berg
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=44E07662.8070506@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.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).