<div dir="auto"><div style="font-family:sans-serif" dir="auto">I guess that udev can block devices from userspace only, so from there.</div><div dir="auto" style="font-family:sans-serif"><br></div><div dir="auto" style="font-family:sans-serif">Of course, you are right-whitelist is better.</div><div dir="auto" style="font-family:sans-serif"><br></div><div dir="auto" style="font-family:sans-serif">As for usbguard, I thought about using seccomp and filterring system calls in my udev service based on their code - I have seen that they list a group of system calls and restrict the usage to them only.<br><br>Anyway, I understand, the system calls that udev use are mentioned in its configuration files and are also the system calls used in scripts ran when a rule is been trigerred (the rules writer have to specify the scripts in the rules file of course) .</div><div dir="auto" style="font-family:sans-serif"><br></div><div dir="auto" style="font-family:sans-serif"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">בתאריך יום ב׳, 14 בדצמ׳ 2020, 17:41, מאת Greg KH ‏<<a href="mailto:gregkh@linuxfoundation.org">gregkh@linuxfoundation.org</a>>:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Mon, Dec 14, 2020 at 05:31:17PM +0200, Adi Ml wrote:<br>
> I am using udev in order to create a kiosk mode. I want to block devices<br>
> which fit a certain vid pid.<br>
<br>
Block devices from where?  The kernel or userspace?<br>
<br>
udev runs _after_ the kernel has seen the device and bound to it.<br>
<br>
And usb vid/pids can be made to be whatever they want to be, be careful<br>
about triggering off of them to prevent specific things from happening,<br>
that way is tough.  It's easier to whitelist valid devices that you know<br>
are correct, and then only allow specific actions to happen on them.<br>
<br>
You might want to look into using <a href="https://usbguard.github.io/" rel="noreferrer noreferrer" target="_blank">https://usbguard.github.io/</a> for how to<br>
do this "properly".<br>
<br>
> I want to filter system calls anyway because I<br>
> dont know which devices are entered and I want to avoid devices which will<br>
> do unusual things like rubber ducky.<br>
<br>
devices do not make system calls directly, and if you plug a rubber<br>
ducky in that acts like a keyboard, that is not going to create things<br>
in udev's process context.<br>
<br>
> What do you mean by filtering system calls in   scripts- is it needed when<br>
> the user can influence actions commited in the script ?<br>
<br>
Look at the programs / scripts that udev calls out to in the udev<br>
configuration files for examples of these.  A user does not directly<br>
influence them, except if they are allowed to create/remove hardware.<br>
<br>
Hope this helps,<br>
<br>
greg k-h<br>
</blockquote></div>