usbguard icon indicating copy to clipboard operation
usbguard copied to clipboard

[RFE] allow a usb device with a mass storage interface but ensure it'll be mounted read-only

Open dkopecek opened this issue 10 years ago • 7 comments

This could be used to prevent data leakage without the strict restriction of "no usb mass storage devices can be connected to the system". Obviously, this would be effective only for user without root access.

dkopecek avatar Apr 14 '15 12:04 dkopecek

It is possible to set read-only flag for block devices using blockdev --setro /dev/sdX. Internally, it calls:

open("/dev/sdX", O_RDONLY); => 3
ioctl(3, BLKROSET, 1);
close(3);

So it's quite trivial to implement.

dkopecek avatar Apr 15 '15 15:04 dkopecek

This is probably a good candidate for a new keyword in the action section in a rule. E.g.:

allow 1234:1234 serial "abcdef" with-interface { 08:*:* } set-blockdev-ro

The set-blockdev-ro simply means that any block devices created as a result of inserting a device that matches the rule will be set to read-only mode.

dkopecek avatar Apr 15 '15 15:04 dkopecek

The use case for this is data leakage prevention, i.e. if you want to allow access to USB flash disks but you don't want unprivileged users to be able to copy data onto the device from the system. This idea was originally proposed to me by [email protected].

dkopecek avatar Apr 15 '15 15:04 dkopecek

Alternative names for the keyword:

  • set-read-only
  • force-read-only

the set-blockdev-ro name has the advantage of implying that the action is applicable to block devices only...

dkopecek avatar Apr 15 '15 15:04 dkopecek

Great to see it's feasible :)

jnpkrn avatar Apr 15 '15 16:04 jnpkrn

Is it still an issue or has it been introduced ?

flavienbwk avatar Sep 10 '20 15:09 flavienbwk

is it possible to vote for this. I don't see option for this feature and it would be nice to have it because of compliance requests also?

Idriel avatar Aug 06 '21 14:08 Idriel