@harperfast/harper 5.3.0 → 5.3.1
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/bin/copyDb.ts +5 -1
- package/bin/deployRenderer.ts +3 -0
- package/components/Application.ts +66 -22
- package/components/DESIGN.md +89 -36
- package/components/componentLoader.ts +2 -0
- package/components/deploymentRecorder.ts +18 -1
- package/components/installFingerprint.ts +123 -0
- package/components/mcp/DESIGN.md +4 -4
- package/components/operations.js +29 -0
- package/config/DESIGN.md +5 -5
- package/dataLayer/DESIGN.md +37 -22
- package/dataLayer/backupRepository.ts +248 -0
- package/dataLayer/restoreMarker.ts +30 -75
- package/dataLayer/rocksdbBackup.ts +253 -110
- package/dist/bin/copyDb.js +3 -0
- package/dist/bin/copyDb.js.map +1 -1
- package/dist/bin/deployRenderer.js +3 -0
- package/dist/bin/deployRenderer.js.map +1 -1
- package/dist/components/Application.d.ts +5 -0
- package/dist/components/Application.js +51 -19
- package/dist/components/Application.js.map +1 -1
- package/dist/components/componentLoader.js +2 -0
- package/dist/components/componentLoader.js.map +1 -1
- package/dist/components/deploymentRecorder.js +18 -1
- package/dist/components/deploymentRecorder.js.map +1 -1
- package/dist/components/installFingerprint.d.ts +39 -0
- package/dist/components/installFingerprint.js +113 -0
- package/dist/components/installFingerprint.js.map +1 -0
- package/dist/components/operations.d.ts +2 -0
- package/dist/components/operations.js +31 -0
- package/dist/components/operations.js.map +1 -1
- package/dist/dataLayer/backupRepository.d.ts +33 -0
- package/dist/dataLayer/backupRepository.js +232 -0
- package/dist/dataLayer/backupRepository.js.map +1 -0
- package/dist/dataLayer/restoreMarker.d.ts +4 -1
- package/dist/dataLayer/restoreMarker.js +29 -68
- package/dist/dataLayer/restoreMarker.js.map +1 -1
- package/dist/dataLayer/rocksdbBackup.js +221 -112
- package/dist/dataLayer/rocksdbBackup.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js.map +1 -1
- package/dist/json/systemSchema.json +14 -0
- package/dist/resources/DatabaseTransaction.d.ts +140 -11
- package/dist/resources/DatabaseTransaction.js +1055 -464
- package/dist/resources/DatabaseTransaction.js.map +1 -1
- package/dist/resources/IterableEventQueue.d.ts +2 -1
- package/dist/resources/IterableEventQueue.js +16 -8
- package/dist/resources/IterableEventQueue.js.map +1 -1
- package/dist/resources/LMDBTransaction.d.ts +13 -2
- package/dist/resources/LMDBTransaction.js +219 -93
- package/dist/resources/LMDBTransaction.js.map +1 -1
- package/dist/resources/RecordEncoder.js +2 -3
- package/dist/resources/RecordEncoder.js.map +1 -1
- package/dist/resources/Resource.js +5 -6
- package/dist/resources/Resource.js.map +1 -1
- package/dist/resources/ResourceInterface.d.ts +3 -1
- package/dist/resources/ResourceInterface.js.map +1 -1
- package/dist/resources/RocksIndexStore.d.ts +2 -1
- package/dist/resources/RocksIndexStore.js +3 -0
- package/dist/resources/RocksIndexStore.js.map +1 -1
- package/dist/resources/Table.js +116 -12
- package/dist/resources/Table.js.map +1 -1
- package/dist/resources/analytics/write.js +6 -2
- package/dist/resources/analytics/write.js.map +1 -1
- package/dist/resources/auditStore.d.ts +71 -17
- package/dist/resources/auditStore.js +248 -64
- package/dist/resources/auditStore.js.map +1 -1
- package/dist/resources/branchDatabase.js +2 -0
- package/dist/resources/branchDatabase.js.map +1 -1
- package/dist/resources/databases.js +8 -2
- package/dist/resources/databases.js.map +1 -1
- package/dist/resources/indexes/fullTextNativeBinding.d.ts +6 -2
- package/dist/resources/indexes/fullTextNativeBinding.js +12 -2
- package/dist/resources/indexes/fullTextNativeBinding.js.map +1 -1
- package/dist/resources/indexes/fullTextQueryIndex.d.ts +4 -0
- package/dist/resources/indexes/fullTextQueryIndex.js +207 -10
- package/dist/resources/indexes/fullTextQueryIndex.js.map +1 -1
- package/dist/resources/models/Models.d.ts +11 -0
- package/dist/resources/models/Models.js +95 -4
- package/dist/resources/models/Models.js.map +1 -1
- package/dist/resources/models/backendRegistry.d.ts +8 -0
- package/dist/resources/models/backendRegistry.js +15 -1
- package/dist/resources/models/backendRegistry.js.map +1 -1
- package/dist/resources/models/bootstrap.d.ts +2 -0
- package/dist/resources/models/bootstrap.js +6 -0
- package/dist/resources/models/bootstrap.js.map +1 -1
- package/dist/resources/models/calibration.d.ts +88 -0
- package/dist/resources/models/calibration.js +244 -0
- package/dist/resources/models/calibration.js.map +1 -0
- package/dist/resources/models/calibrationStore.d.ts +163 -0
- package/dist/resources/models/calibrationStore.js +986 -0
- package/dist/resources/models/calibrationStore.js.map +1 -0
- package/dist/resources/models/decisionStore.d.ts +24 -0
- package/dist/resources/models/decisionStore.js +45 -0
- package/dist/resources/models/decisionStore.js.map +1 -1
- package/dist/resources/models/generativeDecision.js +44 -15
- package/dist/resources/models/generativeDecision.js.map +1 -1
- package/dist/resources/models/types.d.ts +7 -0
- package/dist/resources/recordLock.d.ts +8 -5
- package/dist/resources/recordLock.js +6 -4
- package/dist/resources/recordLock.js.map +1 -1
- package/dist/resources/replayLogs.js +8 -1
- package/dist/resources/replayLogs.js.map +1 -1
- package/dist/resources/scheduler/engine.d.ts +4 -0
- package/dist/resources/scheduler/engine.js +30 -2
- package/dist/resources/scheduler/engine.js.map +1 -1
- package/dist/resources/search.d.ts +16 -4
- package/dist/resources/search.js +117 -13
- package/dist/resources/search.js.map +1 -1
- package/dist/resources/transaction.js +85 -5
- package/dist/resources/transaction.js.map +1 -1
- package/dist/resources/transactionBroadcast.d.ts +8 -0
- package/dist/resources/transactionBroadcast.js +65 -0
- package/dist/resources/transactionBroadcast.js.map +1 -1
- package/dist/security/keys.d.ts +1 -1
- package/dist/security/keys.js +170 -120
- package/dist/security/keys.js.map +1 -1
- package/dist/server/http.js +10 -0
- package/dist/server/http.js.map +1 -1
- package/dist/server/serverHelpers/Request.js +11 -2
- package/dist/server/serverHelpers/Request.js.map +1 -1
- package/dist/server/serverHelpers/contentTypes.js +8 -3
- package/dist/server/serverHelpers/contentTypes.js.map +1 -1
- package/dist/server/serverHelpers/uwsServer.js +38 -7
- package/dist/server/serverHelpers/uwsServer.js.map +1 -1
- package/dist/server/threads/manageThreads.d.ts +3 -3
- package/dist/server/threads/manageThreads.js +15 -13
- package/dist/server/threads/manageThreads.js.map +1 -1
- package/dist/server/threads/threadServer.d.ts +3 -0
- package/dist/server/threads/threadServer.js +24 -6
- package/dist/server/threads/threadServer.js.map +1 -1
- package/dist/upgrade/directives/5-3-0.js +9 -3
- package/dist/upgrade/directives/5-3-0.js.map +1 -1
- package/dist/utility/durableFile.d.ts +36 -0
- package/dist/utility/durableFile.js +106 -0
- package/dist/utility/durableFile.js.map +1 -0
- package/dist/utility/errors/hdbError.d.ts +4 -0
- package/dist/utility/errors/hdbError.js +10 -1
- package/dist/utility/errors/hdbError.js.map +1 -1
- package/dist/utility/globalSchema.d.ts +9 -0
- package/dist/utility/hdbTerms.d.ts +1 -0
- package/dist/utility/hdbTerms.js +1 -0
- package/dist/utility/hdbTerms.js.map +1 -1
- package/dist/validation/configValidator.js +29 -0
- package/dist/validation/configValidator.js.map +1 -1
- package/index.ts +7 -0
- package/json/systemSchema.json +14 -0
- package/npm-shrinkwrap.json +22 -22
- package/package.json +2 -2
- package/resources/DESIGN.md +57 -272
- package/resources/DatabaseTransaction.ts +708 -87
- package/resources/FULL_TEXT.md +6 -2
- package/resources/IterableEventQueue.ts +14 -7
- package/resources/LMDBTransaction.ts +212 -84
- package/resources/RecordEncoder.ts +2 -3
- package/resources/Resource.ts +5 -6
- package/resources/ResourceInterface.ts +3 -1
- package/resources/RocksIndexStore.ts +5 -0
- package/resources/Table.ts +118 -15
- package/resources/analytics/write.ts +6 -2
- package/resources/audit-retention.md +203 -0
- package/resources/auditStore.ts +306 -84
- package/resources/branchDatabase.ts +2 -0
- package/resources/databases.ts +6 -2
- package/resources/indexes/DESIGN.md +120 -177
- package/resources/indexes/fullTextNativeBinding.ts +22 -3
- package/resources/indexes/fullTextQueryIndex.ts +274 -11
- package/resources/models/DESIGN.md +11 -3
- package/resources/models/Models.ts +127 -4
- package/resources/models/backendRegistry.ts +17 -0
- package/resources/models/bootstrap.ts +9 -1
- package/resources/models/calibration.ts +298 -0
- package/resources/models/calibrationStore.ts +1167 -0
- package/resources/models/decisionStore.ts +57 -0
- package/resources/models/generativeDecision.ts +54 -16
- package/resources/models/types.ts +6 -0
- package/resources/record-locks.md +155 -141
- package/resources/recordLock.ts +12 -6
- package/resources/replayLogs.ts +9 -2
- package/resources/scheduler/DESIGN.md +4 -3
- package/resources/scheduler/engine.ts +35 -2
- package/resources/search.ts +154 -16
- package/resources/transaction.ts +50 -5
- package/resources/transactionBroadcast.ts +69 -0
- package/security/DESIGN.md +9 -30
- package/security/keys.ts +175 -127
- package/server/DESIGN.md +70 -36
- package/server/http.ts +10 -0
- package/server/serverHelpers/Request.ts +10 -2
- package/server/serverHelpers/contentTypes.ts +5 -3
- package/server/serverHelpers/uwsServer.ts +34 -7
- package/server/threads/manageThreads.js +16 -14
- package/server/threads/threadServer.js +24 -6
- package/studio/web/assets/{Chat-CNEKMllJ.js → Chat-4LMxI0yB.js} +1 -1
- package/studio/web/assets/{FloatingChat-CEnWhHeR.js → FloatingChat-kWHApEtF.js} +3 -3
- package/studio/web/assets/{SearchDialog-CwhJdEdY.js → SearchDialog-B7ymna97.js} +1 -1
- package/studio/web/assets/{apiToken-DC5vsaaO.js → apiToken-CE3AAt9f.js} +1 -1
- package/studio/web/assets/{applications-DQZxDy0x.js → applications-DdN7CqsB.js} +1 -1
- package/studio/web/assets/{cssMode-Dz2DxF4e.js → cssMode-BpySZUSt.js} +1 -1
- package/studio/web/assets/{editor-B3mjd3tz.js → editor-myLCVv9C.js} +1 -1
- package/studio/web/assets/{html-BsRGM7tp.js → html-DGNYO55O.js} +1 -1
- package/studio/web/assets/{htmlMode-tUKJaA3o.js → htmlMode-BUgpQr41.js} +1 -1
- package/studio/web/assets/{index-BuqFjN5K.js → index-FN4KC9va.js} +39 -39
- package/studio/web/assets/index-QLZw6xrU.css +1 -0
- package/studio/web/assets/{index.lazy-CcpfQFY_.js → index.lazy-DZFuaumG.js} +1 -1
- package/studio/web/assets/{javascript-BZ_uRGHl.js → javascript-DiBzh4pj.js} +1 -1
- package/studio/web/assets/{jsonMode-DgB-aFMj.js → jsonMode-Bm312nmu.js} +1 -1
- package/studio/web/assets/{languageServices-BleuBw17.js → languageServices-Dz2K9rZN.js} +1 -1
- package/studio/web/assets/{lspLanguageFeatures-ByVYLSsQ.js → lspLanguageFeatures-CNu1L5xn.js} +1 -1
- package/studio/web/assets/{notifications-TuzN0IMi.js → notifications--nwFLGmM.js} +1 -1
- package/studio/web/assets/{notifications-D1Nf-Edn.js → notifications-BelKw5bR.js} +1 -1
- package/studio/web/assets/{profile-D7C7Lupz.js → profile-AU5FjOBx.js} +1 -1
- package/studio/web/assets/{regions-nGQCm-v8.js → regions-C0sTSEHH.js} +1 -1
- package/studio/web/assets/{register-C3x9Ze6P.js → register-DyNR2rGk.js} +2 -2
- package/studio/web/assets/{setComponentFile-DpjrRqeG.js → setComponentFile-BkWx8AN3.js} +1 -1
- package/studio/web/assets/{setup-CGiKLZ9e.js → setup-D6LZS78d.js} +2 -2
- package/studio/web/assets/{status-CGJwrNPH.js → status-BCWnn70o.js} +1 -1
- package/studio/web/assets/{toggleHighContrast-C-Ne6P7T.js → toggleHighContrast-pyeGJ6W1.js} +1 -1
- package/studio/web/assets/{tsMode-CSreYTys.js → tsMode-CGV3iaWC.js} +1 -1
- package/studio/web/assets/{typescript-MnxBk89W.js → typescript-Ci7Khvwo.js} +1 -1
- package/studio/web/assets/{useEntityRestURL-TNrh77-s.js → useEntityRestURL-DNiz3aZ0.js} +1 -1
- package/studio/web/assets/{workers-BfZlUNVI.js → workers-byzxjbqy.js} +1 -1
- package/studio/web/assets/{xml-BHd6qGH7.js → xml-DGnHQ3CX.js} +1 -1
- package/studio/web/assets/{yaml-C53R8OQq.js → yaml-BUoTnPWb.js} +1 -1
- package/studio/web/index.html +2 -2
- package/upgrade/directives/5-3-0.ts +10 -3
- package/utility/durableFile.ts +96 -0
- package/utility/errors/hdbError.ts +9 -0
- package/utility/hdbTerms.ts +1 -0
- package/validation/configValidator.ts +31 -0
- package/studio/web/assets/index-72cEH474.css +0 -1
|
@@ -1,13 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addSubscription = addSubscription;
|
|
4
|
+
exports.endSubscriptionsFromEarlierHandles = endSubscriptionsFromEarlierHandles;
|
|
4
5
|
exports.listenToCommits = listenToCommits;
|
|
5
6
|
exports.whenNextTransaction = whenNextTransaction;
|
|
7
|
+
const node_path_1 = require("node:path");
|
|
6
8
|
const harper_logger_js_1 = require("../utility/logging/harper_logger.js");
|
|
9
|
+
const hdbError_ts_1 = require("../utility/errors/hdbError.js");
|
|
7
10
|
const IterableEventQueue_ts_1 = require("./IterableEventQueue.js");
|
|
8
11
|
const Resources_ts_1 = require("./Resources.js");
|
|
9
12
|
const allSubscriptions = Object.create(null); // using it as a map that doesn't change much
|
|
10
13
|
const allSameThreadSubscriptions = Object.create(null); // using it as a map that doesn't change much
|
|
14
|
+
// The handle each database path was last opened with on this thread, kept as a token so a retired database's closed
|
|
15
|
+
// store graph is not retained. A registration through any other handle would join the entry the current store's
|
|
16
|
+
// commits drive while reading through that handle's closed stores.
|
|
17
|
+
const HANDLE_TOKEN = Symbol('subscription-handle');
|
|
18
|
+
const currentHandles = new Map();
|
|
19
|
+
// A store with no generation (LMDB) is never replaced by a copy, so its reopen is only ever a close.
|
|
20
|
+
function generationChanged(generationId, currentId, tracksGeneration) {
|
|
21
|
+
return tracksGeneration && !(generationId != null && generationId === currentId);
|
|
22
|
+
}
|
|
23
|
+
function closingError(auditStore, path) {
|
|
24
|
+
return new hdbError_ts_1.DatabaseClosingError(auditStore?.rootStore?.databaseName ?? (0, node_path_1.basename)(path));
|
|
25
|
+
}
|
|
11
26
|
/**
|
|
12
27
|
* This module/function is responsible for the main work of tracking subscriptions and listening for new transactions
|
|
13
28
|
* that have occurred on any thread, and then reading through the transaction log to notify listeners. This is
|
|
@@ -27,6 +42,16 @@ function addSubscription(table, key, listener, startTime, options) {
|
|
|
27
42
|
if (!path) {
|
|
28
43
|
throw new Error('No path for table primary store');
|
|
29
44
|
}
|
|
45
|
+
const generationId = table.auditStore?.databaseGeneration?.id ?? null;
|
|
46
|
+
const current = currentHandles.get(path);
|
|
47
|
+
const replaced = current !== undefined && table.auditStore?.[HANDLE_TOKEN] !== current.token;
|
|
48
|
+
if (replaced || table.auditStore?.rootStore?.status === 'closed') {
|
|
49
|
+
if (options?.scope === 'full-database')
|
|
50
|
+
return;
|
|
51
|
+
throw replaced && generationChanged(generationId, current.generationId, current.tracksGeneration)
|
|
52
|
+
? new hdbError_ts_1.DatabaseGenerationChangedError()
|
|
53
|
+
: closingError(table.auditStore, path);
|
|
54
|
+
}
|
|
30
55
|
if (options?.crossThreads === false) {
|
|
31
56
|
// we are only listening for commits on our own thread, so we use a separate subscriber and sequencer tracker
|
|
32
57
|
databaseSubscriptions = allSameThreadSubscriptions[path] || (allSameThreadSubscriptions[path] = []);
|
|
@@ -66,6 +91,7 @@ function addSubscription(table, key, listener, startTime, options) {
|
|
|
66
91
|
}
|
|
67
92
|
}
|
|
68
93
|
databaseSubscriptions.auditStore = table.auditStore;
|
|
94
|
+
databaseSubscriptions.generationId ??= generationId;
|
|
69
95
|
if (databaseSubscriptions.lastTxnTime == null) {
|
|
70
96
|
databaseSubscriptions.lastTxnTime = Date.now();
|
|
71
97
|
}
|
|
@@ -96,6 +122,45 @@ function addSubscription(table, key, listener, startTime, options) {
|
|
|
96
122
|
databaseSubscriptions.activeCount = (databaseSubscriptions.activeCount || 0) + 1;
|
|
97
123
|
return subscription;
|
|
98
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* End every subscription this thread registered on the database before `auditStore` reopened it: its commit
|
|
127
|
+
* listener and its table's stores belong to the closed handle, so it can never deliver again. On a store that
|
|
128
|
+
* tracks generations, another or an unknown one must resynchronize; otherwise the retryable
|
|
129
|
+
* `DatabaseClosingError`. `auditStore` becomes the only handle `addSubscription` accepts on the path before
|
|
130
|
+
* any listener runs.
|
|
131
|
+
*/
|
|
132
|
+
function endSubscriptionsFromEarlierHandles(auditStore, tracksGeneration) {
|
|
133
|
+
const path = auditStore.rootStore.path;
|
|
134
|
+
const generationId = auditStore.databaseGeneration?.id;
|
|
135
|
+
const token = Symbol((0, node_path_1.basename)(path));
|
|
136
|
+
auditStore[HANDLE_TOKEN] = token;
|
|
137
|
+
currentHandles.set(path, { token, generationId, tracksGeneration });
|
|
138
|
+
for (const registry of [allSubscriptions, allSameThreadSubscriptions]) {
|
|
139
|
+
const databaseSubscriptions = registry[path];
|
|
140
|
+
if (!databaseSubscriptions)
|
|
141
|
+
continue;
|
|
142
|
+
delete registry[path];
|
|
143
|
+
const changed = generationChanged(databaseSubscriptions.generationId, generationId, tracksGeneration);
|
|
144
|
+
for (const tableId in databaseSubscriptions) {
|
|
145
|
+
const tableSubscriptions = databaseSubscriptions[tableId];
|
|
146
|
+
if (!(tableSubscriptions instanceof Map))
|
|
147
|
+
continue;
|
|
148
|
+
for (const keySubscriptions of tableSubscriptions.values()) {
|
|
149
|
+
for (const subscription of [...keySubscriptions]) {
|
|
150
|
+
try {
|
|
151
|
+
subscription.close(changed ? new hdbError_ts_1.DatabaseGenerationChangedError() : closingError(auditStore, path));
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
try {
|
|
155
|
+
(0, harper_logger_js_1.warn)(error);
|
|
156
|
+
}
|
|
157
|
+
catch { }
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
99
164
|
/**
|
|
100
165
|
* This is the class that is returned from subscribe calls and provide the interface to set a callback, end the
|
|
101
166
|
* subscription and get the initial state.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transactionBroadcast.js","sourceRoot":"","sources":["../../resources/transactionBroadcast.ts"],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AAU;IAC7C,IAAI,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC;QACjC,eAAe,CACd;YACC,YAAY,EAAE,UAAU;YACxB,UAAU;SACV,EACD,IAAI,EACJ,IAAI,EACJ,CAAC,EACD,EAAE,KAAK,EAAE,eAAe,EAAE,CAC1B,CAAC;QACF,eAAe,CAAC,UAAU,CAAC,CAAC;IAC7B,CAAC;IACD,OAAO,UAAU,CAAC,eAAe,CAAC;AACnC,CAAC"}
|
|
1
|
+
{"version":3,"file":"transactionBroadcast.js","sourceRoot":"","sources":["../../resources/transactionBroadcast.ts"],"names":[],"mappings":";;AAwCA,0CAqFC;AASD,gFA2BC;AA2OD,0CAkCC;AAUD,kDAeC;AAvcD,yCAAqC;AACrC,0EAA2D;AAC3D,+DAAqG;AACrG,mEAA6D;AAC7D,iDAAkD;AAGlD,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,6CAA6C;AAC3F,MAAM,0BAA0B,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,6CAA6C;AACrG,oHAAoH;AACpH,gHAAgH;AAChH,mEAAmE;AACnE,MAAM,YAAY,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;AACnD,MAAM,cAAc,GAAG,IAAI,GAAG,EAG3B,CAAC;AAEJ,qGAAqG;AACrG,SAAS,iBAAiB,CACzB,YAAuC,EACvC,SAAoC,EACpC,gBAAyB;IAEzB,OAAO,gBAAgB,IAAI,CAAC,CAAC,YAAY,IAAI,IAAI,IAAI,YAAY,KAAK,SAAS,CAAC,CAAC;AAClF,CAAC;AAED,SAAS,YAAY,CAAC,UAAe,EAAE,IAAY;IAClD,OAAO,IAAI,kCAAoB,CAAC,UAAU,EAAE,SAAS,EAAE,YAAY,IAAI,IAAA,oBAAQ,EAAC,IAAI,CAAC,CAAC,CAAC;AACxF,CAAC;AACD;;;;;;;;;GASG;AACH,SAAgB,eAAe,CAAC,KAAK,EA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AM,CAAC,qBAAqB,CAAC,CAAC,CAAC,uBAAuB;gBAC7D,CAAC;YACF,CAAC,CAAC;YACF,iCAAiC;YACjC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,qBAAqB,EAAE,YAAY,CAAC;gBAAE,OAAO;YAChE,YAAY,EAAE,CAAC;QAChB,CAAC,CAAC,CAAC;IACJ,CAAC;AACF,CAAC;AACD,SAAS,eAAe,CAAC,UAAU;IAClC,UAAU,CAAC,eAAe,EAAE,OAAO,EAAE,CAAC;IACtC,IAAI,WAAW,CAAC;IAChB,UAAU,CAAC,eAAe,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QACpD,WAAW,GAAG,OAAO,CAAC;IACvB,CAAC,CAAC,CAAC;IACH,UAAU,CAAC,eAAe,CAAC,OAAO,GAAG,WAAW,CAAC;AAClD,CAAC;AAED,SAAgB,mBAAmB,CAAC,UAAU;IAC7C,IAAI,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC;QACjC,eAAe,CACd;YACC,YAAY,EAAE,UAAU;YACxB,UAAU;SACV,EACD,IAAI,EACJ,IAAI,EACJ,CAAC,EACD,EAAE,KAAK,EAAE,eAAe,EAAE,CAC1B,CAAC;QACF,eAAe,CAAC,UAAU,CAAC,CAAC;IAC7B,CAAC;IACD,OAAO,UAAU,CAAC,eAAe,CAAC;AACnC,CAAC"}
|
package/dist/security/keys.d.ts
CHANGED
|
@@ -135,7 +135,7 @@ export declare function getEffectiveTlsCiphers(type: any, mtlsOptions?: any): st
|
|
|
135
135
|
* Create a TLS selector that will choose the best TLS configuration/context for a given hostname
|
|
136
136
|
* @param type
|
|
137
137
|
* @param mtlsOptions
|
|
138
|
-
* @param liveReload when true (default) the selector
|
|
138
|
+
* @param liveReload when true (default) the selector subscribes to certificate-table updates.
|
|
139
139
|
* Pass false for transient, single-use selectors (e.g. getReplicationCert) so they don't accumulate.
|
|
140
140
|
* @return {(function(*, *): (*|undefined))|*}
|
|
141
141
|
*/
|
package/dist/security/keys.js
CHANGED
|
@@ -80,7 +80,17 @@ const logger = (0, harper_logger_ts_1.forComponent)('tls').conditional;
|
|
|
80
80
|
const { CONFIG_PARAMS } = hdbTerms;
|
|
81
81
|
const { CERTIFICATE_VALUES } = certificatesTerms;
|
|
82
82
|
const nodeName_ts_1 = require("../server/nodeName.js");
|
|
83
|
-
const getPrivateKeys = () =>
|
|
83
|
+
const getPrivateKeys = () => {
|
|
84
|
+
for (const name of configuredPrivateKeyPaths.keys()) {
|
|
85
|
+
try {
|
|
86
|
+
getPrivateKeyByName(name);
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
(0, harper_logger_ts_1.forComponent)('tls').conditional.trace?.('Could not refresh configured private key:', name, error);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return privateKeys;
|
|
93
|
+
};
|
|
84
94
|
exports.getPrivateKeys = getPrivateKeys;
|
|
85
95
|
const node_fs_1 = require("node:fs");
|
|
86
96
|
const manageThreads_js_1 = require("../server/threads/manageThreads.js");
|
|
@@ -191,46 +201,14 @@ async function getReplicationCertAuth() {
|
|
|
191
201
|
}
|
|
192
202
|
let configuredCertsLoaded;
|
|
193
203
|
const privateKeys = new Map();
|
|
194
|
-
|
|
195
|
-
|
|
204
|
+
const configuredPrivateKeyPaths = new Map();
|
|
205
|
+
const filePrivateKeys = new Map();
|
|
196
206
|
const TLS_REBUILD_DEBOUNCE_MS = 1500;
|
|
197
207
|
// Self-retry backoff cap: a permanently bad record must not cost every selector on every
|
|
198
208
|
// thread a table scan + X509 parse per debounce interval, forever.
|
|
199
209
|
const TLS_FAILURE_RETRY_MAX_DELAY_MS = 300_000;
|
|
200
210
|
// While a failure signature is unchanged, repeat occurrences log a summary at most this often.
|
|
201
211
|
const TLS_FAILURE_SUMMARY_INTERVAL_MS = 3_600_000;
|
|
202
|
-
// Debounced rebuild triggers, one per live server TLS selector (registered in createTLSSelector's
|
|
203
|
-
// initialize). When a private key is hot-reloaded on this thread, every live selector re-runs
|
|
204
|
-
// updateTLS so a secure context built with a stale key — or built before this key arrived — is
|
|
205
|
-
// regenerated. Transient selectors (getReplicationCert) opt out so they don't accumulate here.
|
|
206
|
-
const liveTLSRebuilders = new Set();
|
|
207
|
-
/**
|
|
208
|
-
* Trigger a debounced rebuild of every live server's TLS secure contexts on this thread.
|
|
209
|
-
*
|
|
210
|
-
* Workers load their private key directly from disk into the privateKeys map (there is no table
|
|
211
|
-
* propagation for keys), so a key rotation must rebuild the secure contexts locally. The cert side
|
|
212
|
-
* already propagates via the hdb_certificate subscription; without this, a worker that rebuilt for
|
|
213
|
-
* the new cert before reloading the matching key would serve the new cert paired with the old key
|
|
214
|
-
* until the next cert-table change.
|
|
215
|
-
*/
|
|
216
|
-
function rebuildLiveTLSContexts() {
|
|
217
|
-
for (const scheduleRebuild of liveTLSRebuilders)
|
|
218
|
-
scheduleRebuild();
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* Handle a private-key (re)load: update the in-thread map and, on any content change, trigger a
|
|
222
|
-
* local TLS context rebuild. The `previous !== private_key` guard skips identical-content reloads
|
|
223
|
-
* (so neither chokidar nor the periodic poll thrashes) while still rebuilding when a key first
|
|
224
|
-
* appears or is restored after boot — the recovery case we must not strand. During normal startup
|
|
225
|
-
* this runs before any TLS selector is registered, so the rebuild is a harmless no-op on an empty
|
|
226
|
-
* rebuilder set.
|
|
227
|
-
*/
|
|
228
|
-
function handlePrivateKeyReload(private_key_name, private_key) {
|
|
229
|
-
const previous = privateKeys.get(private_key_name);
|
|
230
|
-
privateKeys.set(private_key_name, private_key);
|
|
231
|
-
if (previous !== private_key)
|
|
232
|
-
rebuildLiveTLSContexts();
|
|
233
|
-
}
|
|
234
212
|
/**
|
|
235
213
|
* This is responsible for loading any certificates that are in the harperdb-config.yaml file and putting them into the hdbCertificate table.
|
|
236
214
|
* @return {*}
|
|
@@ -256,12 +234,23 @@ function loadCertificates() {
|
|
|
256
234
|
// need to relativize the paths so they aren't exposed
|
|
257
235
|
let private_key_name = privateKeyPath && (0, node_path_1.relative)((0, node_path_1.join)(rootPath, 'keys'), privateKeyPath);
|
|
258
236
|
if (private_key_name) {
|
|
259
|
-
|
|
237
|
+
configuredPrivateKeyPaths.set(private_key_name, privateKeyPath);
|
|
238
|
+
try {
|
|
239
|
+
cacheFilePrivateKey(private_key_name, readPEM(privateKeyPath));
|
|
240
|
+
}
|
|
241
|
+
catch (error) {
|
|
242
|
+
(0, harper_logger_ts_1.forComponent)('tls').conditional.error?.('Error loading private key:', privateKeyPath, error);
|
|
243
|
+
}
|
|
260
244
|
}
|
|
261
245
|
for (let ca of [false, true]) {
|
|
262
246
|
let path = config[ca ? 'certificateAuthority' : 'certificate'];
|
|
263
247
|
if (path && worker_threads_1.isMainThread) {
|
|
264
|
-
|
|
248
|
+
let pendingPairTimer;
|
|
249
|
+
const reportPendingPair = () => {
|
|
250
|
+
(0, harper_logger_ts_1.forComponent)('tls').conditional.error?.(`TLS certificate at ${path} still has no matching private key at ${privateKeyPath}`);
|
|
251
|
+
pendingPairTimer = setTimeout(reportPendingPair, TLS_FAILURE_SUMMARY_INTERVAL_MS).unref();
|
|
252
|
+
};
|
|
253
|
+
loadAndWatch(path, (certificate, fileStats) => {
|
|
265
254
|
if (CERTIFICATE_VALUES.cert === certificate) {
|
|
266
255
|
// this is the compromised Harper certificate authority, and we do not even want to bother to
|
|
267
256
|
// load it or tempted to use it anywhere
|
|
@@ -270,7 +259,7 @@ function loadCertificates() {
|
|
|
270
259
|
let hostnames = config.hostname ?? config.hostnames ?? config.host ?? config.hosts;
|
|
271
260
|
if (hostnames && !Array.isArray(hostnames))
|
|
272
261
|
hostnames = [hostnames];
|
|
273
|
-
const certificatePem =
|
|
262
|
+
const certificatePem = certificate;
|
|
274
263
|
const x509Cert = new node_crypto_1.X509Certificate(certificatePem);
|
|
275
264
|
let certCn;
|
|
276
265
|
try {
|
|
@@ -287,14 +276,25 @@ function loadCertificates() {
|
|
|
287
276
|
// Check if cert issued by compromised Harper certificate authority, if it is, do not load it
|
|
288
277
|
if (x509Cert.checkIssued(new node_crypto_1.X509Certificate(CERTIFICATE_VALUES.cert)))
|
|
289
278
|
return;
|
|
290
|
-
//
|
|
291
|
-
// If cert file is newer, add it to table
|
|
292
|
-
// getSync (not get): this runs in a synchronous loadAndWatch callback. On RocksDB get()
|
|
293
|
-
// returns a Promise on a block-cache miss, which is truthy but has no timestamp fields,
|
|
294
|
-
// so the staleness guard below is bypassed and a stale on-disk cert can overwrite a
|
|
295
|
-
// newer replicated record (TLS churn / downgrade) once hdb_certificate evicts.
|
|
279
|
+
// The synchronous timestamp guard must not treat a cold RocksDB read Promise as a record.
|
|
296
280
|
const certRecord = certificateTable.primaryStore.getSync(certCn);
|
|
297
|
-
|
|
281
|
+
if (!ca && privateKeyPath) {
|
|
282
|
+
const privateKey = readPEM(privateKeyPath);
|
|
283
|
+
if (!x509Cert.checkPrivateKey((0, node_crypto_1.createPrivateKey)(privateKey))) {
|
|
284
|
+
if (!pendingPairTimer) {
|
|
285
|
+
(0, harper_logger_ts_1.forComponent)('tls').conditional.warn?.(`Waiting for matching TLS certificate and private key: ${path}, ${privateKeyPath}`);
|
|
286
|
+
if (!certRecord || certRecord.is_self_signed)
|
|
287
|
+
reportPendingPair();
|
|
288
|
+
else
|
|
289
|
+
pendingPairTimer = setTimeout(reportPendingPair, 30_000).unref();
|
|
290
|
+
}
|
|
291
|
+
return false;
|
|
292
|
+
}
|
|
293
|
+
cacheFilePrivateKey(private_key_name, privateKey);
|
|
294
|
+
clearTimeout(pendingPairTimer);
|
|
295
|
+
pendingPairTimer = undefined;
|
|
296
|
+
}
|
|
297
|
+
let fileTimestamp = fileStats.mtimeMs;
|
|
298
298
|
let recordTimestamp = !certRecord || certRecord.is_self_signed
|
|
299
299
|
? 1
|
|
300
300
|
: (certRecord.file_timestamp ?? certRecord.__updatedtime__);
|
|
@@ -303,7 +303,7 @@ function loadCertificates() {
|
|
|
303
303
|
logger.info?.(`Certificate ${certCn} at ${path} is older (${new Date(fileTimestamp)}) than the certificate in the database (${recordTimestamp > 1 ? new Date(recordTimestamp) : 'only self signed certificate available'})`);
|
|
304
304
|
return;
|
|
305
305
|
}
|
|
306
|
-
// Returned so loadAndWatch can roll back its
|
|
306
|
+
// Returned so loadAndWatch can roll back its fingerprint latch if the write fails —
|
|
307
307
|
// assigned as well to preserve loadCertificates()'s awaited-return contract.
|
|
308
308
|
return (promise = certificateTable.put({
|
|
309
309
|
name: certCn,
|
|
@@ -323,7 +323,7 @@ function loadCertificates() {
|
|
|
323
323
|
valid_to: x509Cert.validTo,
|
|
324
324
|
},
|
|
325
325
|
}));
|
|
326
|
-
}, ca ? 'certificate authority' : 'certificate');
|
|
326
|
+
}, ca ? 'certificate authority' : 'certificate', !ca && privateKeyPath ? [privateKeyPath] : []);
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
329
|
}
|
|
@@ -358,20 +358,12 @@ const certificateWatchTimers = new Map();
|
|
|
358
358
|
// re-read deterministically (simulating a missed inotify event) without waiting for the interval.
|
|
359
359
|
const certificateWatchPollers = new Map();
|
|
360
360
|
/**
|
|
361
|
-
*
|
|
362
|
-
*
|
|
363
|
-
* Two detection mechanisms feed the same reload path (and share the `lastModified` fingerprint,
|
|
364
|
-
* so they never double-reload for the same change):
|
|
365
|
-
* 1. chokidar inotify watcher — the fast path, reacts immediately to fs events.
|
|
366
|
-
* 2. A periodic re-read (main thread only) — a safety net for filesystems where inotify is
|
|
367
|
-
* unreliable (overlayfs/containers/network mounts), where a real renewal can otherwise be
|
|
368
|
-
* silently missed. Interval is tls.certificateWatchInterval (default 5m); 0 disables it.
|
|
369
|
-
* @param path
|
|
370
|
-
* @param loadCert
|
|
371
|
-
* @param type
|
|
361
|
+
* Watch the certificate and related files through filtered parent directories and the main-thread safety poll.
|
|
362
|
+
* A false loader result remains unapplied so an unchanged fingerprint can be retried.
|
|
372
363
|
*/
|
|
373
|
-
function loadAndWatch(path, loadCert, type) {
|
|
364
|
+
function loadAndWatch(path, loadCert, type, relatedPaths = []) {
|
|
374
365
|
let lastModified;
|
|
366
|
+
let lastAttempted;
|
|
375
367
|
const loadFile = (path, stats) => {
|
|
376
368
|
// The latch dedupes chokidar/poll but must mean "last successfully APPLIED", or a failed
|
|
377
369
|
// apply is deduplicated forever (#2382). Rollbacks are equality-guarded so an old failure
|
|
@@ -379,20 +371,31 @@ function loadAndWatch(path, loadCert, type) {
|
|
|
379
371
|
const previousModified = lastModified;
|
|
380
372
|
let modified;
|
|
381
373
|
try {
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
if (modified
|
|
387
|
-
if (lastModified && worker_threads_1.isMainThread)
|
|
374
|
+
const fileStats = stats ?? (0, node_fs_1.statSync)(path);
|
|
375
|
+
const fingerprints = [fileStats, ...relatedPaths.map((relatedPath) => (0, node_fs_1.statSync)(relatedPath))];
|
|
376
|
+
modified = JSON.stringify(fingerprints.map(({ mtimeMs, ino, size }) => [mtimeMs, ino, size]));
|
|
377
|
+
// Restoring an applied fingerprint after a failed attempt must clear the loader's pending state.
|
|
378
|
+
if (modified !== lastModified || modified !== lastAttempted) {
|
|
379
|
+
if (lastModified && modified !== lastAttempted && worker_threads_1.isMainThread)
|
|
388
380
|
logger.warn?.(`Reloading ${type}:`, path);
|
|
381
|
+
lastAttempted = modified;
|
|
389
382
|
lastModified = modified;
|
|
390
|
-
const
|
|
391
|
-
|
|
392
|
-
|
|
383
|
+
const rollback = () => {
|
|
384
|
+
if (lastModified === modified)
|
|
385
|
+
lastModified = previousModified === modified ? undefined : previousModified;
|
|
386
|
+
};
|
|
387
|
+
const applied = loadCert(readPEM(path), fileStats);
|
|
388
|
+
if (applied === false)
|
|
389
|
+
rollback();
|
|
390
|
+
else if (typeof applied?.then === 'function') {
|
|
391
|
+
applied
|
|
392
|
+
.then((result) => {
|
|
393
|
+
if (result === false)
|
|
394
|
+
rollback();
|
|
395
|
+
})
|
|
396
|
+
.catch((error) => {
|
|
393
397
|
logger.error?.(`Error applying ${type}:`, path, error);
|
|
394
|
-
|
|
395
|
-
lastModified = previousModified;
|
|
398
|
+
rollback();
|
|
396
399
|
});
|
|
397
400
|
}
|
|
398
401
|
}
|
|
@@ -400,55 +403,81 @@ function loadAndWatch(path, loadCert, type) {
|
|
|
400
403
|
catch (error) {
|
|
401
404
|
logger.error?.(`Error loading ${type}:`, path, error);
|
|
402
405
|
if (modified !== undefined && lastModified === modified)
|
|
403
|
-
lastModified = previousModified;
|
|
406
|
+
lastModified = previousModified === modified ? undefined : previousModified;
|
|
404
407
|
}
|
|
405
408
|
};
|
|
406
409
|
if (fs.existsSync(path))
|
|
407
410
|
loadFile(path, (0, node_fs_1.statSync)(path));
|
|
408
411
|
else
|
|
409
412
|
logger.error?.(`${type} file not found:`, path);
|
|
410
|
-
const
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
413
|
+
const watchedDirectories = new Map();
|
|
414
|
+
for (const filePath of [path, ...relatedPaths]) {
|
|
415
|
+
const target = (0, watchPath_ts_1.resolveWatchTarget)(filePath);
|
|
416
|
+
const directory = (0, watchPath_ts_1.resolveWatchTarget)((0, node_path_1.dirname)(target.path));
|
|
417
|
+
let watched = watchedDirectories.get(directory.path);
|
|
418
|
+
if (!watched)
|
|
419
|
+
watchedDirectories.set(directory.path, (watched = { mustPoll: target.mustPoll || directory.mustPoll, files: new Set() }));
|
|
420
|
+
watched.files.add((0, node_path_1.resolve)(target.path));
|
|
421
|
+
}
|
|
422
|
+
for (const [directory, watched] of watchedDirectories) {
|
|
423
|
+
let usingPolling = watched.mustPoll;
|
|
424
|
+
let pollingFiles = false;
|
|
425
|
+
let liveWatcher;
|
|
426
|
+
const openWatcher = () => {
|
|
427
|
+
const opened = (liveWatcher = (0, watcherFallback_ts_1.guardedWatch)(directory, {
|
|
428
|
+
persistent: false,
|
|
429
|
+
depth: 0,
|
|
430
|
+
ignoreInitial: true,
|
|
431
|
+
ignored: (filePath) => {
|
|
432
|
+
const resolved = (0, node_path_1.resolve)(filePath);
|
|
433
|
+
return resolved !== (0, node_path_1.resolve)(directory) && !watched.files.has(resolved);
|
|
434
|
+
},
|
|
435
|
+
...(usingPolling ? watcherFallback_ts_1.POLLING_FALLBACK_OPTIONS : {}),
|
|
436
|
+
}));
|
|
437
|
+
const reload = () => loadFile(path);
|
|
438
|
+
const reopen = () => Promise.resolve()
|
|
439
|
+
.then(() => opened.close())
|
|
440
|
+
.catch(() => { })
|
|
441
|
+
.then(openWatcher)
|
|
442
|
+
.catch((error) => logger.error?.(`Could not reopen the ${type} watch on polling:`, directory, error));
|
|
443
|
+
opened
|
|
444
|
+
.on('add', reload)
|
|
445
|
+
.on('change', reload)
|
|
446
|
+
.on('error', (error) => {
|
|
447
|
+
if ((0, watcherFallback_ts_1.claimLostNativeWatchError)(error))
|
|
428
448
|
return;
|
|
429
|
-
(
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
.
|
|
434
|
-
|
|
435
|
-
.
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
449
|
+
if (pollingFiles || liveWatcher !== opened)
|
|
450
|
+
return;
|
|
451
|
+
const errorCode = error.code;
|
|
452
|
+
if (errorCode === 'EACCES' || errorCode === 'EPERM') {
|
|
453
|
+
(0, harper_logger_ts_1.forComponent)('tls').conditional.warn?.(`Cannot watch TLS directory ${directory}; polling its configured files instead`, error);
|
|
454
|
+
pollingFiles = true;
|
|
455
|
+
Promise.resolve()
|
|
456
|
+
.then(() => opened.close())
|
|
457
|
+
.catch(() => { });
|
|
458
|
+
// watchFile stays armed across ENOENT without needing to list the unreadable parent.
|
|
459
|
+
for (const file of watched.files)
|
|
460
|
+
(0, node_fs_1.watchFile)(file, { persistent: false, interval: watcherFallback_ts_1.POLLING_FALLBACK_OPTIONS.interval }, (stats) => {
|
|
461
|
+
if (stats.nlink)
|
|
462
|
+
reload();
|
|
463
|
+
});
|
|
464
|
+
reload();
|
|
465
|
+
return;
|
|
466
|
+
}
|
|
467
|
+
if ((0, watcherFallback_ts_1.isWatcherExhaustionError)(error)) {
|
|
468
|
+
if (usingPolling || liveWatcher !== opened)
|
|
469
|
+
return;
|
|
470
|
+
(0, watcherFallback_ts_1.warnWatcherFallback)(directory);
|
|
471
|
+
usingPolling = true;
|
|
472
|
+
reopen();
|
|
473
|
+
return;
|
|
474
|
+
}
|
|
475
|
+
logger.error?.(`Error watching ${type}:`, path, error);
|
|
476
|
+
});
|
|
477
|
+
};
|
|
478
|
+
openWatcher();
|
|
479
|
+
}
|
|
480
|
+
if (worker_threads_1.isMainThread) {
|
|
452
481
|
const poll = () => {
|
|
453
482
|
let stats;
|
|
454
483
|
try {
|
|
@@ -628,7 +657,15 @@ async function getCertAuthority() {
|
|
|
628
657
|
for (let cert of allCerts) {
|
|
629
658
|
if (!cert.is_authority)
|
|
630
659
|
continue;
|
|
631
|
-
|
|
660
|
+
let matchingPrivateKey;
|
|
661
|
+
try {
|
|
662
|
+
matchingPrivateKey = getPrivateKeyByName(cert.private_key_name);
|
|
663
|
+
}
|
|
664
|
+
catch (error) {
|
|
665
|
+
if (error.code !== 'ENOENT')
|
|
666
|
+
throw error;
|
|
667
|
+
continue;
|
|
668
|
+
}
|
|
632
669
|
if (cert.private_key_name && matchingPrivateKey) {
|
|
633
670
|
const keyCheck = new node_crypto_1.X509Certificate(cert.certificate).checkPrivateKey((0, node_crypto_1.createPrivateKey)(matchingPrivateKey));
|
|
634
671
|
if (keyCheck) {
|
|
@@ -999,7 +1036,7 @@ function getEffectiveTlsCiphers(type, mtlsOptions) {
|
|
|
999
1036
|
* Create a TLS selector that will choose the best TLS configuration/context for a given hostname
|
|
1000
1037
|
* @param type
|
|
1001
1038
|
* @param mtlsOptions
|
|
1002
|
-
* @param liveReload when true (default) the selector
|
|
1039
|
+
* @param liveReload when true (default) the selector subscribes to certificate-table updates.
|
|
1003
1040
|
* Pass false for transient, single-use selectors (e.g. getReplicationCert) so they don't accumulate.
|
|
1004
1041
|
* @return {(function(*, *): (*|undefined))|*}
|
|
1005
1042
|
*/
|
|
@@ -1410,7 +1447,7 @@ function createTLSSelector(type, mtlsOptions, liveReload = true) {
|
|
|
1410
1447
|
// use the same verifies-client-certs flag the listener was created with (http servers
|
|
1411
1448
|
// derive it from more than the selector's mtlsOptions) so this compares like with like
|
|
1412
1449
|
const effectiveCiphers = getEffectiveTlsCiphers(type, server.verifiesClientCerts ?? Boolean(mtlsOptions)) ?? null;
|
|
1413
|
-
// latch per distinct value: rebuilds recur (cert-table changes,
|
|
1450
|
+
// latch per distinct value: rebuilds recur (cert-table changes, failure retries) and the
|
|
1414
1451
|
// pending change shouldn't re-warn on every cycle until the restart happens
|
|
1415
1452
|
if (effectiveCiphers !== server.appliedCiphers && server.lastWarnedCiphers !== effectiveCiphers) {
|
|
1416
1453
|
server.lastWarnedCiphers = effectiveCiphers;
|
|
@@ -1439,11 +1476,6 @@ function createTLSSelector(type, mtlsOptions, liveReload = true) {
|
|
|
1439
1476
|
updateTLS();
|
|
1440
1477
|
}, TLS_REBUILD_DEBOUNCE_MS).unref();
|
|
1441
1478
|
};
|
|
1442
|
-
// Register the private-key hot-reload rebuild path unconditionally, before the first
|
|
1443
|
-
// updateTLS() pass: that pass may find the system database not yet loaded and retry
|
|
1444
|
-
// (see above) rather than subscribe, so this must not depend on it succeeding.
|
|
1445
|
-
if (liveReload)
|
|
1446
|
-
liveTLSRebuilders.add(scheduleRebuild);
|
|
1447
1479
|
updateTLS();
|
|
1448
1480
|
}));
|
|
1449
1481
|
};
|
|
@@ -1485,8 +1517,26 @@ function createTLSSelector(type, mtlsOptions, liveReload = true) {
|
|
|
1485
1517
|
cb(null, context);
|
|
1486
1518
|
}
|
|
1487
1519
|
}
|
|
1520
|
+
function cacheFilePrivateKey(name, key) {
|
|
1521
|
+
if (!privateKeys.has(name) || privateKeys.get(name) === filePrivateKeys.get(name))
|
|
1522
|
+
privateKeys.set(name, key);
|
|
1523
|
+
filePrivateKeys.set(name, key);
|
|
1524
|
+
return privateKeys.get(name);
|
|
1525
|
+
}
|
|
1488
1526
|
function getPrivateKeyByName(private_key_name) {
|
|
1489
1527
|
const private_key = privateKeys.get(private_key_name);
|
|
1528
|
+
const configuredPath = configuredPrivateKeyPaths.get(private_key_name);
|
|
1529
|
+
if (configuredPath && (!private_key || private_key === filePrivateKeys.get(private_key_name))) {
|
|
1530
|
+
try {
|
|
1531
|
+
return cacheFilePrivateKey(private_key_name, readPEM(configuredPath));
|
|
1532
|
+
}
|
|
1533
|
+
catch (error) {
|
|
1534
|
+
if (!private_key)
|
|
1535
|
+
throw error;
|
|
1536
|
+
(0, harper_logger_ts_1.forComponent)('tls').conditional.trace?.('Could not refresh configured private key:', private_key_name, error);
|
|
1537
|
+
return private_key;
|
|
1538
|
+
}
|
|
1539
|
+
}
|
|
1490
1540
|
if (!private_key && private_key_name) {
|
|
1491
1541
|
return fs.readFileSync(path.join(envManager.get(CONFIG_PARAMS.ROOTPATH), hdbTerms.LICENSE_KEY_DIR_NAME, private_key_name), 'utf8');
|
|
1492
1542
|
}
|