Articles related to real life scenarios involving java, frameworks and libraries configurations and salt-stack. The topics includes Core Java, Hibernate, Spring MySQL, Multithreading, Java NIO, jQuery, c3p0, Connection pooling, salt state, pillar, grain etc.

Sunday, July 15, 2018

Using Chrome Secure Shell to connect to your AWS instances/Key Protected instances

1:51 AM Posted by Unknown 1 comment

Using Chrome Secure Shell to connect to your AWS instances/Key Protected instances.

There are many tools available to SSH into your key auth enabled instances. On Windows mainly the putty, on macOS and Linux Distros mainly termnial. If you use variety of OSes and you want similar terminal experiance everywhere or you are using ChromeOS. you can use Chrome Secure Shell.
I mainly use it on Windows because it feel much more like terminal with better scrolling specifically.
Here's how to connect to your key auth protected instances using Secure Shell.

Pre Requisites

  • Protect your key with passphrase.
    • Follow steps in this post to protect your key with passphrase.
    • You should always protect your keys with passphrase and specially while using it with SecureShell because it uses HTML5 FileSystem which is relatively new and may have unfound exploits. Here's the reference
  • Prepare your keys for specific SecureShell requirements.
SSH connection using key pair in SecureShell has specific requirements.
  • Only PEM key will not suffice. You need to have PrivateKey and PublicKey.
  • If you only have a pem file. You need to extract public key from it. Follow steps in this post
  • The private key and public key must have the same name.
  • The PrivateKey should have no extention and the PublicKey should have .pub extention.
  • Example:
    • If you have a key named MainKey.pem or any name you want, you must create a public key from it and rename them to the following.
    • PrivateKey (MainKey.pem) > MainKey
    • PublicKey (MainKey.pub) > MainKey.pub

Steps

  • Install Secure Shell
  • Open Secure Shell from Chrome by entering the following in the Chrome Search Box chrome://apps/ and Click Secure Shell, OR directly enter the following in Chrome search bar chrome-extension://pnhechapfaindjhompbnflcldabbghjo/html/nassh.html
  • The SS app opens up, ready for you to configure. Here's how it looks. 

  • Fill up the details
    • Name of the connection - keep it short without spaces you will be able to use it to open SSH connection easily. I will come to that later.
    • SSH username
    • SSH Host
    • SSH Port
    • Now import the kyes by Clicking on Import...
      • This will open up file selector, select the two file in this example MainKey and MainKey.pub and click Open

    • That's it. Now click on Connect or hit Enter to connect.
    • If you have passphrase for the key, It will ask you to enter passphrase.
    • Once connected you should see the server prompt. 

Pro Tip

  1. You can connect to any of the saved connection by entering ssh <profile name> in the Chrome search box/omnibox. 

  1. You can bookmark connections for easy accessiblity.
  2. You can connect to multiple instance in one click. For DevOps there are many cases where we want to connection multiple instances while doing something. Here's how I do that.
  • Bookmark all the connections
  • Move all the bookmarks into a Folder.
  • Right Click on the Bookmark folder and click Open All in new Window

1 comment: