Waiting until tunnel (ssh -w) is set up before running command

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

 



When using VPN tunnelling (-w option), is there a way to know when the
tunnel is actually up? I want to use this in a script that
automatically sets up the tunnel by running ssh -w then running ifup
[1].

The -f option doesn't help because it returns after connecting to the
server but before the tunnel is up. Sleeping for a few seconds does
work, but it just feels too hacky.

The LocalCommand option seems to work, for example:
ssh -w 0:1 "-oLocalCommand=ifup tun0" "-oPermitLocalCommand=yes"
myserver.example.org true

However, the man page says: "The command is run synchronously and does
not have access to the session of the ssh(1) that spawned it." Is the
above invocation guaranteed to work or was it just luck that
LocalCommand was executed after the tunnel is set up?

More importantly, is there a standard way for using ssh -w in scripts?

[1] I'm on Fedora, ifup works because I've set up
/etc/sysconfig/network-scripts/ifcfg-tun0 and
/etc/sysconfig/network-scripts/route-tun0
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@xxxxxxxxxxx
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev




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

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux