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 @@ -536,6 +536,19 @@ def _get_host_domainname(self) -> str:
536
536
except KeyError :
537
537
return "local"
538
538
539
+ def _get_usb_device (self ) -> typing .List [str ]:
540
+ devices = self .data ["usb_device" ].split () # type: typing.List[str]
541
+ return devices
542
+
543
+ def _set_usb_device (
544
+ self ,
545
+ value : typing .Union [typing .List [str ], str ]
546
+ ) -> None :
547
+ if isinstance (value , list ):
548
+ self .data ["usb_device" ] = " " .join (value )
549
+ else :
550
+ self .data ["usb_device" ] = value
551
+
539
552
def get_string (self , key : str ) -> str :
540
553
"""Get the stringified value of a configuration property."""
541
554
return self .stringify (self .__getitem__ (key ))
Original file line number Diff line number Diff line change 68
68
"allow_mount_fdescfs" : 0 ,
69
69
"allow_mount_zfs" : 0 ,
70
70
"allow_mount_tmpfs" : 0 ,
71
+ "allow_usb" : 0 ,
72
+ "usb_device" : ["ugen*" ],
71
73
"allow_quotas" : 0 ,
72
74
"allow_socket_af" : 0 ,
73
75
"allow_vmm" : False ,
Original file line number Diff line number Diff line change @@ -1616,7 +1616,7 @@ def devfs_ruleset(self) -> libioc.DevfsRules.DevfsRuleset:
1616
1616
if self ._dhcp_enabled is True :
1617
1617
devfs_ruleset .append ("add path 'bpf*' unhide" )
1618
1618
1619
- if self ._allow_mount_zfs == "1" :
1619
+ if self ._allow_mount_zfs is True :
1620
1620
devfs_ruleset .append ("add path zfs unhide" )
1621
1621
1622
1622
if self .config ["jail_zfs" ] is True :
@@ -1643,6 +1643,12 @@ def devfs_ruleset(self) -> libioc.DevfsRules.DevfsRuleset:
1643
1643
devfs_ruleset .append ("add path vmm/* unhide" )
1644
1644
devfs_ruleset .append ("add path nmdm* unhide" )
1645
1645
1646
+ if self .config ["allow_usb" ] is True :
1647
+ devfs_ruleset .append ("add path 'usb/*' unhide" )
1648
+ devfs_ruleset .append ("add path 'usbctl' unhide" )
1649
+ for usb_device in self .config ["usb_device" ]:
1650
+ devfs_ruleset .append (f"add path '{ usb_device } ' unhide" )
1651
+
1646
1652
# create if the final rule combination does not exist as ruleset
1647
1653
if devfs_ruleset not in self .host .devfs :
1648
1654
self .logger .verbose ("New devfs ruleset combination" )
You can’t perform that action at this time.
0 commit comments