Whitelisting USB Keyboard(human interface devices)

Alles rund um sicherheitsrelevante Fragen und Probleme.
Antworten
MaxiSys
Beiträge: 1
Registriert: 12.12.2018 13:57:27

Whitelisting USB Keyboard(human interface devices)

Beitrag von MaxiSys » 12.12.2018 14:01:20

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"

rendegast
Beiträge: 15041
Registriert: 27.02.2006 16:50:33
Lizenz eigener Beiträge: MIT Lizenz

Re: Whitelisting USB Keyboard(human interface devices)

Beitrag von rendegast » 24.12.2018 03:10:44

# 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")
mfg rendegast
-----------------------
Viel Eifer, viel Irrtum; weniger Eifer, weniger Irrtum; kein Eifer, kein Irrtum.
(Lin Yutang "Moment in Peking")

Antworten