@profullstack/threatcrush 0.13.18 → 0.13.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/daemon.js +21 -1
- package/dist/daemon.js.map +1 -1
- package/dist/index.js +58 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/daemon.js
CHANGED
|
@@ -16034,6 +16034,18 @@ var RemediationConsumer = class {
|
|
|
16034
16034
|
}
|
|
16035
16035
|
this.manager.removeFromAllowlist(target);
|
|
16036
16036
|
return { status: "executed", executed_at };
|
|
16037
|
+
case "restart": {
|
|
16038
|
+
if (!this.opts.restartDaemon) return failed("restart not supported by this daemon");
|
|
16039
|
+
setTimeout(() => {
|
|
16040
|
+
try {
|
|
16041
|
+
this.opts.log("[cloud] dashboard requested a restart \u2014 restarting now");
|
|
16042
|
+
this.opts.restartDaemon?.();
|
|
16043
|
+
} catch (err) {
|
|
16044
|
+
this.opts.log(`[cloud] restart failed: ${err.message}`);
|
|
16045
|
+
}
|
|
16046
|
+
}, 3e3).unref?.();
|
|
16047
|
+
return { status: "executed", executed_at };
|
|
16048
|
+
}
|
|
16037
16049
|
default:
|
|
16038
16050
|
return failed(`unsupported action_type: ${action.action_type}`);
|
|
16039
16051
|
}
|
|
@@ -17417,6 +17429,14 @@ async function runDaemon() {
|
|
|
17417
17429
|
});
|
|
17418
17430
|
const version = readVersion2();
|
|
17419
17431
|
logLine(`[daemon] starting threatcrushd v${version} mode=${PATHS.mode}`);
|
|
17432
|
+
const restartDaemon = () => {
|
|
17433
|
+
if (PATHS.mode === "system") {
|
|
17434
|
+
(0, import_node_child_process7.spawn)("systemctl", ["restart", "threatcrushd"], { detached: true, stdio: "ignore" }).unref();
|
|
17435
|
+
} else {
|
|
17436
|
+
(0, import_node_child_process7.spawn)(process.execPath, process.argv.slice(1), { detached: true, stdio: "ignore" }).unref();
|
|
17437
|
+
setTimeout(() => process.exit(0), 500).unref();
|
|
17438
|
+
}
|
|
17439
|
+
};
|
|
17420
17440
|
const nodeProblem = daemonNodeProblem(process.versions.node);
|
|
17421
17441
|
if (nodeProblem) {
|
|
17422
17442
|
logLine(`[daemon] ${nodeProblem}`);
|
|
@@ -17501,7 +17521,7 @@ async function runDaemon() {
|
|
|
17501
17521
|
runHardening: runHardeningChecks
|
|
17502
17522
|
});
|
|
17503
17523
|
cloudSync.start();
|
|
17504
|
-
remediationConsumer = new RemediationConsumer(remediation, { log: logLine });
|
|
17524
|
+
remediationConsumer = new RemediationConsumer(remediation, { log: logLine, restartDaemon });
|
|
17505
17525
|
remediationConsumer.start();
|
|
17506
17526
|
allowlistSync = new AllowlistSync(remediation, { log: logLine });
|
|
17507
17527
|
allowlistSync.start();
|