So while browsing reddit, I came across this neat package, shellinabox.  Simply put, it runs as a process on your ‘box’ and fronts it with a javascript terminal interface.  So as long as you have a halfway modern machine with javascript support you too can just connect to a machine and run CLI based stuff.

BBS via telnet

BBS via telnet

So as a test I setup a game of tetris, and a telnet session to my BBS.

There isn’t much to ‘setup’ in the way of shellinabox, because it’s all command line driven.

/shellinabox-2.14/shellinaboxd -t -s /:LOGIN -s “/bbs:nobody:nogroup:/:/usr/bin/telnet localhost” -s /tetris:nobody:nogroup:/:/usr/games/tetris-bsd –css /shellinabox-2.14/shellinabox/white-on-black.css -b

So this will create a new web server that by default listens on TCP port 4200 which in turn uses the virtual directories / for a login, /bbs which launches telent, and /tetris which starts the BSD tetris for terminals game.  Now as many of you are aware, not all people with internet connections have the luxury of having all outbound TCP/IP ports. Even the most excellent flashterm still establishes a TCP session.  That is what makes this different is that all the traffic is done via HTTP, which means it can be proxied.  Now the real trick is having a web server do the proxing for you, so that all the user has to do is hit a special URL, and the server will proxy the request to shellinabox’s web server.

Enter Apache2’s reverse proxy!

So on my BBS’es apache config, I add in the following lines:

ProxyPass /tetris http://localhost:4200/tetris
ProxyPassReverse /tetris http://localhost:4200/tetris
ProxyPass /bbs http://localhost:4200/bbs
ProxyPassReverse /bbs http://localhost:4200/bbs

I’m not sure exactly of the specific modules to enable, but hammering away this got it to work:

a2enmod proxy
a2enmod mod_proxy
a2enmod rewrite
a2enmod mod_proxy
a2enmod proxy_http
a2enmod proxy_module
a2enmod headers
a2enmod deflate

Under my virtual server’s ‘root’ directory.  So now when you access Apache will proxy your request into the shellinabox http server, and you’ll get…



So now only using HTTP you can play tetris!

So where to go from here?  I was thinking some kind of SIMH CP/M on demand thing.  There is a command line Wyse 60 emulator, so maybe that’d be fun.  I may even bring back something I had ages ago, access into a bunch of legacy systems.  This is a great ‘solution’ to enable multiplexing without having to use another software MUX.


5 thoughts on “shellinabox

Leave a Reply