@profullstack/threatcrush 0.13.24 → 0.13.26
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 +5 -1
- package/dist/daemon.js.map +1 -1
- package/dist/index.js +33 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -34771,7 +34771,11 @@ var Fail2banAdapter = class {
|
|
|
34771
34771
|
""
|
|
34772
34772
|
].join("\n")
|
|
34773
34773
|
);
|
|
34774
|
-
|
|
34774
|
+
try {
|
|
34775
|
+
this.client(["reload", this.jail]);
|
|
34776
|
+
} catch {
|
|
34777
|
+
this.client(["reload"]);
|
|
34778
|
+
}
|
|
34775
34779
|
this.jailReady = true;
|
|
34776
34780
|
}
|
|
34777
34781
|
async block(ip) {
|
|
@@ -36055,6 +36059,7 @@ async function installServiceCommand() {
|
|
|
36055
36059
|
console.log(source_default.dim(" Installing with a system Node (/usr/bin/node or /usr/local/bin/node) avoids this."));
|
|
36056
36060
|
}
|
|
36057
36061
|
ensureSystemDirs(configDir);
|
|
36062
|
+
installLogrotate();
|
|
36058
36063
|
stopUserModeDaemon();
|
|
36059
36064
|
try {
|
|
36060
36065
|
(0, import_node_child_process13.execSync)("systemctl daemon-reload", { stdio: "inherit" });
|
|
@@ -36076,6 +36081,33 @@ async function installServiceCommand() {
|
|
|
36076
36081
|
}
|
|
36077
36082
|
console.log();
|
|
36078
36083
|
}
|
|
36084
|
+
var LOGROTATE_PATH = "/etc/logrotate.d/threatcrush";
|
|
36085
|
+
function renderLogrotate(logDir = "/var/log/threatcrush") {
|
|
36086
|
+
return [
|
|
36087
|
+
"# Installed by `threatcrush install-service`.",
|
|
36088
|
+
`${logDir}/*.log {`,
|
|
36089
|
+
" daily",
|
|
36090
|
+
" maxsize 200M",
|
|
36091
|
+
" rotate 7",
|
|
36092
|
+
" compress",
|
|
36093
|
+
" delaycompress",
|
|
36094
|
+
" missingok",
|
|
36095
|
+
" notifempty",
|
|
36096
|
+
" create 0644 root root",
|
|
36097
|
+
" su root root",
|
|
36098
|
+
"}",
|
|
36099
|
+
""
|
|
36100
|
+
].join("\n");
|
|
36101
|
+
}
|
|
36102
|
+
function installLogrotate() {
|
|
36103
|
+
if (!(0, import_node_fs37.existsSync)((0, import_node_path26.dirname)(LOGROTATE_PATH))) return;
|
|
36104
|
+
try {
|
|
36105
|
+
(0, import_node_fs37.writeFileSync)(LOGROTATE_PATH, renderLogrotate(), { mode: 420 });
|
|
36106
|
+
console.log(source_default.green(` \u2713 Log rotation: ${LOGROTATE_PATH} (daily or 200M, keeps 7)`));
|
|
36107
|
+
} catch (err) {
|
|
36108
|
+
console.log(source_default.yellow(` ! Could not install log rotation: ${err.message}`));
|
|
36109
|
+
}
|
|
36110
|
+
}
|
|
36079
36111
|
function ensureSystemDirs(configDir) {
|
|
36080
36112
|
const dirs = [
|
|
36081
36113
|
{ path: "/etc/threatcrush", groupWritable: true },
|