Currently one could not further restrict the access to the kernel pseudo filesystem sysfs.
Paths like /sys/bus/usb/devices/ or /sys/class/net/eth0 could be labeled, but these files are symlinks to hardware dependent files, e.g. /sys/class/net/eth0 -> ../../devices/pci0000:00/0000:00:1c.5/0000:05:00.0/net/eth0 or /sys/bus/usb/devices/usb1 -> ../../../devices/pci0000:00/0000:00:1a.0/usb1.
If genfscon would support regular expressions in the path argument one could label these files:
genfscon sysfs /devices/(.*/)+usb[0-9]* gen_context(system_u:object_r:sysfs_usb_t,s0)
genfscon sysfs /devices/(.*/)+net gen_context(system_u:object_r:sysfs_net_t,s0)
Currently one could not further restrict the access to the kernel pseudo filesystem sysfs.
Paths like
/sys/bus/usb/devices/or/sys/class/net/eth0could be labeled, but these files are symlinks to hardware dependent files, e.g./sys/class/net/eth0 -> ../../devices/pci0000:00/0000:00:1c.5/0000:05:00.0/net/eth0or/sys/bus/usb/devices/usb1 -> ../../../devices/pci0000:00/0000:00:1a.0/usb1.If genfscon would support regular expressions in the path argument one could label these files: