Saturday, June 1, 2013

Putty: generating session configuration from code

I am an automation freak, and I hate doing manual copy and paste of information around.

I have to work on some 30 different accounts, so it's quite nice to store all this info in a CMDB and generate all the Putty session from it.

Unfortunately Putty uses the Windows Registry - which sucks. There are information on how to export this info, but I could not figure out how to store the hostname-username-password.

I find it much easier to bypass putty with MTPutty and generate myself the mtputty.xml file.
Here http://ttyplus.com/multi-tabbed-putty/faq.html they explain how:


I am creating mtputty.xml myself. How can I encrypt my passwords?

You can use XML tag "PlainPassword" instead of "Password". Specify your password under this tag as a plaintext. When you quit MTPuTTY, PlainPassword will be removed automatically, but your password will be saved encrypted.

I will ignore the MTPutty/Servers/Putty section and do only the MTPutty/Internals/Putty/Node. Each node is like this:
<Node Type="1">
 <SavedSession>PH30-0KWP355</SavedSession>
 <DisplayName>PH30-0KWP355_oracle_2228</DisplayName>
 <ServerName>10.140.21.45</ServerName>
 <PuttyConType>4</PuttyConType>
 <Port>2228</Port>
 <UserName>oracle</UserName>
 <Password>g9X5n9zRcaw=</Password>
 <PasswordDelay>0</PasswordDelay>
 <CLParams>-load PH30-0KWP355 10.140.21.45 -ssh -P 2228 -l oracle -pw *****</CLParams>
 <ScriptDelay>0</ScriptDelay>
</Node>



No comments: