Server profiles (YAML): default-deny allowlists, forced DNS, per-connection logging#1072
Server profiles (YAML): default-deny allowlists, forced DNS, per-connection logging#1072sandinak wants to merge 33 commits intosshuttle:masterfrom
Conversation
…ct/validate profile; YAML config coming)
…nly 10.4.188.128/25). Enforce TCP allowlists and log per-connection. Force DNS to configured nameserver if present. (TCP src tuple support to follow)
…ily,srcip,srcport,dstip,dstport)
…nes (iptables-style)
… test-bed (installs YAML and tails logs)
…r test-bed; test script uses profile=testing and curls node-2
…o avoid registry pulls
… in server container before copying YAML
…to avoid NameError during connect
…e key-based fallback; neutralize SSH_AUTH_SOCK/XDG_RUNTIME_DIR in test
…g profile allows TCP 5001
…SH connectivity during tests
…container IP connectivity flakiness
…md) so sshpass is not required
…rride; prefer localhost:2222 for node-1
…/openssh-server variants
…curl if iperf3 missing on host
… YAML configs; keep image lean otherwise
…g python -m pip for PyYAML
… keep explicit perms for test user
|
Pushed a small shell style cleanup: brace variables and consistent quoting across scripts (exec-sshuttle, exec-tool, test-profiles). No functional changes. Re-ran the containerized profile test locally (scripts/test-profiles): sshuttle connects, node-2 nginx reachable via profile "testing", and server logs show ALLOWED entries as expected. CI should remain green; happy to address any review nits. |
|
Can you please explain something about the use case here? /etc/sshuttle/server.yaml is loaded on the server by the server, correct? |
|
So the used case is, we are in an environment where we have a VPN service that constrains to any other VPN services as most vpns do. Our users are starting to use sshuttle to get access to services inside the protected network. We want to enable them to have this capability, but not have them have the ability to have unconstrained access. So the idea here is that this would allow us to set specific access controls from the server side, and allow the users to use this modified version of sshuttle and still maintain security and visibility. I posted the PR as a possibility in case you wanted to include this as a feature long-term. |
|
Updates for server profiles feature:
Happy to iterate if you prefer a build-time flag instead of the runtime toggle, or if you want the process title change guarded behind a separate opt-in. |
…fig; if profile is requested but no config, fail with clear error; log via standard server logging when unprofiled; docs: add behavior and manpage/usage updates
|
Local E2E results (Docker test-bed) Positive path
Negative path (no server config)
Conclusion: Behavior matches the intended semantics:
If you’d like any tweaks to the error wording or additional fields in the syslog-style output, happy to adjust. |
|
Added a top-level examples/ directory with server-side configuration samples:
Docs updated: top of docs/usage.rst now links to these examples and reminds where to place the file on the server (/etc/sshuttle/server.yaml or ~/.config/sshuttle/server.yaml). If you want additional scenarios (e.g., audit-only logs, UDP-only, or deny-by-default with explicit allows), I can add more examples. |
…link from usage; tests: add negative no-config case to scripts/test-profiles
… client simulates RST to local app
…eset behavior; logging to syslog; tests: add blocked-port check to test-profiles
|
Did you mean to include the |
Update: TCP reset + syslog logging + username verificationChanges implemented:
E2E test results:✅ Allowed traffic: curl to nginx:8080 works, logged with Key log entries from E2E run:The implementation provides operational visibility through syslog while maintaining fast failure behavior for blocked TCP connections. |
This PR introduces a server-side profiles capability loaded from YAML.
Next steps: extend wire protocol to include TCP/UDP/DNS source tuple to log accurately and enforce by src if desired; add UDP/DNS enforcement.
This is a draft to facilitate early review and CI.
Pull Request opened by Augment Code with guidance from the PR author