SSH Access to Infobox Jelastic 2 Cloud Hosting

    Earlier we announced the availability of Infobox Jelastic 2 ( review ). We already managed to consider support of Python on the example of deployment of Django CMS and Jelastic Cloud API . In this article, we will take a closer look at the process of accessing Jelastic environments and containers via SSH through SSH Gateway. At the end of the article, information on how to get 300 rubles into the account for experiments with Infobox Jelastic.





    SSH Access


    SSH (Secure Shell Handler) is a protocol used to securely connect to remote containers and execute the required commands. Using SSH is quite safe: the connection between the client and server is checked using a digital certificate and the data transmitted via SSH is encrypted.

    To organize SSH support, a new infrastructure component has been added to Jelastic: SSH Gateway. This technology accepts user connections from the Internet and transfers connections to the appropriate containers on the internal network.



    The authentication process in the SSH gateway is divided into two independent steps:
    • connection from the end user to the gateway using external authentication;
    • connection from the gateway to the user container using internal authentication.

    Both steps of the authentication procedure are based on the standard SSH protocol using public / private key pairs.

    Using the SSH gateway in Jelastic, you can simply access:
    • to an entire account with the ability to navigate between your environments and containers using an interactive menu without additional authentication.
    • directly to individual containers when you work with them remotely using additional tools (such as Capistrano) or using the SFTP and FISH protocols.

    When you get access to containers through SSH, you get all the necessary rights and can additionally manage basic services using the sudo command .

    If you deploy any application, change the configuration settings or add any external functionality via SSH to your Jelastic environment, this will not be displayed in the control panel.

    SSH key generation

    For Linux / OS X

    Generate a new SSH key (dsa or rsa) using the ssh_keygen utility:

    1. Start the generation with the command
    ssh-keygen -t dsa
    

    We recommend that you enter a password to access the key, so that if the key is stolen from your computer, the key is additionally protected.

    2. Go to id_dsa.pub and get the public key
    cd ~/.ssh $ cat id_dsa.pub
    

    3. Copy the key to the OS clipboard.

    In this example, we generated the dsa key. You can generate and rsa key using the command:
    ssh-keygen -t rsa
    


    For windows

    1. Download and run the SSH key generation utility, for example PuTTYgen :



    2. Specify the following parameters:
    • select the key type SSH-2 RSA or SSH-2 DSA;
    • enter the desired number of bits (e.g. 2048).

    Click Generate .



    3. Copy the generated key from the public key field at the top of the window.



    Enter the password in the key passphrase fields and save the public and private key (for example, under the name "id_rsa.pub" and private under the name "id_rsa").



    Adding an SSH Key to Infobox Jelastic

    Now you can add the generated public key to the Jelastic control panel.

    1. Open the Infobox Jelastic control panel and click the Settings button in the top toolbar.



    2. In the open tab "Account Settings", go to the SSH Access section.



    3. Click “Add SSH Key” and paste the public key previously copied to the OS clipboard.



    4. Click “Add key”. As a result, the key appears in the list.



    Thus, you can add the required number of keys and delete unnecessary ones.

    The added SSH key is used for the entire account, and not for one environment.

    SSH Access to an Infobox Jelastic Account

    Now, finally, let's connect to our account via SSH. Open the Jelastic control panel and click “Settings” in the top toolbar.



    In the open Account Settings tab, go to the SSH Access section.

    Just click on the SSH access link highlighted in yellow. The console will open automatically. Or just copy the command for SSH access and run it in the console (SSH client).



    Consider the connection process in more detail for Linux / OS X and Windows.

    SSH connection on Linux / OS X

    1. Open a terminal and enter the SSH connection string (from Settings -> SSH Access).

    All commands must be executed on the user's local machine, as on another machine you need to generate a separate passkey or install yours.



    2. You will see a list of connection environments available on your account. Please select the required one by entering its number.

    You can only connect to running environments.



    3. After that, you will see a complete list of environment containers. For each, the node ID and ip address are indicated. To access the container, enter its number in the list.



    4. Now, using the command line, you can configure the necessary configurations.



    Using the command line there is a risk of breaking something in your website or application. Please be careful.

    SSH Connection on Windows

    1. To establish a connection via SSH in Windows, you will need a previously saved private key. Download and run the PyTTY SSH Agent (called “Pageant”). The agent appears in the system tray of the taskbar.

    2. Click on Pageant and click “Add Key”. Choose your id_rsa private key.



    Then you can close the Pageant window, but do not close the utility in the system tray. It will be used in the process of working with the SSH session.

    3. Download and install the SSH PyTTY client . Launch it and go to the "Sessions" section.

    4. Fill in the Host Name field with the data from your SSH connection string. Also specify the port for connection 3022.



    The console displays a list of available environments. Further actions are identical to the section “SSH Connection in Linux / OS X”.

    SSH direct access to the environment container

    You can connect immediately to the environment container, bypassing the steps for selecting the environment and nodes. To do this, you must know the container ID (which can be seen by connecting in the previous way).



    Use the nodeid and uid value of the required container in the following command:
    ssh {nodeid}-{uid}@{SSH_gateway} -p 3022
    

    , where {uid} and {ssh_gateway} are listed in the Infobox Jelastic control panel (Settings -> SSH Access).

    For example, to directly access the container with MySQL – 5.5.34, use the following command:
    ssh 6481-97@gate.jelastic.com -p 3022
    


    This feature is useful when you are working with tools to deploy and configure remote container configurations, such as Capistrano .

    Conclusion


    We hope the article was helpful to you. Try Infobox Jelastic 2 cloud hosting for free. Also, you can get 300 rubles to the account . At the end of the trial, click on the button "Switch to the paid version", fill in the necessary data. Next, send us your login from Infobox Jelastic and we will replenish your account (from the articles you can get a bonus 1 time per 1 account).

    If you cannot ask questions on Habré, you can ask them in the comments to the article in the InfoboxCloud Community .

    Successful use of Infobox Jelastic !

    Also popular now: