[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#539412: ssh -oExitOnForwardFailure=yes -R... -f fails too late



Package: openssh-client
Version: 1:5.1p1-5

Three ssh client features, that work individually, fail in combination.

1) -f, to fork and exit after initial connection
2) -R, to bind remote ports and forward to the local network
3) -o ExitOnForwardFailure=yes, to immediately indicate failure of -L or -R

Unfortunately, -f causes the session to fork-and-exit before the
forwarding happens.  So even if it does fail, we get an exit status 0
instead of 255.

It works without -f:

    $ ssh -oExitOnForwardFailure=yes -R1024:localhost:1 some_host 'true' || echo 'FAILED'
    $ ssh -oExitOnForwardFailure=yes -R1023:localhost:1 some_host 'true' || echo 'FAILED'
    Error: remote port forwarding failed for listen port 1023
    FAILED

But with -f, doesn't seem to fail until after the fork:

    $ ssh -f -oExitOnForwardFailure=yes -R1024:localhost:1 some_host 'true' || echo 'FAILED'
    $ ssh -f -oExitOnForwardFailure=yes -R1023:localhost:1 some_host 'true' || echo 'FAILED'
    $ Error: remote port forwarding failed for listen port 1023

Interestingly, it works with protocol 1 - possibly because it just ignores the -f...

    $ ssh -f -1 -oExitOnForwardFailure=yes -R1024:localhost:1 some_host 'true' || echo 'FAILED'
    $ ssh -f -1 -oExitOnForwardFailure=yes -R1023:localhost:1 some_host 'true' || echo 'FAILED'
    Received disconnect from 172.17.99.20: Requested forwarding of port 1023 but user is not root.
    FAILED

This is almost certainly client side, but FYI, the server is also on 1:5.1p1-5.
-- 
Peter Samuelson | org-tld!p12n!peter | http://p12n.org/



Reply to: