iobroker.eos-admin 8.0.0 → 8.0.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/NEXOWATT_EOS_BUILD_INFO.json +7 -6
- package/NEXOWATT_EOS_PREBUILT_MANIFEST.json +133 -51
- package/START_HERE_8.0.1.md +36 -0
- package/adminWww/.vite/manifest.json +39 -39
- package/adminWww/NEXOWATT_EOS_FRONTEND_MANIFEST.json +107 -107
- package/adminWww/assets/{AdapterUpdateDialog-B3y8RL_5.js → AdapterUpdateDialog-D3y2bGHM.js} +1 -1
- package/adminWww/assets/{Adapters-BDxfhfGe.js → Adapters-WMGNQt7g.js} +1 -1
- package/adminWww/assets/{ConfigManager-CFuOc_kb.js → ConfigManager-BMdQoiCg.js} +1 -1
- package/adminWww/assets/{Enums-CSzSzWm7.js → Enums-CHm2sGa-.js} +1 -1
- package/adminWww/assets/{Fields-DnckPMA8.js → Fields-Df7Llf6U.js} +1 -1
- package/adminWww/assets/{Files-CwUHx0pF.js → Files-Bwbw17Fb.js} +1 -1
- package/adminWww/assets/{Hosts-QkyuASJy.js → Hosts-BR0g-Wxo.js} +1 -1
- package/adminWww/assets/{Instances-BaWBemTT.js → Instances-BKydFSdw.js} +1 -1
- package/adminWww/assets/{Intro-DsfrPrWv.js → Intro-Dt2GzmtW.js} +1 -1
- package/adminWww/assets/{Logs-Cngy2Opt.js → Logs-hbcdBDN3.js} +1 -1
- package/adminWww/assets/{Objects-DY8KS7zK.js → Objects-HPx0yuOk.js} +1 -1
- package/adminWww/assets/{Overview-WwP6FjK-.js → Overview-CDvnM655.js} +1 -1
- package/adminWww/assets/{State-vP1o2BCL.js → State-Cc-tyuqB.js} +1 -1
- package/adminWww/assets/{UsedResources-CMTzFOX3.js → UsedResources-BIdU7UPm.js} +1 -1
- package/adminWww/assets/{Users-BjTGOjzL.js → Users-BruHA-yU.js} +1 -1
- package/adminWww/assets/{bootstrap-Bs4TZ7iA.js → bootstrap-D-7xcwTc.js} +3 -3
- package/adminWww/assets/{hostInit-2xIZYDSq.js → hostInit-huY-0clu.js} +1 -1
- package/adminWww/assets/{icons-material-BLgrEUSv.js → icons-material-Bu1f45BT.js} +1 -1
- package/adminWww/assets/{index-BZifaJHi.js → index-D8vmzGp8.js} +2 -2
- package/adminWww/assets/{installSVGRenderer-Pe6-VnD2.js → installSVGRenderer-BkdptYag.js} +1 -1
- package/adminWww/assets/{mf-entry-bootstrap-0-a6a54377.js → mf-entry-bootstrap-0-f6098d8b.js} +2 -2
- package/adminWww/index.html +21 -21
- package/adminWww/mf-manifest.json +1 -1
- package/adminWww/mf-stats.json +1 -1
- package/adminWww/{remoteEntry-eos-8.0.0.js → remoteEntry-eos-8.0.1.js} +1 -1
- package/adminWww/remoteEntry.js +1 -1
- package/build/lib/eosSessionSecurity.js +12 -4
- package/build/lib/eosSessionSecurity.js.map +1 -1
- package/build/lib/vendor/webserver/LICENSE +21 -0
- package/build/lib/vendor/webserver/README.md +506 -0
- package/build/lib/vendor/webserver/build/index.d.ts +9 -0
- package/build/lib/vendor/webserver/build/index.js +42 -0
- package/build/lib/vendor/webserver/build/index.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/acmeChallenge.d.ts +65 -0
- package/build/lib/vendor/webserver/build/lib/acmeChallenge.js +149 -0
- package/build/lib/vendor/webserver/build/lib/acmeChallenge.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/certificateManager.d.ts +60 -0
- package/build/lib/vendor/webserver/build/lib/certificateManager.js +128 -0
- package/build/lib/vendor/webserver/build/lib/certificateManager.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/http2Compat.d.ts +21 -0
- package/build/lib/vendor/webserver/build/lib/http2Compat.js +109 -0
- package/build/lib/vendor/webserver/build/lib/http2Compat.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/oauth2-authcode.d.ts +167 -0
- package/build/lib/vendor/webserver/build/lib/oauth2-authcode.js +619 -0
- package/build/lib/vendor/webserver/build/lib/oauth2-authcode.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/oauth2-clients.d.ts +92 -0
- package/build/lib/vendor/webserver/build/lib/oauth2-clients.js +230 -0
- package/build/lib/vendor/webserver/build/lib/oauth2-clients.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/oauth2-model.d.ts +84 -0
- package/build/lib/vendor/webserver/build/lib/oauth2-model.js +388 -0
- package/build/lib/vendor/webserver/build/lib/oauth2-model.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/oauth2.d.ts +75 -0
- package/build/lib/vendor/webserver/build/lib/oauth2.js +625 -0
- package/build/lib/vendor/webserver/build/lib/oauth2.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/securityChecker.d.ts +6 -0
- package/build/lib/vendor/webserver/build/lib/securityChecker.js +96 -0
- package/build/lib/vendor/webserver/build/lib/securityChecker.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/usedResources.d.ts +62 -0
- package/build/lib/vendor/webserver/build/lib/usedResources.js +231 -0
- package/build/lib/vendor/webserver/build/lib/usedResources.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/utils.d.ts +35 -0
- package/build/lib/vendor/webserver/build/lib/utils.js +110 -0
- package/build/lib/vendor/webserver/build/lib/utils.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/webServer.d.ts +164 -0
- package/build/lib/vendor/webserver/build/lib/webServer.js +454 -0
- package/build/lib/vendor/webserver/build/lib/webServer.js.map +1 -0
- package/build/lib/vendor/webserver/package.json +63 -0
- package/build/lib/web.js +1 -1
- package/build/lib/web.js.map +1 -1
- package/docs/ADMIN8_MIGRATION_8.0.0_DE.md +2 -0
- package/docs/cra/CRA_IEC_GAP_ANALYSIS_2026-09-30.md +5 -0
- package/docs/security/admin8-2026-11-04/development-1.log +3 -3
- package/docs/security/admin8-2026-11-04/development-2.log +248 -233
- package/docs/security/admin8-2026-11-05/copy-update/evidence-sha256.json +0 -5
- package/docs/security/admin8-2026-11-05/login-fix/BACKEND_DIAGNOSE_DE.md +48 -0
- package/docs/security/admin8-2026-11-05/login-fix/REPORT_DE.md +47 -0
- package/docs/security/admin8-2026-11-05/login-fix/REVIEW_DE.md +7 -0
- package/docs/security/admin8-2026-11-05/login-fix/controller-adapter-api.ts.txt +122 -0
- package/docs/security/admin8-2026-11-05/login-fix/controller-file-view.ts.txt +75 -0
- package/docs/security/admin8-2026-11-05/login-fix/controller-redis-view.ts.txt +471 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/LICENSE-webserver-3.4.0 +21 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/REPORT_DE.md +41 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/evidence-sha256.json +116 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/http-consumer-check.cjs +58 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/README_DE.md +9 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/REJECTED-webserver-3.4.0-eos-oauth.provenance.json +263 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/REJECTED-webserver-3.4.0-eos-oauth.tgz +0 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/admission.log +16 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/consumer-audit-stderr.log +1 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/consumer-audit.json +22 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/consumer-fixture-1.0.0.tgz +0 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/consumer-fixture-package.json +11 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/consumer-npm10-package-lock.json +387 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/consumer-npm11-package-lock.json +387 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/evidence-sha256.json +85 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/http-consumer-npm10-node22.json +11 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/http-consumer-npm11-node24.json +11 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/local-tests.json +38 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/tests-node22.log +168 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/tests-node24.log +36 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/source-vendor-tests-node22.log +224 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/source-vendor-tests-node24.log +42 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/source-vendor-tests.json +31 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/webserver-3.4.0-upstream.tgz +0 -0
- package/docs/security/admin8-2026-11-05/login-fix/eos-session-8.0.0.js.txt +385 -0
- package/docs/security/admin8-2026-11-05/login-fix/evidence-sha256.json +59 -0
- package/docs/security/admin8-2026-11-05/login-fix/path-budget.json +6 -0
- package/docs/security/admin8-2026-11-05/login-fix/provenance.json +51 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/admission.log +21 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/archive-scan.json +13 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/artifacts.log +6 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/backend-build.log +5 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/consumer-package-lock.json +3258 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/copy-update-journal.json +165 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/development.log +365 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/frontend-build.log +149 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/full-consumer-audit.json +22 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/full-consumer-audit.stderr +2 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/full-consumer-final-install-node22.log +9 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/full-consumer-http-node22.json +15 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/full-consumer-http-node22.stderr +2 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/full-consumer-http-node24.json +15 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/full-consumer-http-node24.stderr +0 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/inventory.log +8 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/npm-pack-final.json +7809 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/npm-pack-final.stderr +6 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/overlay-final-publish-node22.json +10213 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/overlay-final-publish-node22.stderr +282 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/pipeline.json +72 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/seal.log +6 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/vendor-final-review-node24.log +18 -0
- package/docs/security/admin8-2026-11-05/login-fix/reproduce.cjs +79 -0
- package/docs/security/admin8-2026-11-05/login-fix/reproduction.json +80 -0
- package/docs/security/admin8-2026-11-05/login-fix/upstream-LICENSE.txt +22 -0
- package/docs/security/admin8-2026-11-05/login-fix/validation.json +85 -0
- package/docs/third-party/admin8/NOTICE-PROVENANCE.json +3 -3
- package/io-package.json +9 -10
- package/package.json +9 -4
- package/release-manifests/admin8-development-validation.json +114 -31
- package/reports/security/artifact-inventory.json +462 -227
- package/reports/security/inventory-summary.json +39 -17
- package/reports/security/sbom-backend-lock.cdx.json +108 -111
- package/reports/security/sbom-frontend-lock.cdx.json +5 -5
- package/reports/security/source-runtime-manifest.json +455 -65
- package/tools/nexowatt-artifact-inventory.cjs +8 -1
- package/tools/nexowatt-installer-ems-selftest.cjs +1 -1
- package/tools/nexowatt-lock-provenance-check.cjs +8 -3
- package/tools/nexowatt-repair-lock-metadata.cjs +3 -3
- package/tools/nexowatt-security-inventory.cjs +22 -1
- package/tools/nexowatt-user-area-selftest.cjs +1 -1
- package/tools/nexowatt-v7109-clean-core-selftest.cjs +1 -1
- package/tools/nexowatt-vendored-webserver.cjs +69 -0
- package/tools/vendor/eos-retired-release-files.json +73 -1
- package/tools/vendor/webserver-3.4.0-source.provenance.json +244 -0
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import tls from 'node:tls';
|
|
2
|
+
import http from 'node:http';
|
|
3
|
+
import https from 'node:https';
|
|
4
|
+
import http2 from 'node:http2';
|
|
5
|
+
export interface WebServerAccessControl {
|
|
6
|
+
/** Access-Control-Allow-Headers */
|
|
7
|
+
accessControlAllowHeaders?: string;
|
|
8
|
+
/** Access-Control-Allow-Methods */
|
|
9
|
+
accessControlAllowMethods?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Access-Control-Allow-Origin: either a literal value (`*` or one concrete origin) or a
|
|
12
|
+
* function picking one for the origin of the incoming request - `origin => origin` reflects
|
|
13
|
+
* it back, which is what a configuration that allows every origin with credentials needs.
|
|
14
|
+
*/
|
|
15
|
+
accessControlAllowOrigin?: string | ((origin: string | undefined) => string | undefined);
|
|
16
|
+
/** Access-Control-Expose-Headers */
|
|
17
|
+
accessControlExposeHeaders?: string;
|
|
18
|
+
/** Access-Control-Max-Age, in seconds: how long a browser may cache the preflight result */
|
|
19
|
+
accessControlMaxAge?: number;
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated `Access-Control-Request-Headers` is what the browser sends in a preflight; as a
|
|
22
|
+
* response header it has no effect. Only used as a fallback for {@link accessControlAllowHeaders}.
|
|
23
|
+
*/
|
|
24
|
+
accessControlRequestHeaders?: string;
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated `Access-Control-Request-Method` is what the browser sends in a preflight; as a
|
|
27
|
+
* response header it has no effect. Only used as a fallback for {@link accessControlAllowMethods}.
|
|
28
|
+
*/
|
|
29
|
+
accessControlRequestMethod?: string;
|
|
30
|
+
/** Access-Control-Allow-Credentials */
|
|
31
|
+
accessControlAllowCredentials?: boolean;
|
|
32
|
+
}
|
|
33
|
+
interface WebServerOptions<Http2 extends boolean> {
|
|
34
|
+
/** the ioBroker adapter */
|
|
35
|
+
adapter: ioBroker.Adapter;
|
|
36
|
+
app?: http.RequestListener | null;
|
|
37
|
+
/** if https should be used */
|
|
38
|
+
secure: boolean | undefined;
|
|
39
|
+
/** access control options */
|
|
40
|
+
accessControl?: WebServerAccessControl;
|
|
41
|
+
/**
|
|
42
|
+
* Answer ACME HTTP-01 challenges published by the acme adapter, so it does
|
|
43
|
+
* not have to stop this adapter to get at port 80. Enabled by default; set
|
|
44
|
+
* to false to keep `/.well-known/acme-challenge/` entirely to the app.
|
|
45
|
+
*/
|
|
46
|
+
acmeChallenge?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Speak HTTP/2 on a secure server, with HTTP/1.1 as fallback for clients that do not offer it.
|
|
49
|
+
* Enabled by default; set to false to stay with HTTP/1.1. Has no effect without `secure`: browsers
|
|
50
|
+
* use HTTP/2 over TLS only. WebSocket upgrades keep working, a browser opens them on a separate
|
|
51
|
+
* HTTP/1.1 connection.
|
|
52
|
+
*/
|
|
53
|
+
http2?: Http2;
|
|
54
|
+
/**
|
|
55
|
+
* Report the port the server listens on to the registry of exclusive resources js-controller 8
|
|
56
|
+
* keeps per host, and take the entry back when the server closes. Enabled by default.
|
|
57
|
+
*
|
|
58
|
+
* Requires `"declareUsedResources": true` in the `common` part of the adapter's `io-package.json`
|
|
59
|
+
* - without it js-controller derives the entry from `native.port` and refuses a registration.
|
|
60
|
+
* Does nothing on an older controller.
|
|
61
|
+
*/
|
|
62
|
+
usedResources?: boolean;
|
|
63
|
+
}
|
|
64
|
+
/** The server `init()` resolves to - an HTTP/2 server unless the `http2` option is `false` */
|
|
65
|
+
type WebServerInstance<Http2 extends boolean> = Http2 extends false ? http.Server | https.Server : http.Server | https.Server | http2.Http2SecureServer;
|
|
66
|
+
interface Certificates {
|
|
67
|
+
/** public certificate */
|
|
68
|
+
key: string;
|
|
69
|
+
/** private certificate */
|
|
70
|
+
cert: string;
|
|
71
|
+
/** chained certificate */
|
|
72
|
+
ca?: string;
|
|
73
|
+
}
|
|
74
|
+
export declare class WebServer<Http2 extends boolean = true> {
|
|
75
|
+
private server;
|
|
76
|
+
private readonly adapter;
|
|
77
|
+
private readonly secure;
|
|
78
|
+
private app?;
|
|
79
|
+
private originalApp;
|
|
80
|
+
private readonly certManager;
|
|
81
|
+
private readonly accessControl;
|
|
82
|
+
private readonly acmeChallenge;
|
|
83
|
+
private readonly http2;
|
|
84
|
+
private readonly usedResources;
|
|
85
|
+
/** Stops reporting the listening port, set once `init()` created the server */
|
|
86
|
+
private stopTrackingPort;
|
|
87
|
+
constructor(options: WebServerOptions<Http2>);
|
|
88
|
+
/**
|
|
89
|
+
* Wrap the app with everything that has to run in front of it.
|
|
90
|
+
*
|
|
91
|
+
* Called from every branch of init() because each of them creates the
|
|
92
|
+
* server from `this.app` and there is no single point after it.
|
|
93
|
+
*/
|
|
94
|
+
private prepareApp;
|
|
95
|
+
/**
|
|
96
|
+
* Put the ACME HTTP-01 challenge lookup in front of the app.
|
|
97
|
+
*
|
|
98
|
+
* In front rather than in a route because the CA is anonymous and the
|
|
99
|
+
* lookup therefore has to happen before any authentication the app
|
|
100
|
+
* installs. Requests that are not a published challenge are handed on
|
|
101
|
+
* untouched, so nothing the app serves is shadowed.
|
|
102
|
+
*/
|
|
103
|
+
private initAcmeChallenge;
|
|
104
|
+
/**
|
|
105
|
+
* Put the configured CORS headers in front of the app.
|
|
106
|
+
*
|
|
107
|
+
* Outermost rather than as a route, so every answer carries them - including the ones the app
|
|
108
|
+
* produces before any middleware it registered later would run, such as the OAuth2 token
|
|
109
|
+
* endpoint or a 401 out of the authorization middleware.
|
|
110
|
+
*/
|
|
111
|
+
private initAccessControl;
|
|
112
|
+
/**
|
|
113
|
+
* Initialize a new https / http server; according to configuration, it will be present on `this.server`
|
|
114
|
+
*/
|
|
115
|
+
init(): Promise<WebServerInstance<Http2>>;
|
|
116
|
+
/**
|
|
117
|
+
* Stop reporting the listening port to js-controller and free an entry that is still registered.
|
|
118
|
+
*
|
|
119
|
+
* Only needed when the server is thrown away without being closed - a `close()` frees the entry
|
|
120
|
+
* by itself, and a stopped instance has its entries released by the host.
|
|
121
|
+
*/
|
|
122
|
+
unregisterUsedResources(): void;
|
|
123
|
+
/**
|
|
124
|
+
* Create a secure server: HTTP/2 with HTTP/1.1 fallback if enabled, plain HTTPS otherwise
|
|
125
|
+
*
|
|
126
|
+
* @param options TLS options with the certificates or the SNI callback
|
|
127
|
+
*/
|
|
128
|
+
private createSecureServer;
|
|
129
|
+
private createServer;
|
|
130
|
+
/**
|
|
131
|
+
* Assemble the certificate a secure context has to present for a collection.
|
|
132
|
+
*
|
|
133
|
+
* `cert` holds the leaf only - the issuing chain lives in `chain`, and without it every
|
|
134
|
+
* client that does not already know the intermediate rejects the connection. Producers
|
|
135
|
+
* disagree on whether `chain` repeats the leaf, so it is normalized here.
|
|
136
|
+
*
|
|
137
|
+
* @param collection the certificate collection
|
|
138
|
+
*/
|
|
139
|
+
private static buildCertificateChain;
|
|
140
|
+
/**
|
|
141
|
+
* Cut a collection field into its individual PEM certificates.
|
|
142
|
+
*
|
|
143
|
+
* The field may be a single certificate, a whole concatenated chain or an array of either,
|
|
144
|
+
* as string or as Buffer - which one it is depends on who wrote the collection.
|
|
145
|
+
*
|
|
146
|
+
* @param source the collection field to read
|
|
147
|
+
*/
|
|
148
|
+
private static splitCertificates;
|
|
149
|
+
/**
|
|
150
|
+
* Build secure context from certificate collections
|
|
151
|
+
*
|
|
152
|
+
* @param collections the certificate collections
|
|
153
|
+
*/
|
|
154
|
+
private buildSecureContexts;
|
|
155
|
+
/**
|
|
156
|
+
* Get the custom certificates as text
|
|
157
|
+
*/
|
|
158
|
+
getCustomCertificates(): Promise<Certificates | null>;
|
|
159
|
+
/**
|
|
160
|
+
* Get the custom certificates context
|
|
161
|
+
*/
|
|
162
|
+
getCustomCertificatesContext(): Promise<tls.SecureContext | null>;
|
|
163
|
+
}
|
|
164
|
+
export {};
|
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.WebServer = void 0;
|
|
7
|
+
const node_tls_1 = __importDefault(require("node:tls"));
|
|
8
|
+
const node_http_1 = __importDefault(require("node:http"));
|
|
9
|
+
const node_https_1 = __importDefault(require("node:https"));
|
|
10
|
+
const node_http2_1 = __importDefault(require("node:http2"));
|
|
11
|
+
const certificateManager_1 = require("./certificateManager");
|
|
12
|
+
const acmeChallenge_1 = require("./acmeChallenge");
|
|
13
|
+
const http2Compat_1 = require("./http2Compat");
|
|
14
|
+
const usedResources_1 = require("./usedResources");
|
|
15
|
+
class WebServer {
|
|
16
|
+
constructor(options) {
|
|
17
|
+
this.secure = !!options.secure;
|
|
18
|
+
this.adapter = options.adapter;
|
|
19
|
+
this.app = options.app || undefined;
|
|
20
|
+
if (this.secure) {
|
|
21
|
+
this.certManager = new certificateManager_1.CertificateManager({ adapter: options.adapter });
|
|
22
|
+
}
|
|
23
|
+
this.accessControl = options.accessControl;
|
|
24
|
+
this.acmeChallenge = options.acmeChallenge !== false;
|
|
25
|
+
this.http2 = options.http2 !== false && this.secure;
|
|
26
|
+
this.usedResources = options.usedResources !== false;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Wrap the app with everything that has to run in front of it.
|
|
30
|
+
*
|
|
31
|
+
* Called from every branch of init() because each of them creates the
|
|
32
|
+
* server from `this.app` and there is no single point after it.
|
|
33
|
+
*/
|
|
34
|
+
prepareApp() {
|
|
35
|
+
this.initAccessControl();
|
|
36
|
+
// Outermost, so a challenge is answered without collecting CORS headers
|
|
37
|
+
// it has no use for.
|
|
38
|
+
this.initAcmeChallenge();
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Put the ACME HTTP-01 challenge lookup in front of the app.
|
|
42
|
+
*
|
|
43
|
+
* In front rather than in a route because the CA is anonymous and the
|
|
44
|
+
* lookup therefore has to happen before any authentication the app
|
|
45
|
+
* installs. Requests that are not a published challenge are handed on
|
|
46
|
+
* untouched, so nothing the app serves is shadowed.
|
|
47
|
+
*/
|
|
48
|
+
initAcmeChallenge() {
|
|
49
|
+
if (!this.acmeChallenge) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const app = this.app;
|
|
53
|
+
const passOn = (req, res) => {
|
|
54
|
+
if (app) {
|
|
55
|
+
app(req, res);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
// Without an app there is nobody left to answer.
|
|
59
|
+
res.writeHead(404);
|
|
60
|
+
res.end();
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
this.app = (req, res) => {
|
|
64
|
+
var _a;
|
|
65
|
+
// Cheap string test first: this runs for every single request.
|
|
66
|
+
if (!((_a = req.url) === null || _a === void 0 ? void 0 : _a.startsWith(acmeChallenge_1.ACME_CHALLENGE_PREFIX))) {
|
|
67
|
+
passOn(req, res);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
(0, acmeChallenge_1.serveAcmeChallenge)(this.adapter, req, res).then(served => {
|
|
71
|
+
if (!served) {
|
|
72
|
+
passOn(req, res);
|
|
73
|
+
}
|
|
74
|
+
}, (e) => {
|
|
75
|
+
this.adapter.log.warn(`Could not answer ACME challenge: ${e.message}`);
|
|
76
|
+
passOn(req, res);
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Put the configured CORS headers in front of the app.
|
|
82
|
+
*
|
|
83
|
+
* Outermost rather than as a route, so every answer carries them - including the ones the app
|
|
84
|
+
* produces before any middleware it registered later would run, such as the OAuth2 token
|
|
85
|
+
* endpoint or a 401 out of the authorization middleware.
|
|
86
|
+
*/
|
|
87
|
+
initAccessControl() {
|
|
88
|
+
const accessControl = this.accessControl;
|
|
89
|
+
if (!accessControl ||
|
|
90
|
+
(accessControl.accessControlAllowCredentials === undefined &&
|
|
91
|
+
!accessControl.accessControlAllowHeaders &&
|
|
92
|
+
!accessControl.accessControlAllowMethods &&
|
|
93
|
+
!accessControl.accessControlAllowOrigin &&
|
|
94
|
+
!accessControl.accessControlExposeHeaders &&
|
|
95
|
+
accessControl.accessControlMaxAge === undefined &&
|
|
96
|
+
!accessControl.accessControlRequestHeaders &&
|
|
97
|
+
!accessControl.accessControlRequestMethod)) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
// The deprecated `Request-*` options are request headers and were never valid on a
|
|
101
|
+
// response, so whoever set them meant the `Allow-*` ones. They only fill in when the
|
|
102
|
+
// correct option is absent.
|
|
103
|
+
const allowHeaders = accessControl.accessControlAllowHeaders || accessControl.accessControlRequestHeaders;
|
|
104
|
+
const allowMethods = accessControl.accessControlAllowMethods || accessControl.accessControlRequestMethod;
|
|
105
|
+
this.originalApp = this.app;
|
|
106
|
+
this.app = (req, res) => {
|
|
107
|
+
if (accessControl.accessControlAllowCredentials !== undefined) {
|
|
108
|
+
res.setHeader('Access-Control-Allow-Credentials', accessControl.accessControlAllowCredentials ? 'true' : 'false');
|
|
109
|
+
}
|
|
110
|
+
if (allowHeaders) {
|
|
111
|
+
res.setHeader('Access-Control-Allow-Headers', allowHeaders);
|
|
112
|
+
}
|
|
113
|
+
if (allowMethods) {
|
|
114
|
+
res.setHeader('Access-Control-Allow-Methods', allowMethods);
|
|
115
|
+
}
|
|
116
|
+
const origin = typeof accessControl.accessControlAllowOrigin === 'function'
|
|
117
|
+
? accessControl.accessControlAllowOrigin(req.headers.origin)
|
|
118
|
+
: accessControl.accessControlAllowOrigin;
|
|
119
|
+
if (origin) {
|
|
120
|
+
res.setHeader('Access-Control-Allow-Origin', origin);
|
|
121
|
+
if (origin !== '*') {
|
|
122
|
+
// The answer depends on the origin, so a cache must not hand it to another one.
|
|
123
|
+
res.setHeader('Vary', 'Origin');
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (accessControl.accessControlExposeHeaders) {
|
|
127
|
+
res.setHeader('Access-Control-Expose-Headers', accessControl.accessControlExposeHeaders);
|
|
128
|
+
}
|
|
129
|
+
if (accessControl.accessControlMaxAge !== undefined) {
|
|
130
|
+
res.setHeader('Access-Control-Max-Age', accessControl.accessControlMaxAge.toString());
|
|
131
|
+
}
|
|
132
|
+
// @ts-expect-error this.originalApp is set
|
|
133
|
+
return this.originalApp(req, res);
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Initialize a new https / http server; according to configuration, it will be present on `this.server`
|
|
138
|
+
*/
|
|
139
|
+
async init() {
|
|
140
|
+
var _a;
|
|
141
|
+
const server = await this.createServer();
|
|
142
|
+
if (this.usedResources) {
|
|
143
|
+
// The caller is the one calling listen(), so the port is picked up from the server when
|
|
144
|
+
// it is up rather than from the configuration - which may not be what was really bound.
|
|
145
|
+
(_a = this.stopTrackingPort) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
146
|
+
this.stopTrackingPort = (0, usedResources_1.trackUsedPort)(this.adapter, server);
|
|
147
|
+
}
|
|
148
|
+
// Only an HTTP/2 server when the `http2` option was not false, which is what the type says
|
|
149
|
+
return server;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Stop reporting the listening port to js-controller and free an entry that is still registered.
|
|
153
|
+
*
|
|
154
|
+
* Only needed when the server is thrown away without being closed - a `close()` frees the entry
|
|
155
|
+
* by itself, and a stopped instance has its entries released by the host.
|
|
156
|
+
*/
|
|
157
|
+
unregisterUsedResources() {
|
|
158
|
+
var _a;
|
|
159
|
+
(_a = this.stopTrackingPort) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
160
|
+
this.stopTrackingPort = undefined;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Create a secure server: HTTP/2 with HTTP/1.1 fallback if enabled, plain HTTPS otherwise
|
|
164
|
+
*
|
|
165
|
+
* @param options TLS options with the certificates or the SNI callback
|
|
166
|
+
*/
|
|
167
|
+
createSecureServer(options) {
|
|
168
|
+
if (!this.http2) {
|
|
169
|
+
return node_https_1.default.createServer(options, this.app);
|
|
170
|
+
}
|
|
171
|
+
this.adapter.log.debug('Using HTTP/2 with HTTP/1.1 fallback');
|
|
172
|
+
const app = this.app;
|
|
173
|
+
const listener = (req, res) => {
|
|
174
|
+
// A client that did not offer HTTP/2 arrives here as a plain HTTP/1.1 request
|
|
175
|
+
if (req instanceof node_http2_1.default.Http2ServerRequest) {
|
|
176
|
+
(0, http2Compat_1.adaptHttp2Request)(req, res);
|
|
177
|
+
}
|
|
178
|
+
app(req, res);
|
|
179
|
+
};
|
|
180
|
+
const server = node_http2_1.default.createSecureServer({ ...options, allowHTTP1: true }, app && listener);
|
|
181
|
+
// Node.js 22.21 calls this for every HTTP/1.1 Upgrade request (e.g. WebSocket) but does not set it on the HTTP/2
|
|
182
|
+
// server, so the first such request crashes the process: https://github.com/nodejs/node/issues/60336
|
|
183
|
+
const upgradable = server;
|
|
184
|
+
if (typeof upgradable.shouldUpgradeCallback !== 'function') {
|
|
185
|
+
upgradable.shouldUpgradeCallback = function () {
|
|
186
|
+
return this.listenerCount('upgrade') > 0;
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
// close() only stops accepting new connections. A browser keeps its HTTP/2 session open for as long as
|
|
190
|
+
// it likes, and the close callback would never be called - while the session goes on serving the app.
|
|
191
|
+
// An HTTP/1.1 connection is no issue: an idle one is closed by close() itself.
|
|
192
|
+
const sessions = new Set();
|
|
193
|
+
server.on('session', session => {
|
|
194
|
+
sessions.add(session);
|
|
195
|
+
session.once('close', () => sessions.delete(session));
|
|
196
|
+
});
|
|
197
|
+
const close = server.close.bind(server);
|
|
198
|
+
server.close = (callback) => {
|
|
199
|
+
close(callback);
|
|
200
|
+
// Graceful: the streams in flight are finished, then the session is gone
|
|
201
|
+
sessions.forEach(session => session.close());
|
|
202
|
+
return server;
|
|
203
|
+
};
|
|
204
|
+
return server;
|
|
205
|
+
}
|
|
206
|
+
async createServer() {
|
|
207
|
+
if (!this.certManager) {
|
|
208
|
+
this.adapter.log.debug('Secure connection not enabled - using http createServer');
|
|
209
|
+
this.prepareApp();
|
|
210
|
+
this.server = node_http_1.default.createServer(this.app);
|
|
211
|
+
return this.server;
|
|
212
|
+
}
|
|
213
|
+
const config = this.adapter.config;
|
|
214
|
+
// Load self-signed or custom certificates for fallback
|
|
215
|
+
const customCertificates = await this.getCustomCertificates();
|
|
216
|
+
// Load certificate collections
|
|
217
|
+
this.adapter.log.debug('Loading all certificate collections...');
|
|
218
|
+
let collections;
|
|
219
|
+
// true => use all collections, false => do not use collections, string => use the collection with this ID
|
|
220
|
+
const collectionId = config.leCollection;
|
|
221
|
+
if (collectionId && typeof collectionId === 'string') {
|
|
222
|
+
collections = {
|
|
223
|
+
[collectionId]: await this.certManager.getCollection(collectionId),
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
else if (collectionId !== false) {
|
|
227
|
+
collections = await this.certManager.getAllCollections();
|
|
228
|
+
if (!collections || !Object.keys(collections).length) {
|
|
229
|
+
this.adapter.log.warn('Could not find any certificate collections - check ACME installation or consider installing');
|
|
230
|
+
this.prepareApp();
|
|
231
|
+
if (customCertificates) {
|
|
232
|
+
this.adapter.log.warn('Falling back to self-signed certificates or to custom certificates');
|
|
233
|
+
this.server = this.createSecureServer(customCertificates);
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
// This really should never happen as customCertificatesContext should always be available
|
|
237
|
+
this.adapter.log.error('Could not find self-signed certificate - falling back to insecure http createServer');
|
|
238
|
+
this.server = node_http_1.default.createServer(this.app);
|
|
239
|
+
}
|
|
240
|
+
return this.server;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
// fallback to self-signed or custom certificates
|
|
245
|
+
collections = null;
|
|
246
|
+
this.prepareApp();
|
|
247
|
+
if (customCertificates) {
|
|
248
|
+
this.adapter.log.debug('Use self-signed certificates or custom certificates');
|
|
249
|
+
this.server = this.createSecureServer(customCertificates);
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
// This really should never happen as customCertificatesContext should always be available
|
|
253
|
+
this.adapter.log.error('Could not find self-signed certificate - falling back to insecure http createServer');
|
|
254
|
+
this.server = node_http_1.default.createServer(this.app);
|
|
255
|
+
}
|
|
256
|
+
return this.server;
|
|
257
|
+
}
|
|
258
|
+
let contexts;
|
|
259
|
+
const customCertificatesContext = customCertificates ? node_tls_1.default.createSecureContext(customCertificates) : null;
|
|
260
|
+
if (collections) {
|
|
261
|
+
contexts = this.buildSecureContexts(collections);
|
|
262
|
+
this.certManager.subscribeCollections(collectionId === true ? null : collectionId || null, (err, collections) => {
|
|
263
|
+
if (!err && collections) {
|
|
264
|
+
this.adapter.log.silly(`collections update ${JSON.stringify(collections)}`);
|
|
265
|
+
contexts = this.buildSecureContexts(collections);
|
|
266
|
+
if (!Object.keys(contexts).length) {
|
|
267
|
+
this.adapter.log.warn('Could not find any certificate collections after update');
|
|
268
|
+
if (!customCertificatesContext) {
|
|
269
|
+
this.adapter.log.error('No certificate collections or self-signed certificate available - HTTPS requests will now fail');
|
|
270
|
+
// This is very bad, and perhaps the adapter should also terminate itself?
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
// contexts are now up to date and will be utilized in SNICallback - nothing more to do.
|
|
274
|
+
}
|
|
275
|
+
else if (err) {
|
|
276
|
+
this.adapter.log.error(`Error updating certificate collections: ${err.toString()}`);
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
this.adapter.log.error(`${collectionId ? `Collection "${collectionId}" was` : 'All collections were'} removed from certificate collections and now we cannot update certificates`);
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
const options = {
|
|
284
|
+
SNICallback: (serverName, callback) => {
|
|
285
|
+
var _a, _b;
|
|
286
|
+
// Find which context to use for this server
|
|
287
|
+
let context;
|
|
288
|
+
if (contexts) {
|
|
289
|
+
if (serverName in contexts) {
|
|
290
|
+
// Easy - name is explicitly mentioned
|
|
291
|
+
if (((_a = this.adapter.common) === null || _a === void 0 ? void 0 : _a.loglevel) === 'debug') {
|
|
292
|
+
this.adapter.log.debug(`Using explicit context for "${serverName}"`);
|
|
293
|
+
}
|
|
294
|
+
context = contexts[serverName];
|
|
295
|
+
}
|
|
296
|
+
else {
|
|
297
|
+
// Check for wildcard
|
|
298
|
+
const serverParts = serverName.split('.');
|
|
299
|
+
if (serverParts.length > 1) {
|
|
300
|
+
serverParts.shift();
|
|
301
|
+
serverParts.unshift('*');
|
|
302
|
+
const wildcard = serverParts.join('.');
|
|
303
|
+
if (wildcard in contexts) {
|
|
304
|
+
// OK - wildcard found
|
|
305
|
+
if (((_b = this.adapter.common) === null || _b === void 0 ? void 0 : _b.loglevel) === 'debug') {
|
|
306
|
+
this.adapter.log.debug(`Using wildcard context for "${serverName}"`);
|
|
307
|
+
}
|
|
308
|
+
context = contexts[wildcard];
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
if (!context) {
|
|
314
|
+
// Not found above.
|
|
315
|
+
if (customCertificatesContext) {
|
|
316
|
+
// Use custom context
|
|
317
|
+
// Don't spit out warnings here as this may be a common occurrence
|
|
318
|
+
// and one already emitted at startup.
|
|
319
|
+
context = customCertificatesContext;
|
|
320
|
+
}
|
|
321
|
+
else if (contexts) {
|
|
322
|
+
// See the note above about terminating - if that is implemented, no need for this check.
|
|
323
|
+
if (!Object.keys(contexts).length) {
|
|
324
|
+
// No customCertificatesContext and no contexts - this is very bad!
|
|
325
|
+
this.adapter.log.error(`Could not derive secure context for "${serverName}"`);
|
|
326
|
+
}
|
|
327
|
+
else {
|
|
328
|
+
this.adapter.log.warn(`No matching context for "${serverName}" - using first certificate collection which will likely cause browser security warnings`);
|
|
329
|
+
context = contexts[Object.keys(contexts)[0]];
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
else {
|
|
333
|
+
this.adapter.log.error(`Could not find any certificates for "${serverName}"`);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
callback(null, context);
|
|
337
|
+
},
|
|
338
|
+
};
|
|
339
|
+
this.prepareApp();
|
|
340
|
+
this.adapter.log.debug('Using https createServer');
|
|
341
|
+
this.server = this.createSecureServer(options);
|
|
342
|
+
return this.server;
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Assemble the certificate a secure context has to present for a collection.
|
|
346
|
+
*
|
|
347
|
+
* `cert` holds the leaf only - the issuing chain lives in `chain`, and without it every
|
|
348
|
+
* client that does not already know the intermediate rejects the connection. Producers
|
|
349
|
+
* disagree on whether `chain` repeats the leaf, so it is normalized here.
|
|
350
|
+
*
|
|
351
|
+
* @param collection the certificate collection
|
|
352
|
+
*/
|
|
353
|
+
static buildCertificateChain(collection) {
|
|
354
|
+
const leaf = WebServer.splitCertificates(collection.cert);
|
|
355
|
+
const issuers = WebServer.splitCertificates(collection.chain).filter(cert => !leaf.includes(cert));
|
|
356
|
+
const bundle = leaf.concat(issuers);
|
|
357
|
+
if (!bundle.length) {
|
|
358
|
+
// Nothing parseable in there - hand the raw value on and let TLS report what is wrong.
|
|
359
|
+
return collection.cert.toString();
|
|
360
|
+
}
|
|
361
|
+
// Joined by a newline, never by an empty string: OpenSSL only recognizes a BEGIN marker
|
|
362
|
+
// at the start of a line and would silently drop every certificate after the first.
|
|
363
|
+
return `${bundle.join('\n')}\n`;
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Cut a collection field into its individual PEM certificates.
|
|
367
|
+
*
|
|
368
|
+
* The field may be a single certificate, a whole concatenated chain or an array of either,
|
|
369
|
+
* as string or as Buffer - which one it is depends on who wrote the collection.
|
|
370
|
+
*
|
|
371
|
+
* @param source the collection field to read
|
|
372
|
+
*/
|
|
373
|
+
static splitCertificates(source) {
|
|
374
|
+
const parts = Array.isArray(source) ? source : source ? [source] : [];
|
|
375
|
+
const certificates = [];
|
|
376
|
+
for (const part of parts) {
|
|
377
|
+
// A base64 body never contains a dash, so the end of a block is unambiguous.
|
|
378
|
+
const found = part.toString().match(/-----BEGIN CERTIFICATE-----[^-]+-----END CERTIFICATE-----/g);
|
|
379
|
+
if (found) {
|
|
380
|
+
certificates.push(...found);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
return certificates;
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Build secure context from certificate collections
|
|
387
|
+
*
|
|
388
|
+
* @param collections the certificate collections
|
|
389
|
+
*/
|
|
390
|
+
buildSecureContexts(collections) {
|
|
391
|
+
this.adapter.log.debug('buildSecureContexts...');
|
|
392
|
+
const contexts = {};
|
|
393
|
+
if (typeof collections === 'object') {
|
|
394
|
+
for (const [collectionId, collection] of Object.entries(collections)) {
|
|
395
|
+
const context = node_tls_1.default.createSecureContext({
|
|
396
|
+
key: collection.key,
|
|
397
|
+
cert: WebServer.buildCertificateChain(collection),
|
|
398
|
+
});
|
|
399
|
+
for (const domain of collection.domains) {
|
|
400
|
+
this.adapter.log.debug(`${domain} -> ${collectionId}`);
|
|
401
|
+
contexts[domain] = context;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
return contexts;
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Get the custom certificates as text
|
|
409
|
+
*/
|
|
410
|
+
async getCustomCertificates() {
|
|
411
|
+
const config = this.adapter.config;
|
|
412
|
+
const defaultPublic = config.certPublic || 'defaultPublic';
|
|
413
|
+
const defaultPrivate = config.certPrivate || 'defaultPrivate';
|
|
414
|
+
const defaultChain = config.certChained || '';
|
|
415
|
+
const customCertificates = await this.adapter.getCertificatesAsync(defaultPublic, defaultPrivate, defaultChain);
|
|
416
|
+
this.adapter.log.debug(`Loaded custom certificates: ${JSON.stringify(customCertificates && customCertificates[0])}`);
|
|
417
|
+
if (customCertificates && customCertificates[0]) {
|
|
418
|
+
const certs = customCertificates[0];
|
|
419
|
+
if (certs.key.endsWith('.pem')) {
|
|
420
|
+
this.adapter.log.error(`Cannot load custom certificates. File "${certs.key}" does not exists or iobroker user has no rights for it.`);
|
|
421
|
+
}
|
|
422
|
+
else if (certs.cert.endsWith('.pem')) {
|
|
423
|
+
this.adapter.log.error(`Cannot load custom certificates. File "${certs.cert}" does not exists or iobroker user has no rights for it.`);
|
|
424
|
+
}
|
|
425
|
+
else if (certs.ca && typeof certs.ca === 'string' && certs.ca.endsWith('.pem')) {
|
|
426
|
+
this.adapter.log.error(`Cannot load custom certificates. File "${certs.ca}" does not exists or iobroker user has no rights for it.`);
|
|
427
|
+
}
|
|
428
|
+
else {
|
|
429
|
+
return certs;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
return null;
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* Get the custom certificates context
|
|
436
|
+
*/
|
|
437
|
+
async getCustomCertificatesContext() {
|
|
438
|
+
try {
|
|
439
|
+
const customCertificates = await this.getCustomCertificates();
|
|
440
|
+
if (customCertificates) {
|
|
441
|
+
// All good
|
|
442
|
+
return node_tls_1.default.createSecureContext(customCertificates);
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
catch (e) {
|
|
446
|
+
this.adapter.log.error(e.message);
|
|
447
|
+
}
|
|
448
|
+
// If we got here, then we either failed to load or use self-signed certificate or custom certificates.
|
|
449
|
+
this.adapter.log.warn('Could not create custom context for fallback use');
|
|
450
|
+
return null;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
exports.WebServer = WebServer;
|
|
454
|
+
//# sourceMappingURL=webServer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webServer.js","sourceRoot":"","sources":["../../src/lib/webServer.ts"],"names":[],"mappings":";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