@profullstack/threatcrush 0.13.25 → 0.13.27

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 CHANGED
@@ -2448,10 +2448,12 @@ var IpcServer = class {
2448
2448
  }
2449
2449
  const isRoot2 = process.platform === "linux" && typeof process.getuid === "function" && process.getuid() === 0;
2450
2450
  if (isRoot2) {
2451
- try {
2452
- const { gid } = nodeFs.statSync("/var/log/auth.log");
2453
- nodeFs.chownSync(PATHS.socket, 0, gid);
2454
- } catch {
2451
+ const gid = admGid();
2452
+ if (gid !== null) {
2453
+ try {
2454
+ nodeFs.chownSync(PATHS.socket, 0, gid);
2455
+ } catch {
2456
+ }
2455
2457
  }
2456
2458
  }
2457
2459
  resolve3();
@@ -2656,6 +2658,20 @@ var IpcServer = class {
2656
2658
  }
2657
2659
  }
2658
2660
  };
2661
+ function admGid(readGroup = () => (0, import_node_fs4.readFileSync)("/etc/group", "utf-8"), statAuthLog = () => (0, import_node_fs4.statSync)("/var/log/auth.log")) {
2662
+ try {
2663
+ for (const line of readGroup().split("\n")) {
2664
+ const [name, , gid] = line.split(":");
2665
+ if (name === "adm" && gid !== void 0 && /^\d+$/.test(gid)) return Number(gid);
2666
+ }
2667
+ } catch {
2668
+ }
2669
+ try {
2670
+ return statAuthLog().gid;
2671
+ } catch {
2672
+ return null;
2673
+ }
2674
+ }
2659
2675
 
2660
2676
  // src/daemon/module-host.ts
2661
2677
  var import_node_fs12 = require("fs");