From 2bb716531832896f5ff3196c07241502c409f11b Mon Sep 17 00:00:00 2001 From: aspezowka Date: Thu, 1 Oct 2020 09:57:27 -0600 Subject: [PATCH 1/8] Added info about server routing, i.e. /static/ vs / --- docs/servers/web-server.md | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/docs/servers/web-server.md b/docs/servers/web-server.md index fd9ac1b9..5ad9321f 100644 --- a/docs/servers/web-server.md +++ b/docs/servers/web-server.md @@ -5,18 +5,19 @@ title: Web Server ENiGMA½ comes with a built in *content server* for supporting both HTTP and HTTPS. Currently the [File Bases](../modding/file-base-web-download-manager.md) registers routes for file downloads, password reset email links are handled via the server, and static files can also be served for your BBS. Other features will likely come in the future or you can easily write your own! # Configuration + By default the web server is not enabled. To enable it, you will need to at a minimum configure two keys in the `contentServers.web` section of `config.hjson`: ```hjson contentServers: { - web: { - domain: bbs.yourdomain.com + web: { + domain: bbs.yourdomain.com - http: { - enabled: true - port: 8080 - } - } + http: { + enabled: true + port: 8080 + } + } } ``` @@ -28,6 +29,7 @@ The following is a table of all configuration keys available under `contentServe | `overrideUrlPrefix` | :-1: | Instructs the system to be explicit when handing out URLs. Useful if your server is behind a transparent proxy. | ### HTTP Configuration + Entries available under `contentServers.web.http`: | Key | Required | Description | @@ -37,6 +39,7 @@ Entries available under `contentServers.web.http`: | `address` | :-1: | Sets an explicit bind address. | ### HTTPS Configuration + Entries available under `contentServers.web.https`: | Key | Required | Description | @@ -48,10 +51,19 @@ Entries available under `contentServers.web.https`: | `keyPem` | :+1: | Overrides the default certificate key path of `/config/https_cert_key.pem`. Key must be in PEM format. See **Certificates** below. | #### Certificates + If you don't have a TLS certificate for your domain, a good source for a certificate can be [LetsEncrypt](https://letsencrypt.org/) who supplies free and trusted TLS certificates. ## Static Routes + Static files live relative to the `contentServers.web.staticRoot` path which defaults to `enigma-bbs/www`. +`index.html, favicon.ico`, and any error pages like `404.html` are accessible from the route path. Other static assets hosted by the web server must be referenced from `/static/`, for example: + +```html + Example Link +``` + ## Custom Error Pages + Customized error pages can be created for [HTTP error codes](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#4xx_Client_Error) by providing a `.html` file in the *static routes* area. For example: `404.html`. From 462593232c072bcf4c5eff6c3dc0125ff988e1cd Mon Sep 17 00:00:00 2001 From: aspezowka Date: Thu, 1 Oct 2020 10:05:39 -0600 Subject: [PATCH 2/8] Added some sparse documentation regarding home networking --- docs/installation/network.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/installation/network.md b/docs/installation/network.md index def09ad2..92e36f44 100644 --- a/docs/installation/network.md +++ b/docs/installation/network.md @@ -2,5 +2,12 @@ layout: page title: Network Setup --- -:zap: This page is to describe general information on how to set your router to forward traffic to ENiGMA. It -needs fleshing out, please submit a PR if you'd like to help! \ No newline at end of file +## Hosting an ENIGMA instance from your Home Network + +If you are hosting your ENGIMA instance from inside your local network, you'll need to open your chosen ports on your router, so people outside your local area network can access the BBS. + +Each router has a different way of doing this, but this [comprehensive resource](https://portforward.com/) explains how to port forward on most common brand routers. + +Secondly, it is likely that your public facing server IP is a [Dynamic Address](https://support.opendns.com/hc/en-us/articles/227987827-What-is-a-Dynamic-IP-Address-) automatically provisoned to you by your ISP. You can contact your ISP and request a static IP, but in some areas this isn't available to consumers, only businesses. + +Using a tool like [Duck DNS](https://www.duckdns.org/) will give you a free subdomain that automatically adjusts its records whenever your IP Address changes. \ No newline at end of file From ded575cf57ea448e5814cb1ab786f7d13ac02036 Mon Sep 17 00:00:00 2001 From: aspezowka Date: Thu, 1 Oct 2020 10:24:21 -0600 Subject: [PATCH 3/8] Added note about Certbots Privilege problems --- docs/servers/web-server.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/servers/web-server.md b/docs/servers/web-server.md index 5ad9321f..216efb6c 100644 --- a/docs/servers/web-server.md +++ b/docs/servers/web-server.md @@ -54,6 +54,8 @@ Entries available under `contentServers.web.https`: If you don't have a TLS certificate for your domain, a good source for a certificate can be [LetsEncrypt](https://letsencrypt.org/) who supplies free and trusted TLS certificates. +Keep in mind that the SSL certificate provided by Let's Encrypt's Certbot is by default stored in a privileged location; if your ENIGMA instance is not running as root (which it should not be!), you'll need to copy the SSL certificate somewhere else in order for ENIGMA to use it. + ## Static Routes Static files live relative to the `contentServers.web.staticRoot` path which defaults to `enigma-bbs/www`. From ea93199a10897cff38f12b0b6ef379bbb329c228 Mon Sep 17 00:00:00 2001 From: aspezowka Date: Thu, 1 Oct 2020 12:36:27 -0600 Subject: [PATCH 4/8] Added an additional digit to the hour slot, fixing minor spacing issue --- art/themes/luciano_blocktronics/theme.hjson | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/art/themes/luciano_blocktronics/theme.hjson b/art/themes/luciano_blocktronics/theme.hjson index f5dbbe30..407e8a1b 100644 --- a/art/themes/luciano_blocktronics/theme.hjson +++ b/art/themes/luciano_blocktronics/theme.hjson @@ -17,7 +17,7 @@ passwordChar: * dateTimeFormat: { - short: MMM Do h:mm a + short: MMM Do hh:mm a } } @@ -91,7 +91,7 @@ fullLoginSequenceOnelinerz: { config: { - dateTimeFormat: ddd h:mma + dateTimeFormat: ddd hh:mma } 0: { mci: { @@ -118,7 +118,7 @@ mainMenuUserAchievementsEarned: { config: { - dateTimeFormat: MMM Do h:mma + dateTimeFormat: MMM Do hh:mma achievementsInfoFormat10: "|00|07\"|11{title}|07\"" achievementsInfoFormat11: "|00|03{text}" } @@ -170,7 +170,7 @@ mainMenuLastCallers: { config: { - dateTimeFormat: MMM Do h:mma + dateTimeFormat: MMM Do hh:mma } mci: { VM1: { @@ -183,7 +183,7 @@ mainMenuUserList: { config: { - dateTimeFormat: MMM Do h:mma + dateTimeFormat: MMM Do hh:mma } mci: { VM1: { @@ -222,7 +222,7 @@ mainMenuOnelinerz: { config: { - dateTimeFormat: ddd h:mma + dateTimeFormat: ddd hh:mma } 0: { mci: { @@ -609,7 +609,7 @@ fullLoginSequenceLastCallers: { config: { - dateTimeFormat: MMM Do h:mma + dateTimeFormat: MMM Do hh:mma } mci: { VM1: { From 37653545f3822d13a3ac78db2c6f055f9dd65dee Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Thu, 15 Oct 2020 20:54:35 -0600 Subject: [PATCH 5/8] Cleanp + note --- core/ftn_util.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/ftn_util.js b/core/ftn_util.js index 9a171a52..a788f2c7 100644 --- a/core/ftn_util.js +++ b/core/ftn_util.js @@ -56,7 +56,7 @@ function stringToNullPaddedBuffer(s, bufLen) { // // Convert a FTN style DateTime string to a Date object // -// :TODO: Name the next couple methods better - for FTN *packets* +// :TODO: Name the next couple methods better - for FTN *packets* e.g. parsePacketDateTime() function getDateFromFtnDateTime(dateTime) { // // Examples seen in the wild (Working): @@ -66,7 +66,6 @@ function getDateFromFtnDateTime(dateTime) { // // :TODO: Use moment.js here return moment(Date.parse(dateTime)); // Date.parse() allows funky formats -// return (new Date(Date.parse(dateTime))).toISOString(); } function getDateTimeString(m) { From a2f1e28894670159fb6d51a462709d2aa9e920ce Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Thu, 15 Oct 2020 20:54:55 -0600 Subject: [PATCH 6/8] Bug fix: If user disconnects, don't leave a haning door PID --- core/door.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/core/door.js b/core/door.js index c8dd3796..e5131684 100644 --- a/core/door.js +++ b/core/door.js @@ -3,12 +3,14 @@ const stringFormat = require('./string_format.js'); const { Errors } = require('./enig_error.js'); +const Events = require('./events'); // deps const pty = require('node-pty'); const decode = require('iconv-lite').decode; const createServer = require('net').createServer; const paths = require('path'); +const _ = require('lodash'); module.exports = class Door { constructor(client) { @@ -87,6 +89,19 @@ module.exports = class Door { return cb(e); } + // + // PID is launched. Make sure it's killed off if the user disconnects. + // + Events.once(Events.getSystemEvents().ClientDisconnected, evt => { + if (this.doorPty && this.client.session.uniqueId === _.get(evt, 'client.session.uniqueId')) { + this.client.log.info( + { pid : this.doorPty.pid }, + 'User has disconnected; Killing door process.' + ); + this.doorPty.kill(); + } + }); + this.client.log.debug( { processId : this.doorPty.pid }, 'External door process spawned' ); @@ -96,7 +111,7 @@ module.exports = class Door { this.client.term.output.pipe(this.doorPty); - this.doorPty.on('data', this.doorDataHandler.bind(this)); + this.doorPty.onData(this.doorDataHandler.bind(this)); this.doorPty.once('close', () => { return this.restoreIo(this.doorPty); From dd27a000a436b614aab3f4e61b397bbb2168adaf Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Thu, 15 Oct 2020 20:56:31 -0600 Subject: [PATCH 7/8] Fix deprected on('data') -> onData for node-pty --- core/archive_util.js | 2 +- core/file_transfer.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/archive_util.js b/core/archive_util.js index 86bb7ce7..ab4e1dd9 100644 --- a/core/archive_util.js +++ b/core/archive_util.js @@ -319,7 +319,7 @@ module.exports = class ArchiveUtil { } let output = ''; - proc.on('data', data => { + proc.onData(data => { // :TODO: hack for: execvp(3) failed.: No such file or directory output += data; diff --git a/core/file_transfer.js b/core/file_transfer.js index 68daf2db..44ebdc11 100644 --- a/core/file_transfer.js +++ b/core/file_transfer.js @@ -426,7 +426,7 @@ exports.getModule = class TransferFileModule extends MenuModule { } }); - externalProc.on('data', data => { + externalProc.onData(data => { updateActivity(); // needed for things like sz/rz From bce55717ddd5ce00d24dfdfcc358c27321d24dba Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Wed, 4 Nov 2020 17:42:01 -0700 Subject: [PATCH 8/8] Hopefully fix rendering on doc site --- docs/art/themes.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/art/themes.md b/docs/art/themes.md index 4da7c310..9bf1419a 100644 --- a/docs/art/themes.md +++ b/docs/art/themes.md @@ -41,6 +41,8 @@ The `customization` block in is itself broken up into major parts: | `prompts` | Similar to `menus`, this section themes `prompts`. | #### Defaults +Override system defaults. + | Item | Description | |-------------|---------------------------------------------------| | `passwordChar` | Character to display in password fields. Defaults to `*` |