Skip to content

Configuration and Security

Guilherme Cardoso edited this page Sep 13, 2026 · 1 revision

Configuration and Security

The server validates security-sensitive configuration at startup and stops on the first invalid or missing requirement.

Server environment variables

Variable Required Default Purpose
PORT No 3000 HTTP or HTTPS listening port
BIND_HOST No 0.0.0.0 Bind interface; loopback permits HTTP without an opt-out
INGEST_TOKEN Normally None Shared secret checked on /api/ingest/*
ALLOW_UNAUTHENTICATED_INGEST No Off Disables ingest authentication; insecure
TLS_CERT_FILE Pair None PEM certificate or chain
TLS_KEY_FILE Pair None PEM private key
TLS_KEY_PASSPHRASE No None Passphrase for an encrypted key
ALLOW_PLAINTEXT_HTTP No Off Permits HTTP beyond loopback; insecure
SESSION_SECRET No Stored in database Session secret; must be at least 16 characters if set
EXPORT_BASE_URL No http://127.0.0.1:$PORT Base URL used by PDF rendering
TRAFFIC_ENABLED No Enabled Set to 0, false, off, or no to discard traffic

Changing SESSION_SECRET logs out all existing sessions.

Operator account

npm run build
npm run set-password

There is no browser-based setup flow. Re-run the command to reset a forgotten password. To deliberately invalidate all sessions, stop the service first and delete rows from auth_session with a suitable SQLite tool or better-sqlite3.

Ingest authentication

Generate a high-entropy shared secret:

export INGEST_TOKEN="$(openssl rand -hex 24)"

Configure exactly the same value as INGEST_TOKEN on the agent. The agent sends it in the x-ingest-token header and the server compares it timing-safely.

ALLOW_UNAUTHENTICATED_INGEST=1 removes this protection. It is an explicit trusted-LAN-only compatibility mode and prints a warning at every startup.

HTTPS

TLS_CERT_FILE and TLS_KEY_FILE must be supplied together. The server uses one port for either HTTPS or HTTP; it does not run an HTTP redirect listener.

export TLS_CERT_FILE=/etc/msfslogger/cert.pem
export TLS_KEY_FILE=/etc/msfslogger/key.pem
export TLS_KEY_PASSPHRASE='<only-if-the-key-is-encrypted>'
npm start

Certificate files are read once at startup. Restart the service after rotating them.

Self-signed certificate

openssl req -x509 -newkey rsa:2048 -nodes -days 825 \
  -keyout msfslogger-key.pem -out msfslogger-cert.pem \
  -subj "/CN=msfslogger" \
  -addext "subjectAltName=IP:<server-lan-ip>,DNS:<server-hostname>"

Browsers must trust or explicitly accept the certificate. The Windows agent must trust it separately; see Windows Agent.

Plain HTTP

Loopback addresses (127.0.0.1, ::1, or localhost) can use HTTP without an opt-out. To bind plaintext HTTP to a LAN interface, set ALLOW_PLAINTEXT_HTTP=1. The session cookie and ingest token then cross the network unencrypted. Never enable this on an internet-reachable host.

Clone this wiki locally