From 5c8737ba2975db54dc497ba740edb7d28ee3f062 Mon Sep 17 00:00:00 2001 From: Clay Date: Thu, 3 Dec 2026 11:20:47 -0500 Subject: [PATCH] README: public deployment and run instructions --- README.md | 109 +++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 87 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 60e515e..a79801c 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,10 @@ # Web OSCAR Chat -A small browser chat client for [Open OSCAR Server](https://github.com/mk6i/open-oscar-server). It’s a Node/Express app with a plain HTML/CSS/JS frontend for basic AIM/ICQ-style messaging. +A small browser chat client for [Open OSCAR Server](https://github.com/mk6i/open-oscar-server). It provides a simple web UI for basic AIM/ICQ-style messaging using a Node.js/Express backend. -## Supported +> **Status:** early project. Review configuration and security before exposing it to the public. + +## Features - Sign in with an existing OSCAR screen name/password - 1:1 instant messages @@ -15,48 +17,87 @@ A small browser chat client for [Open OSCAR Server](https://github.com/mk6i/open ## Not supported -OSCAR has many features this project does not implement yet, including: offline messages, file transfer, buddy icons, away/profile/status messages, typing notifications, blocking/warning management, chat moderation/admin, account registration, encryption, and full user directory/search. +This is not a full OSCAR client. Not yet supported: offline messages, file transfer, buddy icons, away/profile/status messages, typing notifications, blocking/warning management, chat moderation/admin, account registration, encryption, and full user directory/search. ## Requirements -- Node.js 20.19+ -- Running Open OSCAR Server with Web API and/or TOC access +- Node.js **20.19+** +- npm +- A running [Open OSCAR Server](https://github.com/mk6i/open-oscar-server) +- Access to the server’s Web API and/or TOC listener -## Setup +## Quick start ```bash +git clone https://git.claytonia.net/Clarth/oscar-web.git +cd oscar-web npm install cp .env.example .env # edit .env npm run dev -# or: npm start ``` Open `http://localhost:3000` (or your configured `PORT`). +For a normal run: + +```bash +npm start +``` + ## Configuration +Copy `.env.example` to `.env` and set values for your environment. + | Variable | Description | Default | |---|---|---| -| `WEBAPI_HOST` | Web API host | `127.0.0.1` | -| `WEBAPI_PORT` | Web API port | `8081` | +| `WEBAPI_HOST` | Open OSCAR Web API host | `127.0.0.1` | +| `WEBAPI_PORT` | Open OSCAR Web API port | `8081` | | `TOC_HOST` | TOC host for IM/chat/invites | unset | | `TOC_PORT` | TOC port | `9898` | | `MANAGEMENT_HOST` | Management API host (optional user search) | `127.0.0.1` | | `MANAGEMENT_PORT` | Management API port | `8080` | -| `PORT` | App listen port | `3000` | -| `LISTEN_HOST` | App bind host | `127.0.0.1` | -| `TRUST_PROXY` | Proxy hops in front of app | `1` | -| `COOKIE_SECURE` | `auto`/`true`/`false` session cookie | `auto` | -| `SESSION_MAX_AGE_HOURS` | Session lifetime | `24` | -| `DEV_ID` | Optional Web API devId/key | unset | -| `SESSION_SECRET` | Cookie signing secret | required | +| `PORT` | Port this app listens on | `3000` | +| `LISTEN_HOST` | Address this app binds to | `127.0.0.1` | +| `TRUST_PROXY` | Number of proxy hops in front of app | `1` | +| `COOKIE_SECURE` | Session cookie secure mode: `auto`, `true`, `false` | `auto` | +| `SESSION_MAX_AGE_HOURS` | Session lifetime in hours | `24` | +| `DEV_ID` | Optional Web API devId/key if your server requires it | unset | +| `SESSION_SECRET` | Long random secret for cookie signing | required | -## Public deployment (nginx) +## Deployment (public / reverse proxy) -- Bind app to `127.0.0.1` and expose only through HTTPS nginx. -- Set `TRUST_PROXY=1`, `COOKIE_SECURE=true`, strong `SESSION_SECRET`, and `0600` permissions on `.env`. -- Nginx should redirect HTTP->HTTPS, set HSTS, forward `X-Forwarded-*`, and disable buffering for SSE: +This app is intended to run behind HTTPS nginx. + +### 1. App environment + +Set these for public deployment: + +```env +LISTEN_HOST=127.0.0.1 +PORT=3000 +TRUST_PROXY=1 +COOKIE_SECURE=true +SESSION_SECRET=replace-with-a-long-random-secret +``` + +Protect `.env`: + +```bash +chmod 600 .env +``` + +Run as a dedicated non-root user. + +### 2. Nginx + +- Redirect HTTP to HTTPS +- Use a valid TLS certificate +- Set HSTS +- Forward `X-Forwarded-*` headers +- Disable buffering for SSE (`/api/events`) + +Example location for SSE: ```nginx location /api/events { @@ -72,5 +113,29 @@ location /api/events { } ``` -- App includes Helmet headers/CSP, JSON-only mutating API checks, Origin checks, and rate limits. Still review before public use. -- Sessions are in-memory (single process only; restart logs users out). For heavier public use, move to a persistent session store. \ No newline at end of file +For all other routes, proxy normally to `http://127.0.0.1:3000`. + +### 3. Firewall / process + +- Do **not** expose port `3000` publicly; bind to `127.0.0.1`. +- Run with a process manager (e.g. systemd) and restart on failure. +- Sessions are stored in memory: restart logs users out and the app should run as a single process. + +## Security notes + +The app includes basic hardening (Helmet/CSP, rate limits, JSON-only mutating API checks, Origin checks, input limits, fetch timeouts), but you should still: + +- Use HTTPS only +- Keep Node/npm dependencies updated (`npm audit`) +- Monitor logs and auth failures +- Review before exposing to untrusted users + +## Development + +- Backend: Node.js, Express, ES modules +- Frontend: plain HTML/CSS/JavaScript (no build step) +- Real-time events: SSE (`/api/events`) + +## License + +Add a license file before distributing publicly. \ No newline at end of file