-
Notifications
You must be signed in to change notification settings - Fork 13
fix: read socket-control-password from XDG state dir (cmux 0.64+) #8
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -140,8 +140,41 @@ Depending on the log: | |
| |---|---|---| | ||
| | `cmux event stream unavailable: socketMissing` | cmux is not running | Launch the cmux app, then `launchctl kickstart -k "$SERVICE"` | | ||
| | Repeated `Connection refused` | cmux restarted and the socket name rotated | `launchctl kickstart -k "$SERVICE"`; if needed, re-run `./scripts/install-launchd.sh` | | ||
| | Repeated `cmux event stream attached` then immediately `detached` | cmux socket access denied (cmux 0.64+) | See **③a** below | | ||
| | Three lines OK but only the app can't attach | network/address issue | Check ④ and ⑤ | | ||
|
|
||
| ### ③a Socket access denied (cmux 0.64+) | ||
|
|
||
| cmux 0.64 introduced a socket access control mode that defaults to | ||
| `cmuxOnly` — only processes launched inside cmux can connect. The relay | ||
| runs as a launchd agent outside cmux and is denied. | ||
|
|
||
| Fix: tell cmux to accept password-authenticated external connections by | ||
| creating `~/.config/cmux/cmux.json` with: | ||
|
|
||
| ```bash | ||
| mkdir -p ~/.config/cmux | ||
| cat > ~/.config/cmux/cmux.json << 'EOF' | ||
| { | ||
| "automation": { | ||
| "socketControlMode": "password", | ||
| "socketPassword": "$(openssl rand -hex 24)" | ||
| } | ||
| } | ||
| EOF | ||
| ``` | ||
|
|
||
| Or write the file manually with any strong password you choose, then | ||
| reload from **inside a cmux terminal**: | ||
|
|
||
| ```bash | ||
| cmux reload-config | ||
| ``` | ||
|
|
||
| The relay reads the password automatically from | ||
| `~/.local/state/cmux/socket-control-password` (written by cmux on | ||
| reload). No relay restart is needed. | ||
|
Comment on lines
+174
to
+176
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== Outline the downstream consumer =="
ast-grep outline Sources/RelayCore/CmuxConnection.swift --view expanded || true
echo
echo "== Find CmuxConnection construction sites =="
rg -nC3 '\bCmuxConnection\s*\(' Sources Tests
echo
echo "== Find cmuxSocketPassword call sites =="
rg -nC3 '\bcmuxSocketPassword\s*\(' Sources TestsRepository: NewTurn2017/cmux-remote Length of output: 8394 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== CmuxConnection implementation =="
sed -n '1,220p' Sources/RelayCore/CmuxConnection.swift
echo
echo "== CmuxRelay startup flow =="
sed -n '1,180p' Sources/RelayServer/CmuxRelay.swift
echo
echo "== Search for relay reload/recreate paths =="
rg -nC2 'reload-config|reload\(|invalidateEvents\(|connectForEvents\(|observe\(bootInfo\)' Sources TestsRepository: NewTurn2017/cmux-remote Length of output: 16507 Drop the “No relay restart is needed” claim 🤖 Prompt for AI Agents |
||
|
|
||
| ### ④ Is Tailscale online on both ends? | ||
|
|
||
| ```bash | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Remove the quoted heredoc here.
Line 157 uses
<< 'EOF', so Line 161 writes the literal text$(openssl rand -hex 24)intocmux.jsoninstead of a random secret. That makes the documented password predictable.Suggested fix
📝 Committable suggestion
🤖 Prompt for AI Agents