From ArchWiki
Revision as of 13:06, 29 January 2014 by Snis (talk | contribs) (Trying to adapt to Help:Style)
Jump to: navigation, search

From 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 enables users to access SSH servers over the web. alternatives exist, such as Guacamole. One of Gate One's distinguishing features is the ability to resume sessions from other browsers or to replay sessions.

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


Gate One is available in the AUR via gateone-gitAUR.


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


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

Following installation run

# systemctl start gateone

To start Gate One and to generate a default configuration with self generated ssl certificates.

Stop the service and change the default configuration to your needs.

# systemctl stop gateone

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 the options.

Main settings

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

cd /etc/gateone/conf.d
sudo vi 10server.conf
    // "gateone" server-wide settings fall under "*"
    "*": {
        "gateone": { // These settings apply to all of Gate One
            "address": "",
            "ca_certs": null,
            "cache_dir": "/tmp/gateone_cache",
            "certificate": "/etc/gateone/ssl/certificate.pem",
            "combine_css": "",
            "combine_css_container": "gateone",
            "combine_js": "",
            "cookie_secret": "ZTRiOGUzNjM5ZmNjNDJjODllNDRmODk3Y2RjZTVlNTc4M",
            "debug": false,
            "disable_ssl": false,
            "embedded": false,
            "enable_unix_socket": false,
            "gid": "0",
            "https_redirect": false,
            "js_init": "",
            "keyfile": "/etc/gateone/ssl/keyfile.pem",
            "locale": "en_US",
            "log_file_max_size": 100000000,
            "log_file_num_backups": 10,
            "log_file_prefix": "/var/log/gateone/gateone.log",
            "log_to_stderr": null,
            "logging": "info",
            "origins": ["localhost", "", ""],
            "pid_file": "/var/run/",
            "port": 443,
            "session_dir": "/tmp/gateone",
            "session_timeout": "5d",
            "syslog_facility": "daemon",
            "syslog_host": null,
            "uid": "0",
            "unix_socket_path": "/tmp/gateone.sock",
            "url_prefix": "/",
            "user_dir": "/var/lib/gateone/users",
            "user_logs_max_age": "30d"

"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
// This is Gate One's authentication settings file.
    // "gateone" server-wide settings fall under "*"
    "*": {
        "gateone": { // These settings apply to all of Gate One
            "api_timestamp_window": "30s",
            "auth": "none",
            "pam_realm": "hostname",
            "pam_service": "login",
            "ssl_auth": "none",
            "sso_keytab": null,
            "sso_realm": null,
            "sso_service": "HTTP"

"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. For example using it to control what are accessible to Google authenticated users. For more information look here:

# cd /etc/gateone/conf.d
# 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
# 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/

Systemd integration

Gate One package comes with a systemd service file: gateone.service.