@camstack/server 1.2.872 → 1.2.873

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.
Files changed (99) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/api/trpc/generated-cap-routers.js +7 -0
  3. package/dist/core/agent/expired-leaf-renewer.js +67 -0
  4. package/dist/core/agent/mesh-handshake-wiring.js +48 -0
  5. package/dist/manual-boot.js +6 -0
  6. package/package.json +12 -9
  7. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  8. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  9. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  10. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  11. package/system/dist/builtins/alerts/alerts.addon.js +1 -1
  12. package/system/dist/builtins/alerts/alerts.addon.mjs +1 -1
  13. package/system/dist/builtins/autotrack/index.js +1 -1
  14. package/system/dist/builtins/autotrack/index.mjs +1 -1
  15. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
  16. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
  17. package/system/dist/builtins/calendars/calendars.addon.js +1 -1
  18. package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
  19. package/system/dist/builtins/camera-grid/index.js +1 -1
  20. package/system/dist/builtins/camera-grid/index.mjs +1 -1
  21. package/system/dist/builtins/composer/composer.addon.js +4 -4
  22. package/system/dist/builtins/composer/composer.addon.mjs +4 -4
  23. package/system/dist/builtins/console-logging/index.js +1 -1
  24. package/system/dist/builtins/console-logging/index.mjs +1 -1
  25. package/system/dist/builtins/core-blocks/core-blocks.addon.js +3 -3
  26. package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +3 -3
  27. package/system/dist/builtins/device-history/device-history.addon.js +2 -2
  28. package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
  29. package/system/dist/builtins/device-manager/device-manager.addon.js +2 -2
  30. package/system/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
  31. package/system/dist/builtins/hub-forwarder/index.js +1 -1
  32. package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
  33. package/system/dist/builtins/keychain/index.js +4 -4
  34. package/system/dist/builtins/keychain/index.mjs +4 -4
  35. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  36. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  37. package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
  38. package/system/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
  39. package/system/dist/builtins/local-network/local-network.addon.js +3 -3
  40. package/system/dist/builtins/local-network/local-network.addon.mjs +3 -3
  41. package/system/dist/builtins/loki-logging/index.js +1 -1
  42. package/system/dist/builtins/loki-logging/index.mjs +1 -1
  43. package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  44. package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  45. package/system/dist/builtins/platform-probe/index.js +1 -1
  46. package/system/dist/builtins/platform-probe/index.mjs +1 -1
  47. package/system/dist/builtins/record-entries/index.js +1 -1
  48. package/system/dist/builtins/record-entries/index.mjs +1 -1
  49. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  50. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  51. package/system/dist/builtins/snapshot/index.js +1 -1
  52. package/system/dist/builtins/snapshot/index.mjs +1 -1
  53. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  54. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  55. package/system/dist/builtins/sqlite-storage/index.js +1 -1
  56. package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
  57. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +3 -3
  58. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +3 -3
  59. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  60. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  61. package/system/dist/builtins/system-config/system-config.addon.js +155 -21
  62. package/system/dist/builtins/system-config/system-config.addon.mjs +435 -303
  63. package/system/dist/builtins/winston-logging/index.js +1 -1
  64. package/system/dist/builtins/winston-logging/index.mjs +1 -1
  65. package/system/dist/{capture-engine-BYuDoU5P.mjs → capture-engine-WL-mpqRt.mjs} +1 -1
  66. package/system/dist/{capture-engine-BNeKmvyo.js → capture-engine-p0DLUXcQ.js} +1 -1
  67. package/system/dist/{composition-sources-52ZtkEBw.js → composition-sources-BuRkhqkL.js} +1 -1
  68. package/system/dist/{composition-sources-DQwbBMG1.mjs → composition-sources-Dheuv9_O.mjs} +1 -1
  69. package/system/dist/constants-Ci169fqS.mjs +27 -0
  70. package/system/dist/{constants-jwecWQuN.js → constants-D8fNaNti.js} +14 -1
  71. package/system/dist/{device-ca-Bkujp9Cx.js → device-ca-CPeChXfp.js} +1 -1
  72. package/system/dist/{device-ca-DFi1axk5.mjs → device-ca-Cu6Xu_CS.mjs} +1 -1
  73. package/system/dist/{dist-B15a2506.mjs → dist-BBWAHu-O.mjs} +29 -2
  74. package/system/dist/{dist-8pvVkKh4.js → dist-BHAE4TbZ.js} +29 -2
  75. package/system/dist/file-host-worker.js +1 -1
  76. package/system/dist/file-host-worker.mjs +1 -1
  77. package/system/dist/{hub-identity-3uLEvGsn.mjs → hub-identity-BPdwL_Qn.mjs} +1 -1
  78. package/system/dist/{hub-identity-C3ijBf-E.js → hub-identity-CfaF_M6Y.js} +1 -1
  79. package/system/dist/{hub-mdns-ciao-Ch6HwlRl.mjs → hub-mdns-ciao-1NZAZ7Mp.mjs} +2 -2
  80. package/system/dist/{hub-mdns-ciao-BUL3yLqz.js → hub-mdns-ciao-DS7-X9U_.js} +2 -2
  81. package/system/dist/index.js +10 -8
  82. package/system/dist/index.mjs +10 -10
  83. package/system/dist/kernel/index.d.ts +1 -1
  84. package/system/dist/kernel/moleculer/mesh-mtls/constants.d.ts +7 -2
  85. package/system/dist/kernel/moleculer/mesh-mtls/index.d.ts +2 -2
  86. package/system/dist/kernel/moleculer/mesh-mtls/mesh-ca.d.ts +1 -1
  87. package/system/dist/kernel/moleculer/mesh-mtls/mesh-peer-transport.d.ts +16 -0
  88. package/system/dist/kernel/moleculer/mesh-mtls/mesh-peer-verification.d.ts +30 -0
  89. package/system/dist/kernel/moleculer/mesh-mtls/tls-tcp-transporter.d.ts +24 -0
  90. package/system/dist/{legacy-integration-rows-door-BtRtvXfK.js → legacy-integration-rows-door-Bnz-aNu6.js} +1 -1
  91. package/system/dist/{legacy-integration-rows-door-ChF97F5x.mjs → legacy-integration-rows-door-CsxfaUSU.mjs} +1 -1
  92. package/system/dist/{rename-composition-block-CHIIBly8.js → rename-composition-block-CQUr1lYO.js} +1 -1
  93. package/system/dist/{rename-composition-block-DfsNTQ2H.mjs → rename-composition-block-Dxywwjac.mjs} +1 -1
  94. package/system/dist/{restore-archive-BfaE7Y65.mjs → restore-archive-CFMsgNKV.mjs} +82 -82
  95. package/system/dist/{restore-archive-8o1pcPFB.js → restore-archive-CbMms_b0.js} +1 -1
  96. package/system/dist/{wal-maintenance-DxtgYuYM.mjs → wal-maintenance-6782RP08.mjs} +0 -0
  97. package/system/dist/{wal-maintenance-Cv6MfFm9.js → wal-maintenance-DJ76u4GY.js} +0 -0
  98. package/system/package.json +1 -1
  99. package/system/dist/constants-RWobCEGs.mjs +0 -20
