Repository navigation
echoserver: fix agent and port forwarding - #1336
ejohnstown wants to merge 4 commits into
Conversation
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #1336
Scan targets checked: wolfssh-src, wolfssh-bugs
Not reviewed (no scan target covers them): README.md, scripts/fwd-bulk.test, scripts/fwd.test.expect, scripts/openssh-interop.test
Coverage: 1 of 1 in-scope changed file(s) opened by the reviewer
Fenrir result: Approved ✅
No new issues found in the changed files.
Advisory only — this automated result does not count as a GitHub approval.
Review tier: Lite
The forwarded agent socket now lives in a mkdtemp() directory, and the session's end runs the agent cleanup, which the library never calls on a server. The relay addresses the agent channel by its own id and drains each agent reply in full. - Set agentChannelId from ssh->agent once the agent channel is open - Drop agent replies when no local agent client is connected - Close the accepted agent client in WOLFSSH_AGENT_LOCAL_CLEANUP and remove the socket and its directory - Print the socket path; openssh-interop.test forwards ssh-agent through the echoserver, lists a reply larger than the relay buffer, and checks the directory is private and removed Issue: F-10553, F-11936, F-14396
The forwarding callback connects and binds with the server's own credentials, so it is registered only with the new -F option. Without it the library turns down every forwarding request. - Bind a remote forward for localhost or 127.0.0.1 to the loopback address, not INADDR_ANY - Refuse a remote forward to a privileged port or one over 65535 - Pass -F in fwd.test and fwd-bulk.test; document it in README.md - openssh-interop.test checks a remote forward fails without -F, works with it, and is refused by the port check for port 80 Issue: F-11935
With -F a peer's direct-tcpip open is set up only for a loopback destination. The new -L option replaces that default with a list of allowed host or host:port entries. Any other open is refused, which the library reports as administratively prohibited. - Check the destination in the WOLFSSH_FWD_LOCAL_SETUP action - Document -L in the usage text and README.md - openssh-interop.test checks a non-loopback destination and one left out of -L are refused, and that host and host:port entries connect Issue: F-11935
A root-run echoserver with -F now switches to an unprivileged user once the listener is bound and the keys are loaded, before any peer is served, so forwarded connects and binds no longer run as root. The new -u option names the user; the default is nobody, with a warning. A failed switch ends the server. - Add DropPrivileges(): setgroups, setgid, setuid, then check root cannot be regained - Build it only for the standalone POSIX echoserver with WOLFSSH_FWD, not for the tests that run echoserver_test() in-process - Warn on stderr that -u is ignored in a build without it - Document -u in the usage text and README.md Issue: F-11935
bc50ab3 to
4bf3857
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #1336
Scan targets checked: none
Unchanged since last review (not re-run): wolfssh-src, wolfssh-bugs
Not reviewed (no scan target covers them): README.md, scripts/fwd-bulk.test, scripts/fwd.test.expect, scripts/openssh-interop.test
Fenrir result: Approved ✅
No new issues found in the changed files.
Advisory only — this automated result does not count as a GitHub approval.
Review tier: Lite
Agent forwarding through the echoserver now works and cleans up after
itself, and port forwarding is off unless the server is started with
-F, since the forwards run with the server's own credentials.
session end; the relay drains agent replies of any size.
and privileged or out-of-range ports are refused.
a warning) before serving any peer.
Issue: F-10553, F-11936, F-14396, F-11935