Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker desktop add device whitelist #226

Merged
merged 3 commits into from
Jul 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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