@@ -0,0 +1,30 @@
1
+ import type { MeshCrl } from "./mesh-crl.js";
2
+ export type MeshRefusalReason = "no-certificate" | "not-chained" | "expired" | "not-yet-valid" | "revoked" | "cn-mismatch" | "handshake-failed";
3
+ export interface MeshPeerAdmitted {
4
+ readonly admit: true;
5
+ readonly nodeId: string;
6
+ readonly serial: string;
7
+ /** The leaf is past its notAfter: the hub recovers it. */
8
+ readonly expired: boolean;
9
+ readonly notAfter: number;
10
+ }
11
+ export interface MeshPeerRefused {
12
+ readonly admit: false;
13
+ readonly reason: MeshRefusalReason;
14
+ readonly nodeId: string | null;
15
+ readonly detail: string;
16
+ }
17
+ export type MeshPeerVerdict = MeshPeerAdmitted | MeshPeerRefused;
18
+ export interface MeshPeerJudgement {
19
+ /** DER of the presented leaf, when there is one. */
20
+ readonly leafDer: Buffer | undefined;
21
+ readonly authorized: boolean;
22
+ /** Node's `authorizationError` (an OpenSSL code name such as `CERT_HAS_EXPIRED`). */
23
+ readonly authorizationError: string | null;
24
+ readonly caCertPem: string;
25
+ readonly crl: MeshCrl;
26
+ /** The hub recovers an expired leaf; an enrolled agent does not. */
27
+ readonly admitExpired: boolean;
28
+ readonly now: number;
29
+ }
30
+ export declare function judgeMeshPeerLeaf(input: MeshPeerJudgement): MeshPeerVerdict;
@@ -1,5 +1,6 @@
1
1
  import type { Server as NetServer, Socket as NetSocket } from "node:net";
2
2
  import { type MeshCrl } from "./mesh-crl.js";
3
+ import { type MeshHandshakeReporter } from "./mesh-peer-transport.js";
3
4
  /** Field of the gossip HELLO payload carrying the sender's mesh-TLS listen port. */
4
5
  export declare const MESH_TLS_PORT_HELLO_FIELD = "meshTlsPort";
5
6
  type TcpTransporterConstructor = new (opts?: Record<string, unknown>) => TlsTcpTransporterBase;
