2.1 KiB
2.1 KiB
id, name, status, depends_on, scope, risk, impact, level
| id | name | status | depends_on | scope | risk | impact | level | |||
|---|---|---|---|---|---|---|---|---|---|---|
| client/port-forwarding | Implement port forwarding — local (-L) and remote (-R) forwards | pending |
|
moderate | medium | component | implementation |
Description
Implement SSH port forwarding per client.md:
Local port forwards (-L local_addr:local_port:remote_host:remote_port):
- Bind
TcpListeneronlocal_addr:local_port - For each accepted connection, open
channel_open_direct_tcpip(remote_host, remote_port, ...) - Proxy bytes bidirectionally via
copy_bidirectional
Remote port forwards (-R remote_addr:remote_port:local_host:local_port):
- Send
tcpip_forward(remote_addr, remote_port)to request the server listen on a port - When the handler receives
server_channel_open_forwarded_tcpip, connect tolocal_host:local_port - Proxy bytes bidirectionally
Both types are specified as repeatable --forward / --remote-forward CLI options.
Acceptance Criteria
crates/wraith-core/src/client/forward.rsexportsPortForwardSpec,LocalForwarder,RemoteForwarderPortForwardSpecparses-L/-Rspec strings:local_addr:local_port:remote_host:remote_portLocalForwarderbinds TcpListener, accepts connections, opens SSH direct-tcpip channel for each, proxies bidirectionallyRemoteForwardersendstcpip_forwardrequest, handlesforwarded-tcpipchannel opens, connects to local target, proxies bidirectionally- Both forwarders handle their accept loops concurrently with the SOCKS5 server
- Connection errors close the individual channel without affecting other forwards or the SSH session
- Port forward listeners are re-registered after SSH reconnection (depends on channel-manager)
- Unit tests: spec parsing, local forward proxy, remote forward request handling
References
- docs/architecture/client.md — Port Forwarding section
- docs/architecture/decisions/005-socks5-before-tun.md — port forwarding as optional complement to SOCKS5
Notes
To be filled by implementation agent
Summary
To be filled on completion