Skip to content

Commit

Permalink
Merge pull request #226 from exil-security/master
Browse files Browse the repository at this point in the history
Docker desktop add device whitelist
  • Loading branch information
Dramelac authored Jul 8, 2024
2 parents 45d84fe + 7d39d91 commit b7a3609
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion exegol/model/ContainerConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ class ContainerConfig:
__static_gui_envs = {"_JAVA_AWT_WM_NONREPARENTING": "1", "QT_X11_NO_MITSHM": "1"}
__default_desktop_port = {"http": 6080, "vnc": 5900}

# Whitelist device for Docker Desktop
__whitelist_dd_devices = ["/dev/net/tun"]

class ExegolFeatures(Enum):
shell_logging = "org.exegol.feature.shell_logging"
desktop = "org.exegol.feature.desktop"
Expand Down Expand Up @@ -1265,7 +1268,7 @@ def addRawVolume(self, volume_string):

def addUserDevice(self, user_device_config: str):
"""Add a device from a user parameters"""
if EnvInfo.isDockerDesktop():
if EnvInfo.isDockerDesktop() and user_device_config not in self.__whitelist_dd_devices:
logger.warning("Docker desktop (Windows & macOS) does not support USB device passthrough.")
logger.verbose("Official doc: https://docs.docker.com/desktop/faqs/#can-i-pass-through-a-usb-device-to-a-container")
logger.critical("Device configuration cannot be applied, aborting operation.")
Expand Down

0 comments on commit b7a3609

Please sign in to comment.