Seite 1 von 1

Whitelisting USB Keyboard(human interface devices)

Verfasst: 12.12.2018 14:01:20
von MaxiSys
Hallo :)
Ich will alle USB-Geräte blocken, nur HID-Devices (Maus, Tastatur) erlauben. Dazu habe ich folgende Config geschrieben (Udev Regel) und getestet. Es hat bisher funktioniert. Ich bin mir aber nicht ganz sicher, könntet ihr bestätigen das es immer funktioniert?

Code: Alles auswählen

#whitelist keyboards and mouse

# Skeep not USB
SUBSYSTEM!="usb", GOTO="usb_end"
# Skeep remove actions
ACTION=="remove", GOTO="usb_end"

# Linux Foundation
# enable ehci
SUBSYSTEMS=="usb", ACTION=="add", ATTR{product}=="EHCI Host Controller", \
 ATTR{bDeviceClass}=="09", ATTR{authorized}="1", GOTO="usb_end"

# enable uhci
SUBSYSTEMS=="usb", ACTION=="add", ATTR{product}=="UHCI Host Controller", \
 ATTR{bDeviceClass}=="09", ATTR{authorized}="1", GOTO="usb_end"

# get to intel hubs / enable root hubs
SUBSYSTEMS=="usb", ACTION=="add", ATTR{bInterfaceClass}=="09", ATTR{authorized}="1", GOTO="usb_end"

# enable intel hubs / all hubs
SUBSYSTEMS=="usb", ACTION=="add", ATTR{bDeviceClass}=="09", ATTR{authorized}="1", GOTO="usb_end"

#enable 00 (one  before keyboar)
SUBSYSTEMS=="usb", ACTION=="add", ATTR{bDeviceClass}=="00", ATTR{authorized}="1", GOTO="usb_end"

#enable human interface devices
SUBSYSTEMS=="usb", ACTION=="add", ATTR{bInterfaceClass}=="03", ATTR{authorized}="1", GOTO="usb_end"

# Disable all other USB devices
SUBSYSTEMS=="usb", ACTION=="add", ATTR{authorized}="0"

LABEL="usb_end"

Re: Whitelisting USB Keyboard(human interface devices)

Verfasst: 24.12.2018 03:10:44
von rendegast
# enable ehci
SUBSYSTEMS=="usb", ACTION=="add", ATTR{product}=="EHCI Host Controller", \
ATTR{bDeviceClass}=="09", ATTR{authorized}="1", GOTO="usb_end"

# enable uhci
SUBSYSTEMS=="usb", ACTION=="add", ATTR{product}=="UHCI Host Controller", \
ATTR{bDeviceClass}=="09", ATTR{authorized}="1", GOTO="usb_end"
...
...
# enable intel hubs / all hubs
SUBSYSTEMS=="usb", ACTION=="add", ATTR{bDeviceClass}=="09", ATTR{authorized}="1", GOTO="usb_end"
Die obigen beiden werden durch die untere abgedeckt.




#enable human interface devices
SUBSYSTEMS=="usb", ACTION=="add", ATTR{bInterfaceClass}=="03", ATTR{authorized}="1", GOTO="usb_end"
Hier müßte eigentlich verboten werden, ich denke mir sowas

Code: Alles auswählen

# Die bekannte Tastatur erlauben, vielleicht auch eventuelle Ersatzgeraete
SUBSYSTEMS=="usb", ACTION=="add", ATTR{bInterfaceClass}=="03", ATTR{authorized}="1",  \ 
   ATTRS{idProduct}=="XXXX",ATTRS{idVendor}=="YYYY", GOTO="usb_end"
#(mein keyboard hat keine Seriennummer, Die USB-ID ist die einzige individuelle Eigenschaft)

SUBSYSTEMS=="usb", ACTION=="add", ATTR{bInterfaceClass}=="03", ATTR{authorized}="0"
(?, klappt so hier noch nicht -> "Feinabstimmung")