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>
37 lines
1020 B
JavaScript
37 lines
1020 B
JavaScript
'use strict';
|
|
|
|
// Auditing + metrics API (admin-gated by middleware/auth in app.js).
|
|
|
|
const express = require('express');
|
|
const audit = require('../models/audit_event');
|
|
const metrics = require('../models/metrics');
|
|
const registry = require('../services/session_registry');
|
|
|
|
const router = express.Router();
|
|
|
|
router.get('/sessions', (req, res) => {
|
|
res.json({ results: registry.list(), active: registry.count() });
|
|
});
|
|
|
|
router.get('/audit', async (req, res, next) => {
|
|
try {
|
|
const page = Math.max(0, parseInt(req.query.page, 10) || 0);
|
|
const data = await audit.list({
|
|
page,
|
|
pageSize: Math.min(200, parseInt(req.query.pageSize, 10) || 50),
|
|
uid: req.query.uid || undefined,
|
|
target: req.query.target || undefined,
|
|
status: req.query.status || undefined,
|
|
});
|
|
res.json(data);
|
|
} catch (err) { next(err); }
|
|
});
|
|
|
|
router.get('/metrics', async (req, res, next) => {
|
|
try {
|
|
res.json({ ...(await metrics.summary()), active: registry.count() });
|
|
} catch (err) { next(err); }
|
|
});
|
|
|
|
module.exports = router;
|