I have this command that creates a working ssh tunnel for access to MySQL server:
ssh -f test@remotehost -L 127.0.0.1:3306:mysqlhost:3306 -N
Here, remotehost is accessible only via jump host which I configured with the help of ProxyCommand in .ssh/config:
Host somehost
Hostname jumphost-name
ForwardAgent yes
ControlPath ~/.ssh/cm-%r@%h:%p
ControlMaster auto
ControlPersist 10m
Host *.example.com
User test
StrictHostKeyChecking no
ProxyCommand ssh -X -4 test@somehost nc %h %p
How can I do the same using expect tool?