Skip to content

Privilege Escalation

Mark Yen edited this page Mar 3, 2022 · 2 revisions

Privilege Escalation

Rancher Desktop has various needs to run as a privileged user, typically platform-specific:

Windows

  • (Installer) Install WSL
  • (Installer) Update WSL kernel
  • Writing to C:\Windows\system32\drivers\etc\hosts
  • Custom networking?

macOS

  • Install vde_vmnet tools
  • Run vde_vmnet tools (sudoers file)
  • Create /private/var/run/rancher-desktop-lima
  • /etc/paths.d management
  • Create docker socket symlink

Linux

  • Create docker socket symlink
  • Custom networking

Desired State

  • Privilege escalation is only needed at install time
    • For macOS / Linux AppImage, this may be an optional component installed separately.
  • The application can still run without privilege escalation with a reduced feature set.
    • E.g. fall back to SLIRP-only networking on macOS.

Implementation Strategies

sudo

  • Only applicable on macOS / Linux
  • Issues around conflicting sudoers configuration
  • Not great for admin access

Privileged helper

  • macOS/Linux: setuid binary
    • Need to hard-code things, but should be safe with adequate checking
  • Windows: privileged service
    • Requires Administrator access to install
    • Also need it for uninstall
  • Needs to grant privilege escalation every time RD updates (new binary)

Planning

  • Ignore Windows for now

  • Temporarily introduce a (hidden) setting to disable privileged access

  • Make lima.ts fall back when no privileged access

  • Use a setuid helper on macOS / Linux

  • Hack up lima to not use sudo

  • Remove setting, check setuid bit on helper instead

  • Must check version between setuid helper & main app, ignore it if versions mismatch (not just older)

Clone this wiki locally