@@ -79,6 +80,12 @@ export interface TlsTcpTransporterOptions {
79
80
  /** When set at construction, TLS starts with the clear reader. */
80
81
  readonly meshTls?: MeshTlsMaterial;
81
82
  readonly crl?: MeshCrl;
83
+ /**
84
+ * Where handshake refusals are reported (WARN, tagged with the node id) and where an admitted
85
+ * expired leaf is announced. Default: the process reporter, else the transporter's own logger -
86
+ * which the broker pins to `error`, so a real deployment always publishes a reporter (#558).
87
+ */
88
+ readonly handshakeReporter?: MeshHandshakeReporter;
82
89
  /** Hub only (D826): never bind clear TCP or UDP discovery. */
83
90
  readonly hubTlsOnly?: boolean;
84
91
  /**
@@ -131,6 +138,8 @@ export declare class TlsTcpTransporter extends TcpTransporterBase {
131
138
  private tlsServer;
132
139
  private meshTls;
133
140
  private readonly crl;
141
+ private readonly handshakeReporter;
142
+ private readonly refusalLoggedAt;
134
143
  private readonly revokedPeerLoggedAt;
135
144
  private readonly tlsSockets;
136
145
  /** Node id (certificate CN) → serial of every peer that completed a mutual-TLS handshake. */
@@ -227,6 +236,16 @@ export declare class TlsTcpTransporter extends TcpTransporterBase {
227
236
  * every few seconds), with the node id as a tag and the reason (D391).
228
237
  */
229
238
  private noteRevokedPeer;
239
+ private reporter;
240
+ /** A WARN that survives the transport log pin: the reporter when there is one, else the logger. */
241
+ private reportWarn;
242
+ /**
243
+ * A refusal, once per window. Only `expired` carries a node id that was proven (the chain to the
244
+ * mesh CA was checked); every other refusal is of a peer nobody vouched for, whose CN is whatever
245
+ * it wrote. Those are keyed by remote address, and the claimed CN goes in `meta`, never in
246
+ * `tags.nodeId` - a peer must not mint a log tag or a rate-limit key per CN.
247
+ */
248
+ private noteRefusedPeer;
230
249
  /** Close sockets whose peer serial was just revoked. */
231
250
  dropRevokedSockets(): void;
232
251
  override disconnect(): Promise<void>;
@@ -242,6 +261,11 @@ export declare class TlsTcpTransporter extends TcpTransporterBase {
242
261
  override publish(packet: OutgoingPacket): Promise<unknown>;
243
262
  override onIncomingMessage(type: string, message: Buffer, socket?: NetSocket): unknown;
244
263
  private startTlsServerIfReady;
264
+ /**
265
+ * The hub let a peer in on a leaf that only expired: say so, and hand the node to the renewal,
266
+ * which swaps it for the no-expiry leaf. The WARN is not rate limited - it is a recovery event.
267
+ */
268
+ private admitExpiredLeaf;
245
269
  private onTlsClientConnected;
246
270
  }
247
271
  export type { NetServer };
@@ -1,4 +1,4 @@
1
- const require_dist = require("./dist-8pvVkKh4.js");
1
+ const require_dist = require("./dist-BHAE4TbZ.js");
2
2
  //#region src/builtins/sqlite-storage/migrations/legacy-integration-rows-door.ts
3
3
  /**
4
4
  * Migration-only door for the leftover integration rows (planning#416).
@@ -1,4 +1,4 @@
1
- import { kc as collectSecretMarkerRefs } from "./dist-B15a2506.mjs";
1
+ import { kc as collectSecretMarkerRefs } from "./dist-BBWAHu-O.mjs";
2
2
  //#region src/builtins/sqlite-storage/migrations/legacy-integration-rows-door.ts
3
3
  /**
4
4
  * Migration-only door for the leftover integration rows (planning#416).
@@ -1,4 +1,4 @@
1
- const require_dist = require("./dist-8pvVkKh4.js");
1
+ const require_dist = require("./dist-BHAE4TbZ.js");
2
2
  //#region src/builtins/core-blocks/rename-composition-block.ts
3
3
  /**
4
4
  * An operator rename of a composed device writes the composition block's
@@ -1,4 +1,4 @@
1
- import { Il as errMsg, Ml as COMPOSED_DEVICE_STABLE_ID_PREFIX } from "./dist-B15a2506.mjs";
1
+ import { Il as errMsg, Ml as COMPOSED_DEVICE_STABLE_ID_PREFIX } from "./dist-BBWAHu-O.mjs";
2
2
  //#region src/builtins/core-blocks/rename-composition-block.ts
3
3
  /**
4
4
  * An operator rename of a composed device writes the composition block's