Skip to content

Security Hardening: Migrate OpenClaw LXC to Unprivileged Container#2

Open
koss822 wants to merge 8 commits intoadadrag:mainfrom
koss822:main
Open

Security Hardening: Migrate OpenClaw LXC to Unprivileged Container#2
koss822 wants to merge 8 commits intoadadrag:mainfrom
koss822:main

Conversation

@koss822
Copy link
Copy Markdown

@koss822 koss822 commented Apr 4, 2026

fix: run OpenClaw in unprivileged LXC container with dedicated non-root user

Security improvements over the original setup-openclaw-lxc.sh:

Container hardening:

  • Switch from privileged (--unprivileged 0) to unprivileged LXC
    (--unprivileged 1) with nesting=1 to support systemd/dbus inside
    the container without exposing root to the Proxmox host
  • Root inside a privileged LXC maps directly to host root, making
    any container escape a full host compromise

Least-privilege execution:

  • Add dedicated 'openclaw' user; gateway, VNC and desktop session
    all run as this user instead of root
  • Restrict 'brewuser' sudo from NOPASSWD:ALL to the brew binary only
  • Restrict 'openclaw' sudo to apt-get, service and systemctl only

Service fixes:

  • Add DISPLAY=:1 and HOME to openclaw-gateway.service so Chrome CDP
    can connect to the running VNC X server
  • Add Wants=vncserver.service to gateway unit so it starts after VNC
  • VNC systemd service now runs as User=openclaw instead of root
  • All config/data files written to /home/openclaw instead of /root

Config fixes:

  • Set browser.noSandbox=true automatically (required in LXC because
    kernel user namespaces are not available even in unprivileged mode)
  • Remove broken 'openclaw browser extension install' call which no
    longer exists in OpenClaw 2026.4.x CLI

Desktop shortcut fixes:

  • Remove +x flag from all .desktop files — PCManFM-Qt shows a
    "window manager" dialog when desktop entries have the executable
    bit set instead of launching them directly
  • Mark all .desktop files as trusted via gio set metadata::trusted
    true so PCManFM-Qt launches them on double-click without prompting

koss822 added 3 commits April 4, 2026 22:38
fix: run OpenClaw in unprivileged LXC container with dedicated non-root user

Security improvements over the original setup-openclaw-lxc.sh:

Container hardening:
- Switch from privileged (--unprivileged 0) to unprivileged LXC
  (--unprivileged 1) with nesting=1 to support systemd/dbus inside
  the container without exposing root to the Proxmox host
- Root inside a privileged LXC maps directly to host root, making
  any container escape a full host compromise

Least-privilege execution:
- Add dedicated 'openclaw' user; gateway, VNC and desktop session
  all run as this user instead of root
- Restrict 'brewuser' sudo from NOPASSWD:ALL to the brew binary only
- Restrict 'openclaw' sudo to apt-get, service and systemctl only

Service fixes:
- Add DISPLAY=:1 and HOME to openclaw-gateway.service so Chrome CDP
  can connect to the running VNC X server
- Add Wants=vncserver.service to gateway unit so it starts after VNC
- VNC systemd service now runs as User=openclaw instead of root
- All config/data files written to /home/openclaw instead of /root

Config fixes:
- Set browser.noSandbox=true automatically (required in LXC because
  kernel user namespaces are not available even in unprivileged mode)
- Remove broken 'openclaw browser extension install' call which no
  longer exists in OpenClaw 2026.4.x CLI
…ot user

fix: run OpenClaw in unprivileged LXC container with dedicated non-root user

Security improvements over the original setup-openclaw-lxc.sh:

Container hardening:
- Switch from privileged (--unprivileged 0) to unprivileged LXC
  (--unprivileged 1) with nesting=1 to support systemd/dbus inside
  the container without exposing root to the Proxmox host
- Root inside a privileged LXC maps directly to host root, making
  any container escape a full host compromise

Least-privilege execution:
- Add dedicated 'openclaw' user; gateway, VNC and desktop session
  all run as this user instead of root
- Restrict 'brewuser' sudo from NOPASSWD:ALL to the brew binary only
- Restrict 'openclaw' sudo to apt-get, service and systemctl only

Service fixes:
- Add DISPLAY=:1 and HOME to openclaw-gateway.service so Chrome CDP
  can connect to the running VNC X server
- Add Wants=vncserver.service to gateway unit so it starts after VNC
- VNC systemd service now runs as User=openclaw instead of root
- All config/data files written to /home/openclaw instead of /root

Config fixes:
- Set browser.noSandbox=true automatically (required in LXC because
  kernel user namespaces are not available even in unprivileged mode)
- Remove broken 'openclaw browser extension install' call which no
  longer exists in OpenClaw 2026.4.x CLI
@koss822 koss822 changed the title Fixing correct display for browser for VNC Security Hardening: Migrate OpenClaw LXC to Unprivileged Container Apr 4, 2026
koss822 added 5 commits April 5, 2026 09:09
PCManFM-Qt (used in LXQt) does not launch .desktop files directly
when they have the executable bit set — instead it shows a "window
manager" dialog asking what to do with the file.

The correct approach for PCManFM-Qt is:
- Remove the +x flag from all .desktop files
- Mark each file as trusted via gio set metadata::trusted true

Without the trusted flag, PCManFM-Qt prompts the user on every
double-click instead of launching the application directly.
All three shortcuts (terminal, onboarding wizard, dashboard) are
now created without +x and marked trusted automatically during setup.
PCManFM-Qt (used in LXQt) does not launch .desktop files directly
when they have the executable bit set — instead it shows a "window
manager" dialog asking what to do with the file.

The correct approach for PCManFM-Qt is:
- Remove the +x flag from all .desktop files
- Mark each file as trusted via gio set metadata::trusted true

Without the trusted flag, PCManFM-Qt prompts the user on every
double-click instead of launching the application directly.
All three shortcuts (terminal, onboarding wizard, dashboard) are
now created without +x and marked trusted automatically during setup.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant