chore: sync up config defaults to be compatible with node 6.9.1

This commit is contained in:
Bill Church 2024-11-27 14:40:42 +00:00
parent 3aeedb2ec8
commit 2932d049af
No known key found for this signature in database
3 changed files with 62 additions and 67 deletions

View file

@ -20,6 +20,7 @@ rules:
object-shorthand: off object-shorthand: off
class-methods-use-this: off class-methods-use-this: off
semi: [2, never] semi: [2, never]
strict: off
overrides: overrides:
- files: - files:

View file

@ -33,13 +33,6 @@ const defaultConfig = {
keepaliveCountMax: 10, keepaliveCountMax: 10,
alwaysSendKeyboardInteractivePrompts: false, alwaysSendKeyboardInteractivePrompts: false,
algorithms: { algorithms: {
kex: [
"ecdh-sha2-nistp256",
"ecdh-sha2-nistp384",
"ecdh-sha2-nistp521",
"diffie-hellman-group-exchange-sha256",
"diffie-hellman-group14-sha1"
],
cipher: [ cipher: [
"aes128-ctr", "aes128-ctr",
"aes192-ctr", "aes192-ctr",
@ -50,19 +43,21 @@ const defaultConfig = {
"aes256-gcm@openssh.com", "aes256-gcm@openssh.com",
"aes256-cbc" "aes256-cbc"
], ],
compress: ["none", "zlib@openssh.com", "zlib"],
hmac: ["hmac-sha2-256", "hmac-sha2-512", "hmac-sha1"], hmac: ["hmac-sha2-256", "hmac-sha2-512", "hmac-sha1"],
kex: [
"ecdh-sha2-nistp256",
"ecdh-sha2-nistp384",
"ecdh-sha2-nistp521",
"diffie-hellman-group-exchange-sha256",
"diffie-hellman-group14-sha1"
],
serverHostKey: [ serverHostKey: [
"ssh-ed25519",
"rsa-sha2-512",
"rsa-sha2-256",
"ecdsa-sha2-nistp256", "ecdsa-sha2-nistp256",
"ecdsa-sha2-nistp384", "ecdsa-sha2-nistp384",
"ecdsa-sha2-nistp521", "ecdsa-sha2-nistp521",
"rsa-sha2-512",
"rsa-sha2-256",
"ssh-rsa" "ssh-rsa"
], ]
compress: ["none", "zlib@openssh.com", "zlib"]
} }
}, },
header: { header: {
@ -119,41 +114,46 @@ function loadConfig() {
} }
/** /**
* Configuration for the application. * Loads and validates the WebSSH2 configuration.
* Merges the default configuration with user-provided config.json if it exists.
* Falls back to default configuration if config.json is missing or invalid.
* Overrides listen.port with PORT environment variable if provided.
* *
* @returns {Object} config * @returns {Object} Configuration object with the following structure:
* @property {Object} listen - Configuration for listening IP and port. * @returns {Object} .listen - Server listening settings
* @property {string} listen.ip - The IP address to listen on. * @returns {string} .listen.ip - IP address to listen on (default: "0.0.0.0")
* @property {number} listen.port - The port number to listen on. * @returns {number} .listen.port - Port number to listen on
* @property {Object} http - Configuration for HTTP settings. * @returns {Object} .http - HTTP server settings
* @property {string[]} http.origins - The allowed origins for HTTP requests. * @returns {string[]} .http.origins - Allowed CORS origins (default: ["*:*"])
* @property {Object} user - Configuration for user settings. * @returns {Object} .user - Default user credentials
* @property {string|null} user.name - The name of the user. * @returns {string|null} .user.name - Default username
* @property {string|null} user.password - The password of the user. * @returns {string|null} .user.password - Default password
* @property {Object} ssh - Configuration for SSH settings. * @returns {Object} .ssh - SSH connection settings
* @property {string|null} ssh.host - The SSH host. * @returns {string|null} .ssh.host - SSH server hostname
* @property {number} ssh.port - The SSH port. * @returns {number} .ssh.port - SSH server port
* @property {string} ssh.term - The SSH terminal type. * @returns {string} .ssh.term - Terminal type
* @property {number} ssh.readyTimeout - The SSH ready timeout. * @returns {number} .ssh.readyTimeout - Connection timeout in ms
* @property {number} ssh.keepaliveInterval - The SSH keepalive interval. * @returns {number} .ssh.keepaliveInterval - Keepalive interval in ms
* @property {number} ssh.keepaliveCountMax - The SSH keepalive count maximum. * @returns {number} .ssh.keepaliveCountMax - Max keepalive count
* @property {Object} header - Configuration for header settings. * @returns {boolean} .ssh.alwaysSendKeyboardInteractivePrompts - Force keyboard-interactive
* @property {string|null} header.text - The header text. * @returns {Object} .ssh.algorithms - Supported SSH algorithms
* @property {string} header.background - The header background color. * @returns {string[]} .ssh.algorithms.cipher - Supported ciphers
* @property {Object} options - Configuration for options settings. * @returns {string[]} .ssh.algorithms.compress - Supported compression
* @property {boolean} options.challengeButton - Whether to show the challenge button. * @returns {string[]} .ssh.algorithms.hmac - Supported HMAC algorithms
* @property {boolean} options.autoLog - Whether to automatically log. * @returns {string[]} .ssh.algorithms.kex - Supported key exchange
* @property {boolean} options.allowReauth - Whether to allow reauthentication. * @returns {string[]} .ssh.algorithms.serverHostKey - Supported host key types
* @property {boolean} options.allowReconnect - Whether to allow reconnection. * @returns {Object} .header - UI header settings
* @property {boolean} options.allowReplay - Whether to allow replay. * @returns {string|null} .header.text - Header text
* @property {Object} algorithms - Configuration for algorithms settings. * @returns {string} .header.background - Header background color
* @property {string[]} algorithms.kex - The key exchange algorithms. * @returns {Object} .options - Feature flags and options
* @property {string[]} algorithms.cipher - The cipher algorithms. * @returns {boolean} .options.challengeButton - Show challenge button
* @property {string[]} algorithms.hmac - The HMAC algorithms. * @returns {boolean} .options.autoLog - Enable automatic logging
* @property {string[]} algorithms.compress - The compression algorithms. * @returns {boolean} .options.allowReauth - Allow reauthentication
* @property {Object} session - Configuration for session settings. * @returns {boolean} .options.allowReconnect - Allow reconnection
* @property {string} session.secret - The session secret. * @returns {boolean} .options.allowReplay - Allow session replay
* @property {string} session.name - The session name. * @returns {Object} .session - Session configuration
* @returns {string} .session.secret - Session secret key
* @returns {string} .session.name - Session cookie name
*/ */
const config = loadConfig() const config = loadConfig()

View file

@ -27,14 +27,6 @@
"allowedSubnets": [], "allowedSubnets": [],
"alwaysSendKeyboardInteractivePrompts": false, "alwaysSendKeyboardInteractivePrompts": false,
"algorithms": { "algorithms": {
"kex": [
"curve25519-sha256",
"ecdh-sha2-nistp256",
"ecdh-sha2-nistp384",
"ecdh-sha2-nistp521",
"diffie-hellman-group-exchange-sha256",
"diffie-hellman-group14-sha1"
],
"cipher": [ "cipher": [
"aes128-ctr", "aes128-ctr",
"aes192-ctr", "aes192-ctr",
@ -45,25 +37,27 @@
"aes256-gcm@openssh.com", "aes256-gcm@openssh.com",
"aes256-cbc" "aes256-cbc"
], ],
"hmac": [
"hmac-sha2-256",
"hmac-sha2-512",
"hmac-sha1"
],
"compress": [ "compress": [
"none", "none",
"zlib@openssh.com", "zlib@openssh.com",
"zlib" "zlib"
], ],
"hmac": [
"hmac-sha2-256",
"hmac-sha2-512",
"hmac-sha1"
],
"kex": [
"ecdh-sha2-nistp256",
"ecdh-sha2-nistp384",
"ecdh-sha2-nistp521",
"diffie-hellman-group-exchange-sha256",
"diffie-hellman-group14-sha1"
],
"serverHostKey": [ "serverHostKey": [
"ssh-ed25519",
"rsa-sha2-512",
"rsa-sha2-256",
"ecdsa-sha2-nistp256", "ecdsa-sha2-nistp256",
"ecdsa-sha2-nistp384", "ecdsa-sha2-nistp384",
"ecdsa-sha2-nistp521", "ecdsa-sha2-nistp521",
"rsa-sha2-512",
"rsa-sha2-256",
"ssh-rsa" "ssh-rsa"
] ]
} }