File tree 3 files changed +22
-1
lines changed
3 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -535,6 +535,19 @@ def _get_host_domainname(self) -> str:
535
535
except KeyError :
536
536
return "local"
537
537
538
+ def _get_usb_device (self ) -> typing .List [str ]:
539
+ devices = self .data ["usb_device" ].split () # type: typing.List[str]
540
+ return devices
541
+
542
+ def _set_usb_device (
543
+ self ,
544
+ value : typing .Union [typing .List [str ], str ]
545
+ ) -> None :
546
+ if isinstance (value , list ):
547
+ self .data ["usb_device" ] = " " .join (value )
548
+ else :
549
+ self .data ["usb_device" ] = value
550
+
538
551
def get_string (self , key : str ) -> str :
539
552
"""Get the stringified value of a configuration property."""
540
553
return self .stringify (self .__getitem__ (key ))
Original file line number Diff line number Diff line change 70
70
"allow_mount_fdescfs" : 0 ,
71
71
"allow_mount_zfs" : 0 ,
72
72
"allow_mount_tmpfs" : 0 ,
73
+ "allow_usb" : 0 ,
74
+ "usb_device" : ["ugen*" ],
73
75
"allow_quotas" : 0 ,
74
76
"allow_socket_af" : 0 ,
75
77
"rlimits" : None ,
Original file line number Diff line number Diff line change @@ -1600,9 +1600,15 @@ def devfs_ruleset(self) -> libioc.DevfsRules.DevfsRuleset:
1600
1600
if self ._dhcp_enabled is True :
1601
1601
devfs_ruleset .append ("add path 'bpf*' unhide" )
1602
1602
1603
- if self ._allow_mount_zfs == "1" :
1603
+ if self ._allow_mount_zfs is True :
1604
1604
devfs_ruleset .append ("add path zfs unhide" )
1605
1605
1606
+ if self .config ["allow_usb" ] is True :
1607
+ devfs_ruleset .append ("add path 'usb/*' unhide" )
1608
+ devfs_ruleset .append ("add path 'usbctl' unhide" )
1609
+ for usb_device in self .config ["usb_device" ]:
1610
+ devfs_ruleset .append (f"add path '{ usb_device } ' unhide" )
1611
+
1606
1612
# create if the final rule combination does not exist as ruleset
1607
1613
if devfs_ruleset not in self .host .devfs :
1608
1614
self .logger .verbose ("New devfs ruleset combination" )
You can’t perform that action at this time.
0 commit comments