<div dir="auto"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Dec 20, 2020, 21:37 Adi Ml <<a href="mailto:maladi1747@gmail.com">maladi1747@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div>Yes. Thats exactly what I mean (what mantas said)- <span style="font-family:sans-serif">ATTR{authorized}="0". I would like to have a usb whitelist via udev and want it to be enforced on devices which connected pre boot too.</span></div><div dir="auto"><font face="sans-serif"><br></font></div><div dir="auto"><font face="sans-serif">authorized_default=0- it seems the same like<br></font></div><div dir="auto"><font face="sans-serif">ATTR{authorized}="0", isnt it?<br></font></div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Not quite – I guess there is a very small window of time between connection and udev processing where the device is still authorized, before udev removes the authorization.</div><div dir="auto"><br></div><div dir="auto">So having authorized_default=0, and then setting all allowed devices to authorized=1 (allow only approved devices, block the rest) is probably slightly safer technically.</div><div dir="auto"><br></div><div dir="auto">(Actually maybe you should just use USBGuard instead of writing custom rules?)</div><div dir="auto"><br></div><div dir="auto">This is what I used to have a long time ago:</div><div dir="auto"><br></div><div dir="auto">ACTION!="add", GOTO="deauthorize_end"</div><div dir="auto">SUBSYSTEM!="usb", GOTO="deauthorize_end"</div><div dir="auto"><br></div><div dir="auto">TEST=="authorized_default", ATTR{authorized_default}="0", GOTO="deauthorize_end"</div><div dir="auto"><br></div><div dir="auto">ENV{ID_VENDOR}=="Yubico", ENV{ID_MODEL}=="Yubikey_NEO*", ATTR{authorized}="1", GOTO="deauthorize_end"</div><div dir="auto"><br></div><div dir="auto">ENV{ID_VENDOR}=="Zubico", ENV{ID_MODEL}=="Zubikey_GEO*", ATTR{authorized}="1", GOTO="deauthorize_end"</div><div dir="auto"><br></div><div dir="auto">LABEL="deauthorize_end"</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div dir="auto"><div class="gmail_quote" dir="auto"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>
</blockquote></div></div></div>