@camstack/server 1.2.872 → 1.2.874
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/CHANGELOG.md +17 -0
- package/dist/api/trpc/generated-cap-routers.js +7 -0
- package/dist/core/agent/expired-leaf-renewer.js +67 -0
- package/dist/core/agent/mesh-handshake-wiring.js +48 -0
- package/dist/manual-boot.js +6 -0
- package/package.json +13 -11
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
- package/system/dist/builtins/alerts/alerts.addon.js +1 -1
- package/system/dist/builtins/alerts/alerts.addon.mjs +1 -1
- package/system/dist/builtins/autotrack/index.js +1 -1
- package/system/dist/builtins/autotrack/index.mjs +1 -1
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
- package/system/dist/builtins/calendars/calendars.addon.js +1 -1
- package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
- package/system/dist/builtins/camera-grid/index.js +1 -1
- package/system/dist/builtins/camera-grid/index.mjs +1 -1
- package/system/dist/builtins/composer/composer.addon.js +4 -4
- package/system/dist/builtins/composer/composer.addon.mjs +4 -4
- package/system/dist/builtins/console-logging/index.js +1 -1
- package/system/dist/builtins/console-logging/index.mjs +1 -1
- package/system/dist/builtins/core-blocks/core-blocks.addon.js +3 -3
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +3 -3
- package/system/dist/builtins/device-history/device-history.addon.js +2 -2
- package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
- package/system/dist/builtins/device-manager/device-manager.addon.js +87 -29
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +87 -29
- package/system/dist/builtins/hub-forwarder/index.js +1 -1
- package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/system/dist/builtins/keychain/index.js +4 -4
- package/system/dist/builtins/keychain/index.mjs +4 -4
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
- package/system/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
- package/system/dist/builtins/local-network/local-network.addon.js +3 -3
- package/system/dist/builtins/local-network/local-network.addon.mjs +3 -3
- package/system/dist/builtins/loki-logging/index.js +1 -1
- package/system/dist/builtins/loki-logging/index.mjs +1 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
- package/system/dist/builtins/platform-probe/index.js +1 -1
- package/system/dist/builtins/platform-probe/index.mjs +1 -1
- package/system/dist/builtins/record-entries/index.js +1 -1
- package/system/dist/builtins/record-entries/index.mjs +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/snapshot/index.js +1 -1
- package/system/dist/builtins/snapshot/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/index.js +1 -1
- package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +3 -3
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +3 -3
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/system-config/system-config.addon.js +190 -22
- package/system/dist/builtins/system-config/system-config.addon.mjs +189 -23
- package/system/dist/builtins/winston-logging/index.js +1 -1
- package/system/dist/builtins/winston-logging/index.mjs +1 -1
- package/system/dist/{capture-engine-BNeKmvyo.js → capture-engine-Cm-Bq2GH.js} +1 -1
- package/system/dist/{capture-engine-BYuDoU5P.mjs → capture-engine-v5nSEyMa.mjs} +1 -1
- package/system/dist/{composition-sources-DQwbBMG1.mjs → composition-sources-BVxOFdMp.mjs} +1 -1
- package/system/dist/{composition-sources-52ZtkEBw.js → composition-sources-DgAdHcEq.js} +1 -1
- package/system/dist/{constants-jwecWQuN.js → constants-CPAYm7Bq.js} +14 -1
- package/system/dist/constants-Di6cOA3l.mjs +27 -0
- package/system/dist/{device-ca-Bkujp9Cx.js → device-ca-CtsnO3ul.js} +1 -1
- package/system/dist/{device-ca-DFi1axk5.mjs → device-ca-DukusHra.mjs} +1 -1
- package/system/dist/{dist-8pvVkKh4.js → dist-AbO-Bmtw.js} +182 -2
- package/system/dist/{dist-B15a2506.mjs → dist-CIUo0MpB.mjs} +177 -3
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/{hub-identity-3uLEvGsn.mjs → hub-identity-CMzGT-O8.mjs} +1 -1
- package/system/dist/{hub-identity-C3ijBf-E.js → hub-identity-DyXxu-ZQ.js} +1 -1
- package/system/dist/{hub-mdns-ciao-Ch6HwlRl.mjs → hub-mdns-ciao-BTpy99VT.mjs} +2 -2
- package/system/dist/{hub-mdns-ciao-BUL3yLqz.js → hub-mdns-ciao-C6Gkg80T.js} +2 -2
- package/system/dist/index.js +10 -8
- package/system/dist/index.mjs +10 -10
- package/system/dist/kernel/index.d.ts +1 -1
- package/system/dist/kernel/moleculer/mesh-mtls/constants.d.ts +7 -2
- package/system/dist/kernel/moleculer/mesh-mtls/index.d.ts +2 -2
- package/system/dist/kernel/moleculer/mesh-mtls/mesh-ca.d.ts +1 -1
- package/system/dist/kernel/moleculer/mesh-mtls/mesh-peer-transport.d.ts +16 -0
- package/system/dist/kernel/moleculer/mesh-mtls/mesh-peer-verification.d.ts +30 -0
- package/system/dist/kernel/moleculer/mesh-mtls/tls-tcp-transporter.d.ts +31 -0
- package/system/dist/{legacy-integration-rows-door-BtRtvXfK.js → legacy-integration-rows-door-BQztEAgV.js} +1 -1
- package/system/dist/{legacy-integration-rows-door-ChF97F5x.mjs → legacy-integration-rows-door-ChwuaraH.mjs} +1 -1
- package/system/dist/{rename-composition-block-DfsNTQ2H.mjs → rename-composition-block-CEkkKNmw.mjs} +1 -1
- package/system/dist/{rename-composition-block-CHIIBly8.js → rename-composition-block-CnQKQDSg.js} +1 -1
- package/system/dist/{restore-archive-BfaE7Y65.mjs → restore-archive-DROkE3b4.mjs} +1 -1
- package/system/dist/{restore-archive-8o1pcPFB.js → restore-archive-DRYoZ_dn.js} +1 -1
- package/system/dist/{wal-maintenance-Cv6MfFm9.js → wal-maintenance-C81WD-_A.js} +0 -0
- package/system/dist/{wal-maintenance-DxtgYuYM.mjs → wal-maintenance-DYmw2kX7.mjs} +0 -0
- package/system/package.json +1 -1
- package/system/dist/constants-RWobCEGs.mjs +0 -20
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-AbO-Bmtw.js");
|
|
7
7
|
let node_crypto = require("node:crypto");
|
|
8
8
|
let node_fs = require("node:fs");
|
|
9
9
|
node_fs = require_chunk.__toESM(node_fs);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $r as filesystemBrowseCapability,
|
|
1
|
+
import { $r as filesystemBrowseCapability, Do as storageProviderCapability, Ls as BaseAddon } from "../../dist-CIUo0MpB.mjs";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import * as fs$1 from "node:fs";
|
|
4
4
|
import * as path$1 from "node:path";
|
|
@@ -4,7 +4,7 @@ Object.defineProperties(exports, {
|
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
6
|
const require_builtins_sqlite_storage_filesystem_storage_addon = require("./filesystem-storage.addon.js");
|
|
7
|
-
const require_wal_maintenance = require("../../wal-maintenance-
|
|
7
|
+
const require_wal_maintenance = require("../../wal-maintenance-C81WD-_A.js");
|
|
8
8
|
const require_builtins_sqlite_storage_sqlite_settings_addon = require("./sqlite-settings.addon.js");
|
|
9
9
|
//#region src/builtins/sqlite-storage/config-store.ts
|
|
10
10
|
var ConfigStore = class {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FilesystemStorageAddon, t as FilesystemStorageProvider } from "./filesystem-storage.addon.mjs";
|
|
2
|
-
import { B as SQLITE_ENGINE_STORM_WALL_SHARE, F as SQLITE_MMAP_FLOOR_BYTES, G as SqliteOpProfiler, H as SQLITE_PROFILE_REPORT_INTERVAL_MS, I as SQLITE_PAGE_CACHE_CEILING_KIB, K as sqliteEngineStorm, L as SQLITE_PAGE_CACHE_FLOOR_KIB, N as SQLITE_JOURNAL_SIZE_LIMIT_BYTES, P as SQLITE_MMAP_CEILING_BYTES, R as sqliteMmapSizeFor, U as SQLITE_PROFILE_TOP_N, V as SQLITE_PROFILE_REPORT_FLOOR_MS, W as SQLITE_SLOW_CALL_MS, a as WalMaintenance, i as WAL_MAINTENANCE_INTERVAL_MS, l as SqliteSettingsBackend, n as WAL_HIGH_WATER_BYTES, r as WAL_IDLE_QUIET_MS, t as WAL_CHECKPOINT_BUSY_TIMEOUT_MS, z as sqlitePageCacheKibFor } from "../../wal-maintenance-
|
|
2
|
+
import { B as SQLITE_ENGINE_STORM_WALL_SHARE, F as SQLITE_MMAP_FLOOR_BYTES, G as SqliteOpProfiler, H as SQLITE_PROFILE_REPORT_INTERVAL_MS, I as SQLITE_PAGE_CACHE_CEILING_KIB, K as sqliteEngineStorm, L as SQLITE_PAGE_CACHE_FLOOR_KIB, N as SQLITE_JOURNAL_SIZE_LIMIT_BYTES, P as SQLITE_MMAP_CEILING_BYTES, R as sqliteMmapSizeFor, U as SQLITE_PROFILE_TOP_N, V as SQLITE_PROFILE_REPORT_FLOOR_MS, W as SQLITE_SLOW_CALL_MS, a as WalMaintenance, i as WAL_MAINTENANCE_INTERVAL_MS, l as SqliteSettingsBackend, n as WAL_HIGH_WATER_BYTES, r as WAL_IDLE_QUIET_MS, t as WAL_CHECKPOINT_BUSY_TIMEOUT_MS, z as sqlitePageCacheKibFor } from "../../wal-maintenance-DYmw2kX7.mjs";
|
|
3
3
|
import { SqliteSettingsAddon } from "./sqlite-settings.addon.mjs";
|
|
4
4
|
//#region src/builtins/sqlite-storage/config-store.ts
|
|
5
5
|
var ConfigStore = class {
|
|
@@ -3,12 +3,12 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-AbO-Bmtw.js");
|
|
7
7
|
const require_retired_settings_keys = require("../../retired-settings-keys-C8nOOr5H.js");
|
|
8
|
-
const require_wal_maintenance = require("../../wal-maintenance-
|
|
8
|
+
const require_wal_maintenance = require("../../wal-maintenance-C81WD-_A.js");
|
|
9
9
|
const require_sqlite_snapshot_protocol = require("../../sqlite-snapshot-protocol-B9OndqZv.js");
|
|
10
10
|
const require_wal_checkpoint_policy = require("../../wal-checkpoint-policy-d2z2qPqx.js");
|
|
11
|
-
const require_legacy_integration_rows_door = require("../../legacy-integration-rows-door-
|
|
11
|
+
const require_legacy_integration_rows_door = require("../../legacy-integration-rows-door-BQztEAgV.js");
|
|
12
12
|
let zod = require("zod");
|
|
13
13
|
let node_crypto = require("node:crypto");
|
|
14
14
|
let node_fs = require("node:fs");
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { $a as resolveRunnerId,
|
|
1
|
+
import { $a as resolveRunnerId, Ac as collectSecretMarkerRefs, Co as storageAdminCapability, F as DATABASE_SNAPSHOT_PARTIAL_SUFFIX, Fc as customAction, I as DATABASE_SNAPSHOT_SUFFIX, Jo as vectorStoreCapability, Js as InvalidRecordError, L as DATABASE_SNAPSHOT_TIMEOUT_MS, Lc as defineCustomActions, Ll as errMsg$1, Ls as BaseAddon, Lt as MigrationMetaSchema, Mt as MIGRATION_API_V1_METHODS, Na as recordsCapability, Pn as bareAddonId, R as DATA_STORE_DATABASES, Us as DeclarationRefusedError, Yn as catalogueIssues, Ys as NoCallerError, Zi as migrationsCapability, _c as UnknownRecordKindError, cc as RecordKindDeclarationSchema, fl as normalizeSecretOwner, hc as TransactRefusedError, ic as RUNTIME_DEFAULTS, la as orderMigrations, tc as RECORD_SWEEP_INTERVAL_MS, vr as dataStoreProviderCapability, yr as databaseSnapshotCapability, zl as EventCategory } from "../../dist-CIUo0MpB.mjs";
|
|
2
2
|
import { r as retiredKeyStoreOf, t as purgeRetiredSettingsKeys } from "../../retired-settings-keys-u6xQA6r7.mjs";
|
|
3
|
-
import { A as callRecords, D as RecordsEngine, E as databaseOfStore, M as controlTargetOf, O as callControl, T as trustResult, _ as rehydrateError, a as WalMaintenance, b as collectTransferables, c as vectorProviderOfOwnedFile, d as callMigrate, f as migrateTargetOf, g as DuplicatePlacementError, h as DatabaseBusyError, j as callVector, k as callData, l as SqliteSettingsBackend, m as CrossDatabaseTransactError, o as createVectorIndex, p as CollectionPlacementError, s as vectorProviderOf, u as HUB_MIGRATIONS, x as isFileHostMessage } from "../../wal-maintenance-
|
|
3
|
+
import { A as callRecords, D as RecordsEngine, E as databaseOfStore, M as controlTargetOf, O as callControl, T as trustResult, _ as rehydrateError, a as WalMaintenance, b as collectTransferables, c as vectorProviderOfOwnedFile, d as callMigrate, f as migrateTargetOf, g as DuplicatePlacementError, h as DatabaseBusyError, j as callVector, k as callData, l as SqliteSettingsBackend, m as CrossDatabaseTransactError, o as createVectorIndex, p as CollectionPlacementError, s as vectorProviderOf, u as HUB_MIGRATIONS, x as isFileHostMessage } from "../../wal-maintenance-DYmw2kX7.mjs";
|
|
4
4
|
import { r as isSnapshotWorkerMessage } from "../../sqlite-snapshot-protocol-2QaTouWV.mjs";
|
|
5
5
|
import { a as isWorkerMessage, t as WAL_CHECKPOINT_LARGE_PASS_FRAMES } from "../../wal-checkpoint-policy-BahrTtyD.mjs";
|
|
6
|
-
import { a as patchLegacyIntegrationRows, i as legacyIntegrationAddonId, n as clearLegacyIntegrationRows, o as readLegacyIntegrationRows, r as deleteLegacyIntegrationRowKeys } from "../../legacy-integration-rows-door-
|
|
6
|
+
import { a as patchLegacyIntegrationRows, i as legacyIntegrationAddonId, n as clearLegacyIntegrationRows, o as readLegacyIntegrationRows, r as deleteLegacyIntegrationRowKeys } from "../../legacy-integration-rows-door-ChwuaraH.mjs";
|
|
7
7
|
import { createRequire } from "node:module";
|
|
8
8
|
import { z } from "zod";
|
|
9
9
|
import { randomUUID } from "node:crypto";
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-AbO-Bmtw.js");
|
|
7
7
|
const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
|
|
8
8
|
let zod = require("zod");
|
|
9
9
|
let node_crypto = require("node:crypto");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $i as modeMayWrite,
|
|
1
|
+
import { $i as modeMayWrite, Dc as buildSecretRef, Dl as toSecretFieldView, Ei as isLocationEnabled, Fc as customAction, Gi as mayWriteToLocation, Ic as defineAddonMigrations, Ja as resolveLocationMode, Lc as defineCustomActions, Ls as BaseAddon, Mo as switchStateOfMode, Oc as collectSecretConfigKeys, Qi as modeForSwitch, To as storageMigrationCapability, Ur as evictionPolicyOfLocation, Wi as mayReadLocation, Zo as withLocationMode, _l as recordSecretRef, dl as normalizeNodeId, dn as StorageCleanupJobSchema, fi as integrationInstancesCapability, fn as StorageLocationModeSchema, fo as settingsStoreCapability, hl as parseSecretRef, ii as gbToBytes, il as isSecretMarker, mn as StorageMigrationJobSchema, nc as REDACTED_SECRET, nl as isSecretClear, pn as StorageLocationTypeSchema, rl as isSecretFieldView, rn as STORAGE_LOCATION_MODES, sl as makeSecretMarker, wo as storageCapability, yl as resolveSecretMarkers, zc as defineRecordKinds, zl as EventCategory } from "../../dist-CIUo0MpB.mjs";
|
|
2
2
|
import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
@@ -3,11 +3,11 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-AbO-Bmtw.js");
|
|
7
7
|
const require_safe_buffer$1 = require("../../safe-buffer-D3aoa-7X.js");
|
|
8
8
|
const require_x509_es = require("../../x509.es-WtnRNyYS.js");
|
|
9
|
-
const require_hub_identity = require("../../hub-identity-
|
|
10
|
-
const require_constants$8 = require("../../constants-
|
|
9
|
+
const require_hub_identity = require("../../hub-identity-DyXxu-ZQ.js");
|
|
10
|
+
const require_constants$8 = require("../../constants-CPAYm7Bq.js");
|
|
11
11
|
const require_src$1 = require("../../src-CnAqG6EF.js");
|
|
12
12
|
let zod = require("zod");
|
|
13
13
|
let node_crypto = require("node:crypto");
|
|
@@ -459,7 +459,7 @@ async function loadMeshCa(certPem, keyPem) {
|
|
|
459
459
|
}
|
|
460
460
|
/**
|
|
461
461
|
* Issue a leaf from a CSR. CN must be present; when `expectedNodeId` is set
|
|
462
|
-
* it must match. Validity:
|
|
462
|
+
* it must match. Validity: none (`MESH_LEAF_NOT_AFTER`); `validDays` is a spec seam that forges a short one.
|
|
463
463
|
*/
|
|
464
464
|
async function issueMeshLeafFromCsr(ca, csrPem, opts = {}) {
|
|
465
465
|
const csr = new require_x509_es.Pkcs10CertificateRequest(csrPem);
|
|
@@ -469,9 +469,8 @@ async function issueMeshLeafFromCsr(ca, csrPem, opts = {}) {
|
|
|
469
469
|
if (opts.allowReserved !== true && !isValidAgentNodeId(cn)) throw new Error(`CSR CN '${cn}' is not an id an agent may carry`);
|
|
470
470
|
if (opts.expectedNodeId !== void 0 && opts.expectedNodeId !== cn) throw new Error(`CSR CN '${cn}' does not match the token nodeId '${opts.expectedNodeId}'`);
|
|
471
471
|
const now = opts.now ?? /* @__PURE__ */ new Date();
|
|
472
|
-
const validDays = opts.validDays ?? 30;
|
|
473
472
|
const serialNumber = freshSerial();
|
|
474
|
-
const notAfter = new Date(now.getTime() + validDays * MS_PER_DAY);
|
|
473
|
+
const notAfter = opts.validDays === void 0 ? new Date(require_constants$8.MESH_LEAF_NOT_AFTER) : new Date(now.getTime() + opts.validDays * MS_PER_DAY);
|
|
475
474
|
const extensions = [
|
|
476
475
|
new require_x509_es.BasicConstraintsExtension(false, void 0, true),
|
|
477
476
|
new require_x509_es.KeyUsagesExtension(require_x509_es.KeyUsageFlags.digitalSignature, true),
|
|
@@ -1509,6 +1508,18 @@ function emitProcessNodeRegistered(nodeId, addonIds) {
|
|
|
1509
1508
|
listener(nodeId, addonIds);
|
|
1510
1509
|
} catch {}
|
|
1511
1510
|
}
|
|
1511
|
+
var REPORTER_SLOT = Symbol.for("camstack.cluster.mesh-handshake-reporter");
|
|
1512
|
+
function setProcessMeshHandshakeReporter(reporter) {
|
|
1513
|
+
if (reporter === null) Reflect.deleteProperty(globalThis, REPORTER_SLOT);
|
|
1514
|
+
else Reflect.set(globalThis, REPORTER_SLOT, reporter);
|
|
1515
|
+
}
|
|
1516
|
+
function isHandshakeReporter(value) {
|
|
1517
|
+
return value !== null && typeof value === "object" && typeof Reflect.get(value, "warn") === "function";
|
|
1518
|
+
}
|
|
1519
|
+
function getProcessMeshHandshakeReporter() {
|
|
1520
|
+
const value = Reflect.get(globalThis, REPORTER_SLOT);
|
|
1521
|
+
return isHandshakeReporter(value) ? value : null;
|
|
1522
|
+
}
|
|
1512
1523
|
//#endregion
|
|
1513
1524
|
//#region src/kernel/moleculer/mesh-mtls/mesh-tls-enabler.ts
|
|
1514
1525
|
var SLOT = Symbol.for("camstack.mesh.tls-enabler");
|
|
@@ -86743,6 +86754,63 @@ import_moleculer.default.Utils;
|
|
|
86743
86754
|
import_moleculer.default.Validator;
|
|
86744
86755
|
import_moleculer.default.Validators;
|
|
86745
86756
|
//#endregion
|
|
86757
|
+
//#region src/kernel/moleculer/mesh-mtls/mesh-peer-verification.ts
|
|
86758
|
+
/**
|
|
86759
|
+
* The hub's judgement of a mesh peer's leaf (#558, amends D857).
|
|
86760
|
+
*
|
|
86761
|
+
* Node verifies the chain and the clock in one step and reports a single error, so an expired leaf
|
|
86762
|
+
* and a forged one both fail the handshake. The listener therefore keeps verification ON but lets
|
|
86763
|
+
* the handshake finish (`rejectUnauthorized: false` reports `authorized` / `authorizationError`),
|
|
86764
|
+
* and decides here, explicitly: a peer is admitted when it is authorized, or - on the hub only -
|
|
86765
|
+
* when its sole failure is `CERT_HAS_EXPIRED` AND an independent check proves the leaf is signed by
|
|
86766
|
+
* the mesh CA, is a client-auth end entity, has started, and is not on the CRL. Revocation stays the
|
|
86767
|
+
* kill switch.
|
|
86768
|
+
*/
|
|
86769
|
+
function chainsToCa(leaf, ca, now) {
|
|
86770
|
+
if (now < Date.parse(ca.validFrom) || now > Date.parse(ca.validTo)) return false;
|
|
86771
|
+
if (!leaf.checkIssued(ca)) return false;
|
|
86772
|
+
if (!leaf.verify(ca.publicKey)) return false;
|
|
86773
|
+
if (leaf.ca) return false;
|
|
86774
|
+
return (leaf.keyUsage ?? []).includes(require_constants$8.CLIENT_AUTH_OID);
|
|
86775
|
+
}
|
|
86776
|
+
function refused(reason, nodeId, detail) {
|
|
86777
|
+
return {
|
|
86778
|
+
admit: false,
|
|
86779
|
+
reason,
|
|
86780
|
+
nodeId,
|
|
86781
|
+
detail
|
|
86782
|
+
};
|
|
86783
|
+
}
|
|
86784
|
+
function judgeMeshPeerLeaf(input) {
|
|
86785
|
+
if (input.leafDer === void 0) return refused("no-certificate", null, "no client certificate");
|
|
86786
|
+
let leaf;
|
|
86787
|
+
let ca;
|
|
86788
|
+
try {
|
|
86789
|
+
leaf = new node_crypto.X509Certificate(input.leafDer);
|
|
86790
|
+
ca = new node_crypto.X509Certificate(input.caCertPem);
|
|
86791
|
+
} catch {
|
|
86792
|
+
return refused("not-chained", null, "unparseable certificate");
|
|
86793
|
+
}
|
|
86794
|
+
const nodeId = subjectCn(leaf.subject);
|
|
86795
|
+
if (nodeId === null || nodeId.length === 0) return refused("cn-mismatch", null, "leaf has no CN");
|
|
86796
|
+
const timeOnly = !input.authorized && input.authorizationError === "CERT_HAS_EXPIRED";
|
|
86797
|
+
if (!input.authorized && !timeOnly) return refused(input.authorizationError === "CERT_NOT_YET_VALID" ? "not-yet-valid" : "not-chained", nodeId, input.authorizationError ?? "unverified");
|
|
86798
|
+
if (timeOnly) {
|
|
86799
|
+
if (!chainsToCa(leaf, ca, input.now)) return refused("not-chained", nodeId, "expired and not signed by the mesh CA");
|
|
86800
|
+
if (input.now < Date.parse(leaf.validFrom)) return refused("not-yet-valid", nodeId, "leaf not valid yet");
|
|
86801
|
+
}
|
|
86802
|
+
const serial = leaf.serialNumber;
|
|
86803
|
+
if (input.crl.isRevoked(serial)) return refused("revoked", nodeId, `serial ${serial} is revoked`);
|
|
86804
|
+
if (timeOnly && !input.admitExpired) return refused("expired", nodeId, "leaf expired");
|
|
86805
|
+
return {
|
|
86806
|
+
admit: true,
|
|
86807
|
+
nodeId,
|
|
86808
|
+
serial,
|
|
86809
|
+
expired: timeOnly,
|
|
86810
|
+
notAfter: Date.parse(leaf.validTo)
|
|
86811
|
+
};
|
|
86812
|
+
}
|
|
86813
|
+
//#endregion
|
|
86746
86814
|
//#region src/kernel/moleculer/mesh-mtls/tls-tcp-transporter.ts
|
|
86747
86815
|
/**
|
|
86748
86816
|
* Moleculer TCP transporter with a mutual-TLS listener (D826, D848).
|
|
@@ -86860,6 +86928,8 @@ var TlsTcpTransporter = class extends TcpTransporterBase {
|
|
|
86860
86928
|
tlsServer = null;
|
|
86861
86929
|
meshTls;
|
|
86862
86930
|
crl;
|
|
86931
|
+
handshakeReporter;
|
|
86932
|
+
refusalLoggedAt = /* @__PURE__ */ new Map();
|
|
86863
86933
|
revokedPeerLoggedAt = /* @__PURE__ */ new Map();
|
|
86864
86934
|
tlsSockets = /* @__PURE__ */ new Set();
|
|
86865
86935
|
/** Node id (certificate CN) → serial of every peer that completed a mutual-TLS handshake. */
|
|
@@ -86882,6 +86952,7 @@ var TlsTcpTransporter = class extends TcpTransporterBase {
|
|
|
86882
86952
|
super({ ...opts });
|
|
86883
86953
|
this.meshTls = opts.meshTls ?? null;
|
|
86884
86954
|
this.crl = opts.crl ?? processMeshCrl();
|
|
86955
|
+
this.handshakeReporter = opts.handshakeReporter;
|
|
86885
86956
|
this.hubTlsOnly = opts.hubTlsOnly === true;
|
|
86886
86957
|
this.hubOnlyPeers = opts.hubOnlyPeers === true;
|
|
86887
86958
|
this.hubNodeId = opts.hubNodeId ?? DEFAULT_HUB_NODE_ID;
|
|
@@ -86958,10 +87029,11 @@ var TlsTcpTransporter = class extends TcpTransporterBase {
|
|
|
86958
87029
|
key: material.keyPem,
|
|
86959
87030
|
cert: material.certPem,
|
|
86960
87031
|
ca: [material.caCertPem],
|
|
86961
|
-
rejectUnauthorized:
|
|
87032
|
+
rejectUnauthorized: !self.hubTlsOnly,
|
|
86962
87033
|
minVersion: "TLSv1.3",
|
|
86963
87034
|
servername: nodeID,
|
|
86964
87035
|
checkServerIdentity: (hostname, cert) => {
|
|
87036
|
+
if (self.hubTlsOnly) return void 0;
|
|
86965
87037
|
const cn = typeof cert.subject === "object" && cert.subject !== null && "CN" in cert.subject ? String(cert.subject.CN ?? "") : "";
|
|
86966
87038
|
if (cn !== nodeID) return /* @__PURE__ */ new Error(`Mesh TLS peer CN '${cn}' does not match expected node '${nodeID}' (SNI=${hostname})`);
|
|
86967
87039
|
try {
|
|
@@ -86971,6 +87043,11 @@ var TlsTcpTransporter = class extends TcpTransporterBase {
|
|
|
86971
87043
|
}
|
|
86972
87044
|
}, () => {
|
|
86973
87045
|
const tlsSock = socket;
|
|
87046
|
+
if (self.hubTlsOnly && !self.judgeDialedServer(tlsSock, nodeID, material.caCertPem)) {
|
|
87047
|
+
tlsSock.destroy();
|
|
87048
|
+
reject(/* @__PURE__ */ new Error(`Mesh TLS server of '${nodeID}' refused by the hub`));
|
|
87049
|
+
return;
|
|
87050
|
+
}
|
|
86974
87051
|
tlsSock.nodeID = nodeID;
|
|
86975
87052
|
tlsSock.lastUsed = Date.now();
|
|
86976
87053
|
tlsSock.setNoDelay(true);
|
|
@@ -87120,9 +87197,42 @@ var TlsTcpTransporter = class extends TcpTransporterBase {
|
|
|
87120
87197
|
if (last !== void 0 && at - last < REVOKED_PEER_LOG_INTERVAL_MS) return;
|
|
87121
87198
|
if (this.revokedPeerLoggedAt.size >= 256) this.revokedPeerLoggedAt.clear();
|
|
87122
87199
|
this.revokedPeerLoggedAt.set(nodeId, at);
|
|
87123
|
-
this.
|
|
87124
|
-
|
|
87125
|
-
|
|
87200
|
+
this.reportWarn(`Mesh TLS peer presented a revoked certificate - ${action}`, nodeId, "revoked");
|
|
87201
|
+
}
|
|
87202
|
+
reporter() {
|
|
87203
|
+
return this.handshakeReporter ?? getProcessMeshHandshakeReporter();
|
|
87204
|
+
}
|
|
87205
|
+
/** A WARN that survives the transport log pin: the reporter when there is one, else the logger. */
|
|
87206
|
+
reportWarn(message, nodeId, reason, meta = {}) {
|
|
87207
|
+
const extras = {
|
|
87208
|
+
...nodeId !== null ? { tags: { nodeId } } : {},
|
|
87209
|
+
meta: {
|
|
87210
|
+
reason,
|
|
87211
|
+
...meta
|
|
87212
|
+
}
|
|
87213
|
+
};
|
|
87214
|
+
const reporter = this.reporter();
|
|
87215
|
+
if (reporter !== null) reporter.warn(message, extras);
|
|
87216
|
+
else this.logger.warn(message, extras);
|
|
87217
|
+
}
|
|
87218
|
+
/**
|
|
87219
|
+
* A refusal, once per window. Only `expired` carries a node id that was proven (the chain to the
|
|
87220
|
+
* mesh CA was checked); every other refusal is of a peer nobody vouched for, whose CN is whatever
|
|
87221
|
+
* it wrote. Those are keyed by remote address, and the claimed CN goes in `meta`, never in
|
|
87222
|
+
* `tags.nodeId` - a peer must not mint a log tag or a rate-limit key per CN.
|
|
87223
|
+
*/
|
|
87224
|
+
noteRefusedPeer(claimedCn, reason, detail, remoteAddress) {
|
|
87225
|
+
const proven = reason === "expired" && claimedCn !== null;
|
|
87226
|
+
const origin = remoteAddress?.replace(/^::ffff:/, "") ?? "unknown";
|
|
87227
|
+
const key = proven ? `node:${claimedCn}:${reason}` : `addr:${origin}:${reason}`;
|
|
87228
|
+
const at = Date.now();
|
|
87229
|
+
const last = this.refusalLoggedAt.get(key);
|
|
87230
|
+
if (last !== void 0 && at - last < REVOKED_PEER_LOG_INTERVAL_MS) return;
|
|
87231
|
+
if (this.refusalLoggedAt.size >= 256) this.refusalLoggedAt.clear();
|
|
87232
|
+
this.refusalLoggedAt.set(key, at);
|
|
87233
|
+
this.reportWarn(`Mesh TLS handshake refused (${reason}): ${detail}`, proven ? claimedCn : null, reason, proven ? { remoteAddress: origin } : {
|
|
87234
|
+
remoteAddress: origin,
|
|
87235
|
+
...claimedCn !== null ? { claimedNodeId: claimedCn } : {}
|
|
87126
87236
|
});
|
|
87127
87237
|
}
|
|
87128
87238
|
/** Close sockets whose peer serial was just revoked. */
|
|
@@ -87238,11 +87348,11 @@ var TlsTcpTransporter = class extends TcpTransporterBase {
|
|
|
87238
87348
|
cert: material.certPem,
|
|
87239
87349
|
ca: [material.caCertPem],
|
|
87240
87350
|
requestCert: true,
|
|
87241
|
-
rejectUnauthorized:
|
|
87351
|
+
rejectUnauthorized: false,
|
|
87242
87352
|
minVersion: "TLSv1.3"
|
|
87243
87353
|
}, (socket) => this.onTlsClientConnected(socket));
|
|
87244
|
-
server.on("tlsClientError", (err) => {
|
|
87245
|
-
this.
|
|
87354
|
+
server.on("tlsClientError", (err, failed) => {
|
|
87355
|
+
this.noteRefusedPeer(null, "handshake-failed", `TLS handshake failed: ${err.message}`, failed.remoteAddress);
|
|
87246
87356
|
});
|
|
87247
87357
|
server.on("error", (err) => {
|
|
87248
87358
|
this.logger.error("Mesh TLS server error.", err);
|
|
@@ -87262,20 +87372,69 @@ var TlsTcpTransporter = class extends TcpTransporterBase {
|
|
|
87262
87372
|
});
|
|
87263
87373
|
});
|
|
87264
87374
|
}
|
|
87265
|
-
|
|
87266
|
-
|
|
87267
|
-
|
|
87268
|
-
|
|
87269
|
-
|
|
87270
|
-
|
|
87375
|
+
/**
|
|
87376
|
+
* The hub let a peer in on a leaf that only expired: say so, and hand the node to the renewal,
|
|
87377
|
+
* which swaps it for the no-expiry leaf. The WARN is not rate limited - it is a recovery event.
|
|
87378
|
+
*/
|
|
87379
|
+
admitExpiredLeaf(nodeId, serial, notAfter) {
|
|
87380
|
+
this.reportWarn(`Mesh leaf of node '${nodeId}' expired ${new Date(notAfter).toISOString()} - admitted for recovery, renewing it`, nodeId, "expired");
|
|
87381
|
+
this.reporter()?.expiredLeafAdmitted?.({
|
|
87382
|
+
nodeId,
|
|
87383
|
+
serial,
|
|
87384
|
+
notAfter
|
|
87385
|
+
});
|
|
87386
|
+
}
|
|
87387
|
+
/**
|
|
87388
|
+
* The hub dialed a peer's TLS server: apply the verdict the inbound side applies (chain, CRL,
|
|
87389
|
+
* a leaf that only expired is admitted) plus the CN must be the node dialed. The expired
|
|
87390
|
+
* admission is not announced here: the peer's own inbound connection already hands the node to
|
|
87391
|
+
* the renewal, and a second trigger would only double the log line.
|
|
87392
|
+
*/
|
|
87393
|
+
judgeDialedServer(socket, nodeID, caCertPem) {
|
|
87394
|
+
const presented = socket.getPeerCertificate(true);
|
|
87395
|
+
const verdict = judgeMeshPeerLeaf({
|
|
87396
|
+
leafDer: presented != null && typeof presented === "object" && Buffer.isBuffer(presented.raw) ? presented.raw : void 0,
|
|
87397
|
+
authorized: socket.authorized,
|
|
87398
|
+
authorizationError: authorizationCodeOf(socket.authorizationError),
|
|
87399
|
+
caCertPem,
|
|
87400
|
+
crl: this.crl,
|
|
87401
|
+
admitExpired: true,
|
|
87402
|
+
now: Date.now()
|
|
87403
|
+
});
|
|
87404
|
+
if (!verdict.admit) {
|
|
87405
|
+
if (verdict.reason === "revoked") this.noteRevokedPeer(verdict.nodeId ?? nodeID, "refusing to dial it");
|
|
87406
|
+
else this.noteRefusedPeer(verdict.nodeId, verdict.reason, verdict.detail, socket.remoteAddress);
|
|
87407
|
+
return false;
|
|
87408
|
+
}
|
|
87409
|
+
if (verdict.nodeId !== nodeID) {
|
|
87410
|
+
this.noteRefusedPeer(verdict.nodeId, "cn-mismatch", `dialed '${nodeID}' but it presented '${verdict.nodeId}'`, socket.remoteAddress);
|
|
87411
|
+
return false;
|
|
87271
87412
|
}
|
|
87272
|
-
|
|
87273
|
-
|
|
87413
|
+
return true;
|
|
87414
|
+
}
|
|
87415
|
+
onTlsClientConnected(socket) {
|
|
87416
|
+
const presented = socket.getPeerCertificate(true);
|
|
87417
|
+
const verdict = judgeMeshPeerLeaf({
|
|
87418
|
+
leafDer: presented != null && typeof presented === "object" && Buffer.isBuffer(presented.raw) ? presented.raw : void 0,
|
|
87419
|
+
authorized: socket.authorized,
|
|
87420
|
+
authorizationError: authorizationCodeOf(socket.authorizationError),
|
|
87421
|
+
caCertPem: (this.meshTls ?? { caCertPem: "" }).caCertPem,
|
|
87422
|
+
crl: this.crl,
|
|
87423
|
+
admitExpired: this.hubTlsOnly,
|
|
87424
|
+
now: Date.now()
|
|
87425
|
+
});
|
|
87426
|
+
if (!verdict.admit) {
|
|
87427
|
+
if (verdict.reason === "revoked") this.noteRevokedPeer(verdict.nodeId ?? "unknown", "rejecting its connection");
|
|
87428
|
+
else this.noteRefusedPeer(verdict.nodeId, verdict.reason, verdict.detail, socket.remoteAddress);
|
|
87274
87429
|
socket.destroy();
|
|
87275
87430
|
return;
|
|
87276
87431
|
}
|
|
87432
|
+
const identity = {
|
|
87433
|
+
cn: verdict.nodeId,
|
|
87434
|
+
serial: verdict.serial
|
|
87435
|
+
};
|
|
87277
87436
|
if (this.hubOnlyPeers && identity.cn !== this.hubNodeId) {
|
|
87278
|
-
this.
|
|
87437
|
+
this.noteRefusedPeer(identity.cn, "cn-mismatch", `an enrolled agent accepts only '${this.hubNodeId}' (D848)`, socket.remoteAddress);
|
|
87279
87438
|
socket.destroy();
|
|
87280
87439
|
return;
|
|
87281
87440
|
}
|
|
@@ -87284,6 +87443,7 @@ var TlsTcpTransporter = class extends TcpTransporterBase {
|
|
|
87284
87443
|
this.tlsSockets.add(socket);
|
|
87285
87444
|
this.tlsPeers.set(identity.cn, identity.serial);
|
|
87286
87445
|
this.rememberPeerLeaf(identity.cn, socket);
|
|
87446
|
+
if (verdict.expired) this.admitExpiredLeaf(identity.cn, identity.serial, verdict.notAfter);
|
|
87287
87447
|
const reader = this.reader;
|
|
87288
87448
|
socket.on("close", () => {
|
|
87289
87449
|
this.tlsSockets.delete(socket);
|
|
@@ -87310,6 +87470,12 @@ var TlsTcpTransporter = class extends TcpTransporterBase {
|
|
|
87310
87470
|
});
|
|
87311
87471
|
}
|
|
87312
87472
|
};
|
|
87473
|
+
/** Node types the server-side `authorizationError` as an Error but sets the OpenSSL code name. */
|
|
87474
|
+
function authorizationCodeOf(error) {
|
|
87475
|
+
if (typeof error === "string") return error;
|
|
87476
|
+
if (error instanceof Error) return error.message;
|
|
87477
|
+
return null;
|
|
87478
|
+
}
|
|
87313
87479
|
function isTlsSocket(socket) {
|
|
87314
87480
|
return typeof socket.getPeerCertificate === "function" && typeof socket.encrypted === "boolean" && socket.encrypted === true;
|
|
87315
87481
|
}
|
|
@@ -89376,6 +89542,7 @@ exports.generateMeshCa = generateMeshCa;
|
|
|
89376
89542
|
exports.generateMeshKeyPair = generateMeshKeyPair;
|
|
89377
89543
|
exports.getProcessMeshCaState = getProcessMeshCaState;
|
|
89378
89544
|
exports.getProcessMeshCertificateRegistry = getProcessMeshCertificateRegistry;
|
|
89545
|
+
exports.getProcessMeshHandshakeReporter = getProcessMeshHandshakeReporter;
|
|
89379
89546
|
exports.getProcessMeshTlsListenerState = getProcessMeshTlsListenerState;
|
|
89380
89547
|
exports.getProcessNodeMeshTransport = getProcessNodeMeshTransport;
|
|
89381
89548
|
exports.getProcessPeerLeaf = getProcessPeerLeaf;
|
|
@@ -89403,6 +89570,7 @@ exports.renewMeshCertificate = renewMeshCertificate;
|
|
|
89403
89570
|
exports.requireProcessMeshCa = requireProcessMeshCa;
|
|
89404
89571
|
exports.revokeMeshCertificate = revokeMeshCertificate;
|
|
89405
89572
|
exports.setProcessMeshCertificateRegistry = setProcessMeshCertificateRegistry;
|
|
89573
|
+
exports.setProcessMeshHandshakeReporter = setProcessMeshHandshakeReporter;
|
|
89406
89574
|
exports.setProcessMeshPeerTransportLookup = setProcessMeshPeerTransportLookup;
|
|
89407
89575
|
exports.setProcessMeshTlsEnabler = setProcessMeshTlsEnabler;
|
|
89408
89576
|
exports.setProcessMeshTlsListenerState = setProcessMeshTlsListenerState;
|