GateOne, more than a web-based SSH

I’ve been searching for a Web-based SSH for quite a while, and I recently read about GateOne on the dedicated Wikipedia page. Not only GateOne does what I was searching for, but it also comes up with nice features like interpreting images on-the-fly.

The remote server on which I intended to run this software is, of course, a NetBSD 6.0 domU, and as I anticipated, some work was needed in order to make GateOne work on this platform.

The software needs the following dependencies:

  • textproc/py-html5lib
  • devel/py-readline
  • graphics/py-imaging
  • misc/dtach
  • www/py-tornado
    The latter was not available in pkgsrc, so I created the package and commited it to pkgsrc-current. The package is straightforward:

    $NetBSD: Makefile,v 1.1 2013/01/25 22:33:47 imil Exp $

    #

DISTNAME= tornado-2.4.1
PKGNAME= ${PYPKGPREFIX}-${DISTNAME}
CATEGORIES= www
MASTER_SITES= https://github.com/downloads/facebook/tornado/

MAINTAINER= imil@NetBSD.org
HOMEPAGE= http://www.tornadoweb.org/
COMMENT= Fast and non-blocking web framework
LICENSE= apache-2.0

FETCH_USING= curl

USE_PKGLOCALEDIR= yes

REPLACE_PYTHON+= setup.py
REPLACE_PYTHON+= tornado/.py
REPLACE_PYTHON+= tornado/platform/
.py
REPLACE_PYTHON+= tornado/test/*.py

.include “../../lang/python/egg.mk”
.include “../../lang/python/application.mk”
.include “../../mk/bsd.pkg.mk”

Back to GateOne, while this software is really handy, it has not been made very “packageable”, meaning that it expects everything to be located on the same directory, i.e. ${PREFIX}/gateone. Not being brave enough to dig into the implications of such choice within the code, I have not made a public package of it, instead I created a local-package that suits my needs. Why not simply use the bundled setup.py? Because every .py file begins with:

#!/usr/bin/env python

this had to be changed to pkgsrc’s default python PATH, and using _pkgsrc’s REPLACE_PYTHON_ command was easier than a find / sed / whatever oneliner.

Here’s the local package I created in pkgsrc/localpkg, which is owned by my user for convenience:

$NetBSD$

#

DISTNAME= gateone-1.1
CATEGORIES= shells
MASTER_SITES= https://github.com/downloads/liftoff/GateOne/

MAINTAINER= imil@NetBSD.org
HOMEPAGE= https://github.com/liftoff/GateOne/archive/
COMMENT= Web Terminal Emulator and SSH Client

#LICENSE= TODO

FETCH_USING= curl

WRKSRC= ${WRKDIR}/GateOne
USE_PKGLOCALEDIR= yes
USE_LANGUAGES= # none

REPLACE_PYTHON+= .py /.py //.py ///.py

change this to the base directory you want gateone to land on !

BASEDIR= /home/imil/www

SUBST_CLASSES+= path
SUBST_STAGE.path= pre-configure
SUBST_FILES.path+= setup.py
SUBST_SED.path= -e “s,/opt,${PREFIX},g”

PYSETUPINSTALLARGS= –prefix=${PREFIX}

DEPENDS+= ${PYPKGPREFIX}-html5lib>=0.90:../../textproc/py-html5lib
DEPENDS+= ${PYPKGPREFIX}-tornado>=2.4.1:../../www/py-tornado
DEPENDS+= dtach>=0.8:../../misc/dtach

.include “../../devel/py-readline/buildlink3.mk”
.include “../../graphics/py-imaging/buildlink3.mk”
.include “../../lang/python/distutils.mk”
.include “../../lang/python/application.mk”
.include “../../mk/bsd.pkg.mk”

At some point I may write a real package out of this, but I wanted to play with that shiny client quickly :)

Once installed, you’ll end up with a ${BASEDIR}/gateone directory, which you may want to chown -R youruser for convenience.

I rapidly got bitten by that reported bug https://github.com/liftoff/GateOne/issues/161, which actually was a bug in the software itself. Simply modify the file /usr/pkg/gateone/plugins/ssh/scripts/ssh_connect.py, line 402, from:


os.execvpe(script_path, [], env)

to


os.execvpe(script_path, [‘’], env)

At this point, GateOne should run normally. If you are, as I do, to run the frontend with a non-privileged user, take care to change some values in the server.conf file:


port = 1443
pid_file = “./gateone.pid”
unix_socket_path = “./gateone.sock”

Also, as I use a CAcert-enabled reverse proxy, I had no use of the SSL, so I set disable_ssl to True. Do not forget to update the origins variable accordingly.

There we go! I now have a shiny HTML5 Terminal Emulator, ready to accept my SSH connections wherever I am… and here’s the mandatory screenshot :)

GateOne 1.1