An Engineer’s Guide To The Galaxy Using KeePass

If you’re like me, and have multiple cloud environments, and multiple servers to manage, the task can be quite daunting.  There are many paid for utilities out there that can help you with this task, but I’ve found that a utility called: KeePass Password Safe, does the job flawlessly if you are willing to do some custom configurations.  KeePass is not just for IT engineers, it’s free and open source so anyone can use it.  It really is the modern day Swiss Army knife for all geeks alike.

_________________________________________________________________

The Benefits

  • The database is encrypted using the most secure and best known algorithms AES and Twofish.
  • It is password protected, so assuming you are following password best practices, the KeePass database with your environment variables will remain secure if it is misplaced.
  • You can use KeePass from your local box, plus drop the same database file onto a jump server within your environment, to easily setup a secondary base of operations for yourself.
  • IT IS FREE. Open source too (OSI certified).

You Know You Want It

_________________________________________________________________

Now, there are many platforms that support KeePass, but this post will focus on Windows, as the majority of legacy IT departments are not too keen on running Linux or OSX in their environments, although those two platforms are quickly gaining traction in the modern era of hyper converged infrastructure.

The two key features I will focus on in this post are the abilities to use KeePass to open SSH and RDP sessions.  Assuming you already have KeePass installed, go into the Tools menu and then click Options

keepass1

Now go to the Integration tab in the options window, and click the URL Overrides button

keepass2

We will be creating two custom URL Override entries one for SSH (putty session) and the other for RDP (Microsoft Remote Desktop)

Click the Add button to get started:

keepass3

Assuming you installed Putty to its default directory, you need to tell KeePass where to find the executable. You can call Scheme whatever you wish, but for simplicity ssh was chosen for this example.

keepass4
Scheme: ssh
URL override: cmd://”C:\Program Files (x86)\PuTTY\PuTTY.exe” -ssh {URL:RMVSCM}

Click OK when finished.

Now for RDP sessions we will need to string together several commands in order to get the desired result. Here we are calling MSTSC (RDP) through the command prompt, configuring a timeout, and passing through credentials. You can call Scheme whatever you wish, but for simplicity rdp was chosen for this example.

Click Add button again

Scheme: rdp
URL override: cmd:// cmd /c “cmdkey /generic: TERMSRV/{URL:RMVSCM} /user:{USERNAME} /pass:{PASSWORD} && mstsc /v:{URL:RMVSCM} && timeout /t 5 /nobreak && /delete:TERMSRV/{URL:RMVSCM}”

Click OK when finished.

Now in KeePass when you create a new “entry”, you can enter a URL of rdp://ipaddress (or name of server) and KeePass will open a rdp session whenever you click on the link.  Likewise if you create a new “entry” for a putty session to a Linux box or network appliance, you can enter a URL of ssh://ipaddress and KeePass will open a putty session whenever you click on the URL link when you select your various entries.  In both cases you should specify a user account to use as RDP links especially need this to work.

There you have it.  Now you can build out the KeePass database with custom links to your various systems, to aid you in your quest in mastering your environment.