SSH Tunneling

You can connect Postgres, MySQL, MSSQL, MongoDB, and other databases that are hosted under a private network via SSH tunnels.

Prerequisites

First, you need to configure your bastion host to allow UI Bakery to connect to establish an SSH tunnel. To do so, follow the next steps:

  1. Create a UI Bakery user (UI Bakery will connect to your bastion as this user):

# Use this command if you use Amazon Linux
sudo adduser uibakery --password NP

# Use this command if you use any other Linux/Mac
sudo adduser uibakery --disabled-password
  1. Next, create a required folder structure and store the public key in the authorized_keys file to allow UI Bakery to connect to your bastion :

# Login as root user
sudo su

# Create the authorized_keys file if it does not exist
mkdir -p /home/uibakery/.ssh 
touch /home/uibakery/.ssh/authorized_keys 

# Set required permissions and make uibakery user an owner of this file
chmod 644 /home/uibakery/.ssh/authorized_keys
chown uibakery:uibakery /home/uibakery/.ssh/authorized_keys

# Use any text editor and insert previously copied ssh public key in authorized_keys file
vim /home/uibakery/.ssh/authorized_keys

Once configured you can proceed with connecting your database.

The same steps apply for on-premise deployments as well.

Enabling SSH tunneling

  1. Navigate to the data source connection window.

  2. Select your data source and select the Enable SSH tunnel checkbox.

  3. An additional details form will appear - specify your bastion host and port number.

Usually this is an IP and an SSH port (22) of the server that holds the database.

  1. Copy the SSH public key. UI Bakery will try to connect to your bastion host with the specific private key and the uibakery username that you've added before.

  2. Click Connect Datasource.

Last updated