Remotely managing VMWare servers via SSH

As the cornerstone of any company's server infrastructure it is extremely rare to find VMWare servers (be they Server, ESX or ESXi) directly exposed the the Internet.  Generally these important services are hidden behind layers of protection which can make managing them when not onsite quite a challenge.  Of course you could setup a VPN or use some remote desktop access software, but why bother when plain old SSH can do the job for you. 

Once you have SSH access to a system within the organisation's network it is a fairly simple task to create virtual tunnels to the VMWare servers.  This is a secure way to manage the devices because all traffic goes through an encrypted tunnel and beyond the SSH service itself you are not interacting with any other internal services. 

Remote VMWare server access requires two SSH tunnels, an HTTPS tunnel (typically port 443) and a console tunnel (typically port 902).  Below is a small script that you can use to create these tunnels from Linux, OSX or any other *NIX operating system.