Secure Shell (SSH) keys generation using Putty on Windows

**adsense_4x1Block**
Secure Shell or SSH is a network protocol that allows data to be exchanged using a secure channel between two networked devices.


With more computing and data storage moving to cloud, secure communication between machines is inevitable. For enabling that secure connection SSH is widely used.


SSH uses Private-Public Keys to establish the authenticity of sender and receiver. More on that here on wiki.


For generating this key pair, if you are using Windows here is what you should do:


1. Make sure you have puttygen. You can download it from here:

http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

After you have downloaded the program please run the program

2. Make sure SSH2 RSA is selected.

3. Press Generate, and provide entropy for the key by moving the mouse around.

4. Change the Key comment field to some meaningful description.

5. Enter a passphrase which is used to encrypt the private key.

6. Save the public key.

7. Save the private key.

8. To save the public key in the OpenSSH2 format (required for EC2):

Select all of the text as shown, and copy to the clipboard

Then paste the OpenSSH2 version to a new text file, for example yourname_rsa_new.pub.



Once you have the public keys generated you can use public key for communicating with other machines over network for example Amazon EC2 instances.

Feel free to share your experience regarding generating keys on different machines.

Project Locker & Git Integration using Secure Shell (SSH) & RSA

**adsense_4x1Block**
For a new project we recently started working on, we inherited existing code repository and source code management setup which included:

1. Project Locker as Free Git Repository Host
2. Git as Code Repository
3. TortoiseGit as Git UI
4. STS for development


In order to get started with development on project, we needed to integrate our Git Repository on Project Locker with local repository using TortoiseGit.

For enabling this integration and communication between these components, Secure Shell (SSH) protocol is used, which is based on RSA authentication. SSH protocol uses a Private-Public key pair to secure the connection thus we generated keys using process defined below and configured Project Locker & Git with our local repository. (more on SSH on WikiPedia)


Generating RSA Keys:

1. SpringSource Tools Suite > Preferences > General > Network Connections > SSH2 > Key Management
2. Press Generate RSA Key
3. Press Save Private Key (Click through the warning for Passpharase). Browse for the destination where you want to put the Private Key. Both private and public keys will be saved in selected folder. (id_rsa, id_rsa.pub)


Configuring Project Locker for Access:

1. Sign into your Project Locker account and select ‘Manage Public Keys’ under User Links on left menu.
2. Press New Key link at the bottom of table. Enter name for your machine, and Username in the format of @
3. Open id_rsa.pub file in notepad and copy paste its contents into Key field. Make sure there are no extra white spaces at the end of the content. Save Public Key


Generating Putty Formatted Private/Public Keys:

1. Download and Launch puttygen.exe.
2. Clik on Load button and browse to the id_rsa private key generated through STS above.
3. Click on Save private key button, which will save Putty formatted private key to your desired destination with *.ppk extension. Save public Key as well.


Configuring TortoiseGit for remote Repository:

1. Right click in the folder where you want to pull code from remote repository.
2. Select TortoiseGit > Settings from the context menu.
3. In Settings wizard, select Git > Remote settings. If you already have an origin (Default Git remote) then update otherwise create new. use settings below to configure your remote.

Remote: origin
Url: git-XXXXXX@pl3.projectlocker.com:XXXXXX.git //Url obtained from Project locker’s dashboard against Git repository
Putty Key: D:/Path to your private key generated through Putty


Hopefully these steps will guide you enough, however if you still have queries, feel free to post in comments.