Skip to content

Improve SOCKS auth: enforce per-user ACL on socks channels#591

Merged
jpillora merged 1 commit into
masterfrom
improve-socks-auth
Jun 27, 2026
Merged

Improve SOCKS auth: enforce per-user ACL on socks channels#591
jpillora merged 1 commit into
masterfrom
improve-socks-auth

Conversation

@jpillora

Copy link
Copy Markdown
Owner

Authorize SOCKS channels against the per-user --authfile ACL, the same way TCP/UDP forwards already are.

Changes

  • handleSSHChannel now applies the per-user ACL to socks channels (previously socks channels skipped the check).
  • Remote.UserAddr() returns "socks" for forward socks remotes, so an operator grants socks with a ^socks$ entry — the same token the per-channel check uses. The config-time and channel-level checks now agree.
  • Tests: socks-channel allow/deny coverage in acl_channel_test.go, plus an end-to-end forward-socks test (real client → server → SOCKS5 proxy → endpoint) for a ^socks$-only user.

Compatibility

Only ever restricts socks; never grants more. Unaffected: no-auth servers, --auth single-user, authfile [""]/["*"] (full access), and destination-restricted users. A user previously granted broad access via a colon-style pattern that does not match socks should add ^socks$ (or *).

Verification

go build, go vet, go test ./..., and go test -race on tunnel/e2e/settings all pass.

🤖 Generated with Claude Code

- socks channels are now authorized against the per-user --authfile ACL,
  consistent with TCP/UDP forwards.
- Remote.UserAddr() returns "socks" for forward socks remotes, so a user is
  granted socks via a ^socks$ entry — the token the per-channel check uses.
- Add socks channel allow/deny regression tests plus an end-to-end
  forward-socks test.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jpillora jpillora merged commit 927abde into master Jun 27, 2026
10 checks passed
@jpillora jpillora deleted the improve-socks-auth branch June 27, 2026 13:02
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