Here is our first vCenter plugin ! It’s been a while we wanted to do this, here it is now :p
sshAutoConnect is a vCenter (or more likely vSphere Client) plugin.
In vSphere Client, you can open plugin window in order to view installed/activated/available plugins through “Plug-ins > Manage Plug-ins…” :
sshAutoConnect plugin will allow you to automatically connect with SSH to ESX/i directly in vSphere Client.
It makes able to manage your SSH connection straight in vSphere Client.
So we decide to develop our own plugin to add this feature.
As every vSphere client plugin, you just need to download the archive below and uncompress it in the default vSphere client plugin folder, and restart the client :
C:\Program Files (x86)\VMware\Infrastructure\Virtual Infrastructure Client\Plugins
The plugin setup is made as easy as possible. The plugin is built to use sshAutoConnect.xml file in the same folder that the .dll library that can be used to specify credentials for automatic connection (optional) :
<?xml version="1.0" encoding="utf-8" ?> <credentials> <default> <login>root</login> <password>d3d3LnZtZHVkZS5mcg==</password> </default> <custom_servers> <server name="server-esx-01.vmdude.fr"> <login>root</login> <password>d3d3Lmh5cGVydmlzb3IuZnI=</password> </server> <server name="server-esx-02.vmdude.fr"> <login>root</login> <password>d3d3LnZtd2FyZS5mcg==</password> </server> </custom_servers> </credentials>
The xml file have 2 branch : <default> and <custom_servers>
The branch <default> will be used if the server you’re trying to connect doesn’t exist in <custom_servers> branch. This allows you to make some exceptions for specific servers.
If the file doesn’t exist, the plugin will not provide any credential during SSH connection, therefore you’ll have to authenticate.
Note : The passwords put in configuration file have to be encoded in Base64, you can read our previous post about encode/decode Base64 with Powershell : Base64 managing
The usage of the plugin is very easy, you just have to right clic on the ESX/i server you wanted to connect and clic on sshAutoConnect :
- Here is the .zip archive with the plugin folder containing .dll file and a sample configuration file : sshAutoConnect
- Here are the Visual Studio 2010 source (can be built as usual with MSBuild/csc/VisualStudio) : sshAutoConnect-sources
Note : a big thanks to R0llB4ck for his help and the trick with Embedded Resource in C#