feat(vault): keep established secrets active at runtime and require unlock only for modifications
This commit is contained in:
parent
c5a5835ae6
commit
10a28bb316
14 changed files with 445 additions and 85 deletions
|
|
@ -16,6 +16,7 @@ import {
|
|||
requireCsrf,
|
||||
requireStepUp,
|
||||
} from '../../security/guards.js';
|
||||
import type { VaultService } from '../../security/vault.js';
|
||||
import type { KeyManager } from '../../ssh/key-manager.js';
|
||||
import type { KnownHostsService } from '../../ssh/known-hosts.js';
|
||||
import type { SSHPool } from '../../ssh/ssh-pool.js';
|
||||
|
|
@ -24,6 +25,7 @@ export interface ServersRouterDeps {
|
|||
authService: AuthService;
|
||||
configManager: ConfigManager;
|
||||
auditService: AuditService;
|
||||
vaultService?: VaultService;
|
||||
knownHosts: KnownHostsService;
|
||||
sshPool: SSHPool;
|
||||
keyManager: KeyManager;
|
||||
|
|
@ -41,6 +43,7 @@ export function createServersRouter(deps: ServersRouterDeps): Router {
|
|||
authService,
|
||||
configManager,
|
||||
auditService,
|
||||
vaultService,
|
||||
knownHosts,
|
||||
sshPool,
|
||||
keyManager,
|
||||
|
|
@ -98,6 +101,13 @@ export function createServersRouter(deps: ServersRouterDeps): Router {
|
|||
enforceSafeMode,
|
||||
stepUpGuard,
|
||||
async (req, res) => {
|
||||
if (vaultService && vaultService.state !== 'unlocked') {
|
||||
res.status(423).json({
|
||||
error: 'VAULT_LOCKED',
|
||||
message: 'Vault is locked against modifications. Unlock the Vault before rotating SSH keys.',
|
||||
});
|
||||
return;
|
||||
}
|
||||
const parsed = z
|
||||
.object({
|
||||
serverIds: z.array(EntityIdSchema).optional(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue