Force dbclient to exit if remote forwarding request failed

Konstantin Tokarev annulen at yandex.ru
Mon Nov 30 19:24:23 AWST 2015


Hi all,

I'm using dbclient to create persistent reverse tunnel, allowing SSH
connection to device from outside. I use sh script like this:

while true; do
  dbclient -y -NT -R 3320:localhost:22 user at host
  echo "dbclient exited with code $?. Respawning..."
  sleep 60
done

However, sometimes I get message

dbclient: Remote TCP forward request failed (port 3320 -> localhost:22)

however dbclient keeps connection after this failure and does not exit.
AFAIU, in this case SSH connection is absolutely useless, and dbclient
could safely exit to allow my script to retry forward request.
* -N => no command is executed
* -T => not interactive session
* Remote TCP forward request failed => no data will ever come from server

1. Is there any way to force dbclient to exit in this case?
2. If not, would it be reasonable feature to have in dbclient?

-- 
Regards,
Konstantin


More information about the Dropbear mailing list