36e9d5b0b3
An SSH jump host that authenticates users against the shared LDAP directory, authorizes them from the SSO Manager's inventory graph, and bridges them to downstream hosts — auditing everything. - Username-grammar routing (uid_-_target@jump) + interactive TUI picker - Inbound LDAP auth (publickey / password with off|local|all policy) - Directory-driven access (LDAP groups x /api/discovery/resources?group=) - Per-user key injection into sshPublicKey, connects downstream as the user - Shell / exec / SFTP-subsystem bridging (WinSCP works) - Web UI + HTTP API (:3002) for audit + metrics; LDAP-admin gated - Packaged like proxy: ops/install.sh + systemd, all-in-one Docker, compose - Tests: 23 unit + 3 integration (node --test), all green Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
32 lines
1.1 KiB
JavaScript
32 lines
1.1 KiB
JavaScript
'use strict';
|
|
|
|
const { test } = require('node:test');
|
|
const assert = require('node:assert');
|
|
const fs = require('fs');
|
|
const os = require('os');
|
|
const path = require('path');
|
|
const { ensureKeys, pubLine, generatePair } = require('../../utils/host_keys');
|
|
|
|
process.env.NODE_ENV = 'test';
|
|
|
|
test('generates a parseable ed25519 public line', () => {
|
|
const pem = generatePair('ed25519');
|
|
const line = pubLine(pem, 'jump-host@test');
|
|
assert.match(line, /^ssh-ed25519 [A-Za-z0-9+/=]+ jump-host@test$/);
|
|
});
|
|
|
|
test('ensureKeys writes and reloads a stable keypair', () => {
|
|
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'jh-keys-'));
|
|
const conf = require('@simpleworkjs/conf');
|
|
conf.ssh = { ...conf.ssh, hostKeyPath: dir, keyComment: 'jump-host@test' };
|
|
|
|
const first = ensureKeys(dir);
|
|
assert.strictEqual(first.hostKeys.length, 2);
|
|
assert.match(first.publicLine, /jump-host@test$/);
|
|
|
|
const second = ensureKeys(dir);
|
|
assert.strictEqual(second.publicLine, first.publicLine); // stable, not regenerated
|
|
assert.ok(fs.existsSync(path.join(dir, 'id_ed25519')));
|
|
assert.ok(fs.existsSync(path.join(dir, 'id_rsa')));
|
|
});
|