So your corporate network team has blocked a common desktop from remote access. Or you need to peer into a network for work purposes (of course) while they've sealed off every port to it. Or you feel like shells or REPL consoles need to be multiplayer. Whatever the case is, I'm not responsible for how you choose to use this or whether you get fired for even entertaining the thought of using this. In other words, don't use it for any srs bsns.
All it is, is yet another web console. There are seriously tonnes of these things around. I just made one for the heck of it. Probably the only difference between this and the rest is the use of Docker containers for shell and REPL access. It's by no means a production-ready system. For that, you would need to implement proper authentication system that isn't susceptible to timing attacks, store user credentials in a database instead of a text file, use a distributed in-memory cache for session data, maybe have a better looking front-end, introduce a proper build process, etc etc etc zzz.
- Front-end written with xterm.js and UIkit.
- Server written with ExpressJS and WS.
- Isolated consoles per session provided by Docker containers.
- Uploading of files to containers, with persistence on a per-session basis.
- Session number limiting - block additional clients once a specified maximum number of consoles have been spawned.
Currently stores a single user name and password in plain text (in the credentials
directory). At least it's hashed and the ExpressJS server is configured for HTTPS.
- NodeJS, tested from v10.15.3 onwards
- Docker Desktop, tested with v2.2.0.3 (42716) onwards
- The following images are required for their respective shells/REPLs (configurable)
- Python REPL: python:3.8-alpine
- Java REPL: adoptopenjdk:11.0.6_10-jdk-hotspot-bionic
- Bash Shell: ubuntu:latest
- NodeJS REPL: node:lts-alpine
git clone
npm install
- Pull the Docker images listed under
Requirements
- Generate a user (see below)
- Generate self-signed certificates for the server (see below)
git clone
- Generate a user (see below)
- Generate self-signed certificates for the server (see below)
- Zip up the directory, excluding
node_modules
andbuild
, and include.ebextensions
and.npmrc
- Upload the archive to an Elastic Beanstalk
- Run
npm start
and navigate tohttps://localhost:8081
- Run
node generate_credentials.js <username> <password>
This replaces the current user.
Generating Self-Signed Certificates for ExpressJS (if you're too cheap to get proper SSL certificates from LetsEncrypt)
- Run
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365
- Copy the
key.pem
andcert.pem
files into thecredentials
folder - You may need to change the passphrase in
index.js
too
- Pull in the desired Docker image.
- Add an entry in the
shells
object inindex.js
- Restart the server
Eh.