From: Oliver Hartkopp <socketcan@hartkopp.net>
To: "Hodaszi, Robert" <robert.hodaszi@digi.com>,
"linux-can@vger.kernel.org" <linux-can@vger.kernel.org>
Subject: Re: can-bus user permissions
Date: Thu, 26 Jun 2014 19:55:57 +0200 [thread overview]
Message-ID: <53AC5EAD.6010405@hartkopp.net> (raw)
In-Reply-To: <1403777965.9016.9.camel@A1-Robi>
Hi Robert,
On 26.06.2014 12:19, Hodaszi, Robert wrote:
> A while ago, only root was able to access the can interfaces, except if
> the CONFIG_CAN_RAW_USER or CONFIG_CAN_BCM_USER was defined.
this has never been implemented in mainline Linux. There was an early
implementation for this in the SocketCAN development - but is had been removed
during the mainlining process.
>
> I would need a similar behavior: only some selected users or groups
> should access the can interfaces, and nobody else. Is it possible to do
> that somehow with the current kernel? Or should I modify it?
>
> (E.g. it would be perfect, if I could use it like in case of IP sockets:
> iptables -A OUTPUT -o eth0 -m owner --uid-owner 0 -j ACCEPT
> and DROP others, or something like this.)
Good idea.
Please try with the traffic control (tc) command.
For a CAN related introduction see:
http://rtime.felk.cvut.cz/can/socketcan-qdisc-final.pdf
And http://wiki.wlug.org.nz/TrafficControl talks about the possibility to
filter the traffic by
sk-uid (uid from the skbuff)
sk-gid (gid from the skbuff)
As the CAN frames generated by CAN_RAW and CAN_BCM properly set the sk
reference into the skbuff the access to the sk-uid value should work.
Feel free to post an example here, if you made it working.
Regards,
Oliver
prev parent reply other threads:[~2014-06-26 17:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-26 10:19 can-bus user permissions Hodaszi, Robert
2014-06-26 17:55 ` Oliver Hartkopp [this message]
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=53AC5EAD.6010405@hartkopp.net \
--to=socketcan@hartkopp.net \
--cc=linux-can@vger.kernel.org \
--cc=robert.hodaszi@digi.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 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.