security(vault,recovery,config): harden Vault keyfile/seal, strip recovery passwords, guard config & symlinks

This commit is contained in:
tyuXX 2026-11-27 22:22:59 +00:00
parent 005c82e6bf
commit e3f716d24f
12 changed files with 504 additions and 207 deletions

View file

@ -118,6 +118,7 @@ export async function createGCoordinatorServer(
const auditService = new AuditService(db);
const vaultService = new VaultService(vaultPath, {
keyFilePath: path.join(dataDir, 'vault.key'),
allowLocalKeyFile: options.autoKeyFile ?? true,
});
const recoveryStore = new EmergencyRecoveryService(dataDir);
const rateLimiter = new RateLimiter({ db });
@ -349,6 +350,19 @@ export async function createGCoordinatorServer(
workflowEngine.start();
alertEngine.start();
vaultService.onSeal(() => {
aiService.cancelAll();
alertEngine.handlePanicLock();
workflowEngine.handlePanicLock();
broadcastService.cancelAll();
monitoringService.stopAll();
customSystemsEngine.stopBackgroundChecks();
customSystemsEngine.cancelAllStreams();
tunnelManager.stopAll();
ptyManager.closeAll(true);
sshPool.closeAll('vault_sealed');
});
vaultService.onPanicLock(() => {
aiService.cancelAll();
alertEngine.handlePanicLock();
@ -391,7 +405,11 @@ export async function createGCoordinatorServer(
}
if (event.entityType === 'settings') {
applyDatabaseThrottlePragmas(db, getRuntimeLimits());
authService.syncRecovery();
if (!configManager.getSettings().security.enableEmergencySecretsBackup) {
recoveryStore.wipeAll();
} else {
authService.syncRecovery();
}
}
monitoringService.syncServers();
customSystemsEngine.syncBackgroundChecks();
@ -528,7 +546,7 @@ export async function createGCoordinatorServer(
);
app.use(
'/api/config',
createConfigRouter({ authService, configManager, auditService }),
createConfigRouter({ authService, configManager, auditService, stepUpGuard }),
);
app.use('/api/audit', createAuditRouter(authService, auditService));