Skip to content
Daniel M. Hendricks edited this page Jan 14, 2018 · 7 revisions

This document descriptions how to set up Shell in a Box in a Docker container for use with the Terminal Icon extension for Plesk.

We're going to use Nginx to proxy the HTTPS URL for simplicity and to allow Plesk to manage the SSL (TLS) certificate.

  1. Requirements
  2. Add Shell in a Box Docker Container
  3. Create Proxy Link
  4. Block HTTP Access
  5. Install and Configure Terminal Icon Extension

Requirements

This extension requires the Docker extension for Plesk (the free version is fine). If you do not already have it installed, download the extension or install via the Plesk Extensions admin menu.

Add Shell in a Box Docker Container

I chose the sspreitzer/shellinabox image because it is convenient to use with Plesk (necessary options are exposed via environmental variables).

Pull the sspreitzer/shellinabox image and add a container as you normally would in Plesk's Docker interface. When prompted for container settings, configure accordingly:

  • You may set the Exposed Port to any available port, or allow Plesk to assign one. Make note of the port for later.
  • The SIAB_SERVICE service must be set to the fully-qualified domain name of your server (recommended) or its IP address. Example: /:SSH:plesk1.mydomain.com
  • (optional) By default, Shell in a Box has a white background with black test. If you prefer more traditional black background with white test, you can set the SIAB_USERCSS as follows:
Normal:+/etc/shellinabox/options-enabled/00_White-On-Black.css

The rest of the fields may be left as default.

Docker Container Settings

When finished with configuration, click OK and allow the container to be started. You can test if everything is working correctly by visiting the URL of your server with the exposed port from above:

http://<host_name_or_ip>:<exposed_port>

Create Proxy Link

In order to access the Shell in a Box instance through HTTPS, create an Nginx proxy in Plesk.

Important: If you choose not to create a proxy link, you'll need to figure out how to secure the Shell in a Box instance yourself. The URL must be accessed via HTTPS for this extension to work.

Note: Regardless of what URL you choose as the proxy link, make sure that HTTPS is enabled! (either via Let's Encrypt or your own certificate).

  1. Click on the domain that you want to use as the proxy URL.
    • For existing domains, you can create a proxy as a sub-folder (ex: https://mydomain.com/terminal).
    • If you prefer to use a sub-domain, create a new sub domain for the primary domain is Plesk (ex: https://terminal.mydomain.com).
  2. Click the Docker Proxy Rules link.
  3. Click the Add Rule button.
  4. Configure as follows:
    • URL - Enter the sub-folder that you would like to use for the proxy link (ex: https://mydomain.com/terminal), or if you created a sub-domain, leave blank to access from the sub-domain root.
    • Container - Choose the Shell in a Box Docker container created earlier.
    • Port - Make sure that the exposed port that was associated with the container is selected (it should be selected by default as there is only one).
  5. Click OK to add the proxy link.

Docker Proxy

Testing

Make sure that the Docker container is started and test the link you created by visiting it in a browser. Examples:

Sub-folder: https://plesk1.mydomain.com/terminal/
Sub-domain: https://terminal.mydomain.com/

If everything is configured correctly, the Shell in a Box terminal window should appear.

Block HTTP Access

You may wish to block the original non-HTTPS URL. You can do this in your firewall of choice.

For example, in Ubuntu:

ufw deny <exposed_docker_port>
ufw reload

If you are using a different Linux distro/firewall, see the vendor's instructions on how to block ports.

Install and Configure Terminal Icon Extension

  1. Download the latest release of the extension ZIP file.
  2. Upload the extension in Plesk as you normally would.
  3. Go to the extension's settings page.
  4. Add the Shell in a Box URL that you created in the Create Proxy Link section above.
  5. Click OK to save settings.

When you click on a domain in the Plesk control panel, you should now see an icon labeled "Terminal (SSH)".

Terminal (SSH) Link