29 lines
729 B
JavaScript
29 lines
729 B
JavaScript
import assert from 'node:assert/strict'
|
|
import { parseSshdConfig } from '../../bare-os-booter/lib/services/sshd-config-parse.js'
|
|
|
|
const c = parseSshdConfig(`
|
|
# comment
|
|
Port 2222
|
|
ListenAddress 0.0.0.0
|
|
HostKey /a
|
|
HostKey /b
|
|
PasswordAuthentication no
|
|
PubkeyAuthentication yes
|
|
PermitRootLogin yes
|
|
MaxAuthTries 3
|
|
`)
|
|
|
|
assert.equal(c.port, 2222)
|
|
assert.equal(c.listenAddress, '0.0.0.0')
|
|
assert.deepEqual(c.hostKeyPaths, ['/a', '/b'])
|
|
assert.equal(c.passwordAuthentication, false)
|
|
assert.equal(c.pubkeyAuthentication, true)
|
|
assert.equal(c.permitRootLogin, true)
|
|
assert.equal(c.maxAuthTries, 3)
|
|
|
|
const d = parseSshdConfig('')
|
|
assert.ok(d.hostKeyPaths.length >= 1)
|
|
assert.equal(d.port, 2222)
|
|
|
|
console.log('sshd-config-parse.test.mjs: OK')
|