Earlier we announced the availability of
Infobox Jelastic 2 (
review ). We have already managed to consider support for
Python on the example of deploying Django CMS and
Jelastic Cloud API . In this article we will take a closer look at the process of accessing Jelastic environments and containers over SSH via SSH Gateway.

At the end of the article information on how to get 300 rubles to 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 fairly secure: the connection between the client and the server is checked using a digital certificate and the data transmitted over SSH is encrypted.
')
To organize SSH support, a new infrastructure component has been added to Jelastic: SSH Gateway (SSH Gateway). This technology accepts user connections from the Internet and transfers connections to the appropriate containers over 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 process are based on the standard SSH protocol using the open / closed key pairs.
Using the SSH gateway in
Jelastic you can simply access:
- to the whole account with the ability to navigate between your environments and containers using the interactive menu without additional authentication.
- directly to individual containers when you work with them remotely using additional tools (for example, Capistrano) or using SFTP and FISH protocols.
When you access containers through SSH, you get all the necessary rights and you can additionally manage basic services with the
sudo command .
If you deploy any application, change 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 generation with a command
ssh-keygen -t dsa
We recommend that you enter a password for access to the key so that in case of a theft of the key from your computer, the key will be protected additionally.
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 a 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 (for example 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 SSH key in 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 Account Settings tab, go to the SSH Access section.

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

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

Thus, you can add the necessary number of keys and delete unnecessary ones.
The added SSH key is used for the entire account, not just the environment.Access via SSH to your account in Infobox Jelastic
Now finally let's connect to our SSH account. 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 link for SSH access, 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 an SSH connection string (from Settings -> SSH Access).
All commands must be executed on the user's local machine, since on another machine, you need to generate a separate access key or install yours.
2. You will see a list of available on your account environments to connect. 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 a 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.Windows SSH connection
1. To establish an SSH connection in Windows, you will need a previously saved private key. Download and run the
PyTTY SSH Agent (called “Pageant”). The agent will appear in the system tray of the taskbar.
2. Click on Pageant and click on “Add Key”. Choose your private id_rsa 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. Run 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 "Connecting via SSH in Linux / OS X".
Direct SSH access to the environment container
You can connect directly to the environment container, bypassing the steps of selecting the environment and node. To do this, you must know the container ID (which can be seen by connecting in the previous way).

Use the nodeid and uid values ​​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 a container from MySQL – 5.5.34, use the following command:
ssh 6481-97@gate.jelastic.com -p 3022
This feature is useful when you work with tools to deploy and configure remote container configurations, for example,
Capistrano .
Conclusion
We hope the article was helpful to you. Try cloud hosting
Infobox Jelastic 2 for free.
You can also get 300 rubles to the account . At the end of the trial click on the button "Go 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 bonus articles you can get 1 time for 1 account).
If you can not ask questions on Habré, you can ask them in the comments to the article in the
InfoboxCloud Community .
Successful use of
Infobox Jelastic !