Skip to content

Commit e0ce52d

Browse files
ranjeshjCopilot
andauthored
docs: add locked-down WSL gateway admin guide (#625)
* docs: add locked-down WSL gateway admin guide Co-authored-by: Copilot <[email protected]> * docs: align WSL gateway setup guidance Co-authored-by: Copilot <[email protected]> * docs: avoid printing gateway config secrets Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
1 parent 7d9152f commit e0ce52d

4 files changed

Lines changed: 114 additions & 0 deletions

File tree

‎README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ This monorepo contains the Windows hub, shared client libraries, and CLI utiliti
2727
## 🚀 Quick Start
2828

2929
> **End-user installer?** See [docs/SETUP.md](docs/SETUP.md) for a step-by-step installation guide (no build required).
30+
>
31+
> **Managed WSL gateway?** Local setup creates a locked-down app-owned `OpenClawGateway` distro. See [docs/WSL_GATEWAY_ADMIN.md](docs/WSL_GATEWAY_ADMIN.md) for editing `openclaw.json` as the `openclaw` user and using root for protected-file administration.
3032
3133
### Prerequisites
3234
- Windows 10 (20H2+) or Windows 11

‎docs/ONBOARDING_WIZARD.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ Displays the OpenClaw lobster icon, app title, and a brief description. If an ap
2424
### Local setup progress
2525
Installs and connects a new app-owned `OpenClawGateway` WSL instance from a clean WSL baseline. Setup does not export from or mutate an existing user Ubuntu distro; if WSL cannot create the named app-owned distro directly, setup fails with an actionable update message. When replacing an app-owned local gateway, the removal step is shown as part of progress and can be retried on failure.
2626

27+
The managed distro is locked down and is not intended to be a normal interactive Ubuntu profile. For editing `openclaw.json` as the `openclaw` user and using root for protected-file administration, see [Managing the locked-down WSL gateway](WSL_GATEWAY_ADMIN.md).
28+
2729
### Wizard
2830
Renders server-defined setup steps via RPC (`wizard.start` / `wizard.next`). The gateway controls the flow — steps can be:
2931
- **Note** — informational messages

‎docs/SETUP.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ Download and install WebView2 from [Microsoft](https://developer.microsoft.com/m
142142
- See the log at `%LOCALAPPDATA%\OpenClawTray\openclaw-tray.log` for connection errors.
143143
- For easy-button setup, repair, or remove failures, start with `%LOCALAPPDATA%\OpenClawTray\Logs\Setup\easy-setup-latest.txt`; Copilot CLI/debugging tools can use `%LOCALAPPDATA%\OpenClawTray\Logs\Setup\easy-setup-latest.jsonl`.
144144

145+
### Need to inspect or edit the managed WSL gateway
146+
147+
Local setup creates a locked-down app-owned `OpenClawGateway` distro rather than a general-purpose user Ubuntu profile. Edit `openclaw.json` from inside WSL as the `openclaw` user, and reserve `wsl.exe -d OpenClawGateway --user root -- ...` for protected-file administration. See [Managing the locked-down WSL gateway](WSL_GATEWAY_ADMIN.md) for examples.
148+
145149
### "Not yet paired" message on reconnect
146150

147151
If the tray shows **Pending approval** after reconnecting, run the approval command shown in the tray or log:

‎docs/WSL_GATEWAY_ADMIN.md‎

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# Managing the locked-down WSL gateway
2+
3+
Local setup creates an app-owned WSL distro named `OpenClawGateway` by default. It is not a general-purpose Ubuntu profile: the gateway runs as the `openclaw` Linux user, Windows interop is disabled inside WSL, Windows drive automounts are disabled inside WSL, and there is no password-based `sudo` flow.
4+
5+
Use these rules:
6+
7+
- Run normal gateway and config commands as `openclaw`.
8+
- Run sudo-style protected-file commands as `root` from Windows with `wsl.exe --user root`.
9+
- Use double quotes around `bash -lc "..."`; single quotes do not work from Command Prompt.
10+
- Do not edit through the Windows WSL share for this locked-down config; use a WSL shell as `openclaw` instead.
11+
- Do not edit the VHD or `%LOCALAPPDATA%\OpenClawTray\wsl` storage directly.
12+
13+
If your setup used a custom distro name, replace `OpenClawGateway` in the examples below.
14+
15+
## Check the managed distro
16+
17+
```powershell
18+
# Lists WSL distros and shows whether OpenClawGateway is running.
19+
wsl.exe --list --verbose
20+
21+
# Opens a one-shot shell as the gateway user and prints the user plus current directory.
22+
wsl.exe -d OpenClawGateway --user openclaw -- bash -lc "whoami && pwd"
23+
24+
# Opens a one-shot shell as root and prints root identity details.
25+
wsl.exe -d OpenClawGateway --user root -- bash -lc "whoami && id"
26+
```
27+
28+
## Update `openclaw.json`
29+
30+
Most gateway configuration lives in:
31+
32+
```text
33+
/home/openclaw/.openclaw/openclaw.json
34+
```
35+
36+
Because the distro is locked down, edit this file from inside WSL as the `openclaw` user instead of editing it through the Windows filesystem share. The edit commands in this section intentionally change files; the inspection commands in the rest of this guide are read-only.
37+
38+
1. Open a shell as the gateway user:
39+
40+
```powershell
41+
# Opens an interactive shell as the gateway user.
42+
wsl.exe -d OpenClawGateway --user openclaw -- bash
43+
```
44+
45+
2. In that shell, back up and edit the config:
46+
47+
```bash
48+
# Moves into the OpenClaw config directory.
49+
cd /home/openclaw/.openclaw
50+
51+
# Creates a backup copy before editing.
52+
cp openclaw.json openclaw.json.bak
53+
54+
# Opens openclaw.json in the nano editor.
55+
nano openclaw.json
56+
57+
# Verifies that openclaw.json is still valid JSON.
58+
python3 -m json.tool openclaw.json > /dev/null
59+
```
60+
61+
If `nano` is not available, use `vi openclaw.json`.
62+
63+
3. If the change does not take effect, reconnect or restart the gateway from OpenClaw Companion.
64+
65+
Read-only checks for the config:
66+
67+
```powershell
68+
# Shows ownership, permissions, size, and timestamp for openclaw.json.
69+
wsl.exe -d OpenClawGateway --user openclaw -- bash -lc "ls -l /home/openclaw/.openclaw/openclaw.json"
70+
71+
# Verifies that openclaw.json is valid JSON without printing it.
72+
wsl.exe -d OpenClawGateway --user openclaw -- bash -lc "python3 -m json.tool /home/openclaw/.openclaw/openclaw.json > /dev/null"
73+
74+
# Prints only the top-level config keys, not secret values.
75+
wsl.exe -d OpenClawGateway --user openclaw -- python3 -c "import json; data=json.load(open('/home/openclaw/.openclaw/openclaw.json')); print('\n'.join(sorted(data.keys())))"
76+
```
77+
78+
Do not paste or share the full `openclaw.json` file. It can contain gateway tokens, private endpoints, provider settings, or other secrets; redact those values before sharing diagnostics.
79+
80+
## Inspect gateway state
81+
82+
Run gateway service checks as `openclaw`:
83+
84+
```powershell
85+
# Shows the user service status without paging; succeeds even if the service is inactive.
86+
wsl.exe -d OpenClawGateway --user openclaw -- bash -lc "systemctl --user status openclaw-gateway.service --no-pager || true"
87+
88+
# Shows the most recent gateway service journal entries without paging.
89+
wsl.exe -d OpenClawGateway --user openclaw -- bash -lc "journalctl --user-unit openclaw-gateway.service --no-pager -n 80 || true"
90+
91+
# Shows ownership and permissions for the app-owned gateway directories.
92+
wsl.exe -d OpenClawGateway --user openclaw -- bash -lc "ls -ld /home/openclaw/.openclaw /var/lib/openclaw /var/log/openclaw /opt/openclaw"
93+
```
94+
95+
Do not run `systemctl --user` as `root`; that checks root's user service manager, not the gateway's service.
96+
97+
## Use root instead of sudo
98+
99+
There is no interactive sudo password prompt. Open a root shell only when you intentionally need to inspect or change protected files:
100+
101+
```powershell
102+
# Opens an interactive root shell for intentional protected-file work.
103+
wsl.exe -d OpenClawGateway --user root -- bash
104+
```
105+
106+
Keep gateway-owned files under `/home/openclaw/.openclaw`, `/var/lib/openclaw`, `/var/log/openclaw`, and `/opt/openclaw` owned by `openclaw:openclaw`.

0 commit comments

Comments
 (0)