From ArchWiki
Revision as of 12:27, 29 January 2014 by Snis (talk | contribs) (Created an howto on Gate One)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Gate One - Web Terminal Emulator and SSH Client Gate One™ is a web-based Terminal Emulator and SSH client that brings the power of the command line to the web. It requires no browser plugins and is built on top of a powerful plugin system that allows every aspect of its appearance and functionality to be customized.

Gate One Website

This guide only covers Gate One setup behind nginx reverse proxy.


Gate One is written in Python and use Tornado as a web framework. Gate One uses WebSockets for communication.


Gate One requires Python 2.6+ or 3.2+, however the AUR build depends on python2. More information can be found at

Gate One is written in Python.
Back port of concurrent.futures in Python3, provides interface for asynchronously executing callables.
Easily download, build, install and upgrade Python packages.
Tornado is a Python web framework, ideal for long polling WebSockets.

Optional Prerequisites

If you want to be able to upgrade (restart) Gate One without losing user's connected sessions you have to have dtach installed. This option is enabled by default in the configuration.

emulates the detach feature of screen

Installing Packages


First install the package available from the AUR

yaourt -S gateone-git

Optional: install dtach:

sudo pacman -S dtach

Managing the gateone daemon

You can start gateone with the following command:

# systemctl start gateone

You can enable gateone at startup with the following command:

# systemctl enable gateone 
Warning: By default gateone allows anonymous users to access the service. Please make sure to change the settings.


Let’s edit the configuration to suite your needs. There are three configuration files by default. located under /etc/gateone/conf.d/

All options are described at:

Keep in mind that these options are split up in three configuration files. I will go through only some of them.

Main settings

The main server settings are found in 10server.conf.

cd /etc/gateone/conf.d
sudo vi 10server.conf

"address": "" This tells Gate One to listen on all addresses. "address": "localhost;::1;" Gate One will listen on localhost (IPv4 and IPv6) and on

"disable_ssl": false or true, if you are handling SSL offloading somewhere else.

"origins": ["localhost", "", "serverhostname", "", "", Add all URL's that will be used when connecting to Gate One. Failed attempts will be logged, look for "unknown origins" with systemctl status gateone

"port": 443 What TCP port Gate One will listen on.

"url_prefix": "/" Specifies the URL path, if set to "/gateone/" the address will be

Authentication settings

The authentication settings are found in 20authentication.conf.

cd /etc/gateone/conf.d
sudo vi 20authentication.conf

"auth": "none" Can be "none", "pam", google", "kerberos" or "api".


None is no authentication and allows anonymous access. Sessions will be tied to browser cookie.


PAM authentication can be used to authenticate with local users, but PAM can do much more. For example, you can authenticate against htpasswd files. Requires pam_pwdfileAUR. Gate One uses Crypt encryption so use switch -d. "auth": "pam" "pam_service": "gateonepwd":

htpasswd -c -d /etc/gateone/users.passwd user1
vi /etc/pam.d/gateonepwd
# Login using a htpasswd file
@include common-sessionauth    
required          pwdfile /etc/gateone/users.passwd


Google Authentication uses Google to authenticate (Gmail or Google+).

All authenticated modes enable you to resume your sessions on a different browser.

Terminal settings

Here you can add terminals and options for them. I'm using it to control what are accessible to my Google authenticated user. For more information look here:

cd /etc/gateone/conf.d
sudo vi 20authentication.conf

Example to only allow and to access the SSH application:

 // This is Gate One's Terminal application settings file.
    // "*" means "apply to all users" or "default"
    "*": {
       "terminal": { // These settings apply to the "terminal" application
            "commands": {
                "SSH": {"command": "/usr/lib/python2.7/site-packages/gateone/applications/terminal/plugins/ssh/scripts/ -S '%SESSION_DIR%/%SESSION%/%SHORT_SOCKET%' --sshfp -a '-oUserKnownHostsFile=\\\"%USERDIR%/%USER%/
.ssh/known_hosts\\\"'", "description": "Connect to hosts via SSH."}
            "default_command": "SSH",
            "dtach": true,
            "environment_vars": {"TERM": "xterm-256color"},
            "session_logging": true,
            "syslog_session_logging": false,
            "allow": false
    // "*" means "apply to all users" or "default"
    "user.upn=(|": {
       "terminal": { // These settings apply to the "terminal" application
            "commands": {
                "SSH": {"command": "/usr/lib/python2.7/site-packages/gateone/applications/terminal/plugins/ssh/scripts/ -S '%SESSION_DIR%/%SESSION%/%SHORT_SOCKET%' --sshfp -a '-oUserKnownHostsFile=\\\"%USERDIR%/%USER%/
.ssh/known_hosts\\\"'", "description": "Connect to hosts via SSH."}
            "default_command": "SSH",
            "dtach": true,
            "environment_vars": {"TERM": "xterm-256color"},
            "session_logging": true,
            "syslog_session_logging": false,
            "allow": true


Using a reverse proxy to handle SSL and more than just Gate One on the same IP-address:443 listener is possible, but please note that Gate One uses WebSocket and that the reverse proxy must be able to handle WebSockets.


I use nginx so here is a quick walkthrough. I like this method because it is quick and easy. Make sure that the port that the Gate One server is running on is blocked from outside by a proxy (like iptables) or if you are running Gate One and nginx on the same server make sure it only listens on localhost. Please see Nginx for more information about installing.

Edit your nginx configuration file similar to this:

Note: Listed below are only the server part of the nginx configuration
sudo vi /etc/nginx/nginx.conf

# HTTPS server
server {
	listen       [::]:443;
	listen       443;
	server_name  mysslhost;

	ssl                  on;
	ssl_certificate      server.crt;
	ssl_certificate_key  server.key;
	ssl_session_timeout  5m;
	ssl_protocols  SSLv2 SSLv3 TLSv1;
	ssl_ciphers  HIGH:!aNULL:!MD5;
	ssl_prefer_server_ciphers   on;

    location /gateone/ {
		#auth_basic "Restricted";					#One extra layer of authentication
		#auth_basic_user_file /etc/nginx/.htpasswd;
		proxy_pass_header Server;
		proxy_set_header Host $http_host;
		proxy_redirect off;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header X-Scheme $scheme;
		proxy_pass http://localhost:8888;
		proxy_http_version 1.1;
		proxy_set_header Upgrade $http_upgrade;
		proxy_set_header Connection "upgrade";
	location /other {
		rewrite /other/(.*) /$1 break;
		include /etc/nginx/proxy.conf;
Note: The above configuration requires the following Gate One configuration
	"disable_ssl": true,
	"https_redirect": false,
	"port": 8888,
	"url_prefix": "/gateone/"

Gate One now lives under the URL: https://your-nginx-server:443/gateone/