@push.rocks/smartproxy 12.0.0 → 13.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/certificate/acme/acme-factory.d.ts +17 -0
- package/dist_ts/certificate/acme/acme-factory.js +40 -0
- package/dist_ts/certificate/acme/challenge-handler.d.ts +44 -0
- package/dist_ts/certificate/acme/challenge-handler.js +92 -0
- package/dist_ts/certificate/acme/index.d.ts +4 -0
- package/dist_ts/certificate/acme/index.js +5 -0
- package/dist_ts/certificate/events/certificate-events.d.ts +33 -0
- package/dist_ts/certificate/events/certificate-events.js +38 -0
- package/dist_ts/certificate/index.d.ts +24 -0
- package/dist_ts/certificate/index.js +39 -0
- package/dist_ts/certificate/models/certificate-types.d.ts +77 -0
- package/dist_ts/certificate/models/certificate-types.js +2 -0
- package/dist_ts/certificate/providers/cert-provisioner.d.ts +93 -0
- package/dist_ts/certificate/providers/cert-provisioner.js +262 -0
- package/dist_ts/certificate/providers/index.d.ts +4 -0
- package/dist_ts/certificate/providers/index.js +5 -0
- package/dist_ts/certificate/storage/file-storage.d.ts +66 -0
- package/dist_ts/certificate/storage/file-storage.js +194 -0
- package/dist_ts/certificate/storage/index.d.ts +4 -0
- package/dist_ts/certificate/storage/index.js +5 -0
- package/dist_ts/certificate/utils/certificate-helpers.d.ts +17 -0
- package/dist_ts/certificate/utils/certificate-helpers.js +45 -0
- package/dist_ts/common/eventUtils.d.ts +1 -1
- package/dist_ts/common/port80-adapter.d.ts +1 -1
- package/dist_ts/core/events/index.d.ts +4 -0
- package/dist_ts/core/events/index.js +5 -0
- package/dist_ts/core/index.d.ts +6 -0
- package/dist_ts/core/index.js +8 -0
- package/dist_ts/core/models/common-types.d.ts +82 -0
- package/dist_ts/core/models/common-types.js +15 -0
- package/dist_ts/core/models/index.d.ts +4 -0
- package/dist_ts/core/models/index.js +5 -0
- package/dist_ts/core/utils/event-utils.d.ts +15 -0
- package/dist_ts/core/utils/event-utils.js +19 -0
- package/dist_ts/core/utils/index.d.ts +6 -0
- package/dist_ts/core/utils/index.js +7 -0
- package/dist_ts/core/utils/ip-utils.d.ts +53 -0
- package/dist_ts/core/utils/ip-utils.js +153 -0
- package/dist_ts/core/utils/validation-utils.d.ts +61 -0
- package/dist_ts/core/utils/validation-utils.js +149 -0
- package/dist_ts/forwarding/config/domain-config.d.ts +12 -0
- package/dist_ts/forwarding/config/domain-config.js +12 -0
- package/dist_ts/forwarding/config/domain-manager.d.ts +86 -0
- package/dist_ts/forwarding/config/domain-manager.js +242 -0
- package/dist_ts/forwarding/config/forwarding-types.d.ts +104 -0
- package/dist_ts/forwarding/config/forwarding-types.js +50 -0
- package/dist_ts/forwarding/config/index.d.ts +6 -0
- package/dist_ts/forwarding/config/index.js +7 -0
- package/dist_ts/forwarding/factory/forwarding-factory.d.ts +25 -0
- package/dist_ts/forwarding/factory/forwarding-factory.js +138 -0
- package/dist_ts/forwarding/factory/index.d.ts +4 -0
- package/dist_ts/forwarding/factory/index.js +5 -0
- package/dist_ts/forwarding/handlers/base-handler.d.ts +55 -0
- package/dist_ts/forwarding/handlers/base-handler.js +94 -0
- package/dist_ts/forwarding/handlers/http-handler.d.ts +30 -0
- package/dist_ts/forwarding/handlers/http-handler.js +131 -0
- package/dist_ts/forwarding/handlers/https-passthrough-handler.d.ts +29 -0
- package/dist_ts/forwarding/handlers/https-passthrough-handler.js +162 -0
- package/dist_ts/forwarding/handlers/https-terminate-to-http-handler.d.ts +36 -0
- package/dist_ts/forwarding/handlers/https-terminate-to-http-handler.js +229 -0
- package/dist_ts/forwarding/handlers/https-terminate-to-https-handler.d.ts +35 -0
- package/dist_ts/forwarding/handlers/https-terminate-to-https-handler.js +254 -0
- package/dist_ts/forwarding/handlers/index.d.ts +8 -0
- package/dist_ts/forwarding/handlers/index.js +9 -0
- package/dist_ts/forwarding/index.d.ts +19 -0
- package/dist_ts/forwarding/index.js +25 -0
- package/dist_ts/http/index.d.ts +15 -0
- package/dist_ts/http/index.js +20 -0
- package/dist_ts/http/models/http-types.d.ts +81 -0
- package/dist_ts/http/models/http-types.js +62 -0
- package/dist_ts/http/port80/acme-interfaces.d.ts +78 -0
- package/dist_ts/http/port80/acme-interfaces.js +6 -0
- package/dist_ts/http/port80/challenge-responder.d.ts +53 -0
- package/dist_ts/http/port80/challenge-responder.js +203 -0
- package/dist_ts/http/port80/index.d.ts +6 -0
- package/dist_ts/http/port80/index.js +9 -0
- package/dist_ts/http/port80/port80-handler.d.ts +121 -0
- package/dist_ts/http/port80/port80-handler.js +554 -0
- package/dist_ts/http/redirects/index.d.ts +4 -0
- package/dist_ts/http/redirects/index.js +5 -0
- package/dist_ts/http/router/index.d.ts +4 -0
- package/dist_ts/http/router/index.js +5 -0
- package/dist_ts/http/router/proxy-router.d.ts +115 -0
- package/dist_ts/http/router/proxy-router.js +325 -0
- package/dist_ts/index.d.ts +15 -8
- package/dist_ts/index.js +26 -10
- package/dist_ts/networkproxy/classes.np.certificatemanager.js +2 -2
- package/dist_ts/networkproxy/index.d.ts +1 -6
- package/dist_ts/networkproxy/index.js +4 -8
- package/dist_ts/plugins.d.ts +2 -1
- package/dist_ts/plugins.js +3 -2
- package/dist_ts/port80handler/classes.port80handler.d.ts +8 -136
- package/dist_ts/port80handler/classes.port80handler.js +14 -567
- package/dist_ts/proxies/index.d.ts +6 -0
- package/dist_ts/proxies/index.js +8 -0
- package/dist_ts/proxies/network-proxy/certificate-manager.d.ts +77 -0
- package/dist_ts/proxies/network-proxy/certificate-manager.js +373 -0
- package/dist_ts/proxies/network-proxy/connection-pool.d.ts +47 -0
- package/dist_ts/proxies/network-proxy/connection-pool.js +210 -0
- package/dist_ts/proxies/network-proxy/index.d.ts +10 -0
- package/dist_ts/proxies/network-proxy/index.js +12 -0
- package/dist_ts/proxies/network-proxy/models/index.d.ts +4 -0
- package/dist_ts/proxies/network-proxy/models/index.js +5 -0
- package/dist_ts/proxies/network-proxy/models/types.d.ts +80 -0
- package/dist_ts/proxies/network-proxy/models/types.js +35 -0
- package/dist_ts/proxies/network-proxy/network-proxy.d.ts +118 -0
- package/dist_ts/proxies/network-proxy/network-proxy.js +387 -0
- package/dist_ts/proxies/network-proxy/request-handler.d.ts +57 -0
- package/dist_ts/proxies/network-proxy/request-handler.js +394 -0
- package/dist_ts/proxies/network-proxy/websocket-handler.d.ts +38 -0
- package/dist_ts/proxies/network-proxy/websocket-handler.js +188 -0
- package/dist_ts/proxies/nftables-proxy/index.d.ts +5 -0
- package/dist_ts/proxies/nftables-proxy/index.js +6 -0
- package/dist_ts/proxies/nftables-proxy/models/errors.d.ts +15 -0
- package/dist_ts/proxies/nftables-proxy/models/errors.js +28 -0
- package/dist_ts/proxies/nftables-proxy/models/index.d.ts +5 -0
- package/dist_ts/proxies/nftables-proxy/models/index.js +6 -0
- package/dist_ts/proxies/nftables-proxy/models/interfaces.d.ts +75 -0
- package/dist_ts/proxies/nftables-proxy/models/interfaces.js +5 -0
- package/dist_ts/proxies/nftables-proxy/nftables-proxy.d.ts +136 -0
- package/dist_ts/proxies/nftables-proxy/nftables-proxy.js +1516 -0
- package/dist_ts/proxies/smart-proxy/connection-handler.d.ts +39 -0
- package/dist_ts/proxies/smart-proxy/connection-handler.js +894 -0
- package/dist_ts/proxies/smart-proxy/connection-manager.d.ts +78 -0
- package/dist_ts/proxies/smart-proxy/connection-manager.js +378 -0
- package/dist_ts/proxies/smart-proxy/domain-config-manager.d.ts +95 -0
- package/dist_ts/proxies/smart-proxy/domain-config-manager.js +255 -0
- package/dist_ts/proxies/smart-proxy/index.d.ts +13 -0
- package/dist_ts/proxies/smart-proxy/index.js +17 -0
- package/dist_ts/proxies/smart-proxy/models/index.d.ts +4 -0
- package/dist_ts/proxies/smart-proxy/models/index.js +5 -0
- package/dist_ts/proxies/smart-proxy/models/interfaces.d.ts +107 -0
- package/dist_ts/proxies/smart-proxy/models/interfaces.js +2 -0
- package/dist_ts/proxies/smart-proxy/network-proxy-bridge.d.ts +62 -0
- package/dist_ts/proxies/smart-proxy/network-proxy-bridge.js +316 -0
- package/dist_ts/proxies/smart-proxy/port-range-manager.d.ts +56 -0
- package/dist_ts/proxies/smart-proxy/port-range-manager.js +176 -0
- package/dist_ts/proxies/smart-proxy/security-manager.d.ts +64 -0
- package/dist_ts/proxies/smart-proxy/security-manager.js +149 -0
- package/dist_ts/proxies/smart-proxy/smart-proxy.d.ts +63 -0
- package/dist_ts/proxies/smart-proxy/smart-proxy.js +523 -0
- package/dist_ts/proxies/smart-proxy/timeout-manager.d.ts +47 -0
- package/dist_ts/proxies/smart-proxy/timeout-manager.js +154 -0
- package/dist_ts/proxies/smart-proxy/tls-manager.d.ts +57 -0
- package/dist_ts/proxies/smart-proxy/tls-manager.js +132 -0
- package/dist_ts/smartproxy/classes.pp.networkproxybridge.d.ts +2 -2
- package/dist_ts/smartproxy/classes.pp.networkproxybridge.js +1 -1
- package/dist_ts/smartproxy/classes.pp.tlsmanager.js +2 -2
- package/dist_ts/smartproxy/classes.smartproxy.js +3 -3
- package/dist_ts/tls/alerts/index.d.ts +4 -0
- package/dist_ts/tls/alerts/index.js +5 -0
- package/dist_ts/tls/alerts/tls-alert.d.ts +150 -0
- package/dist_ts/tls/alerts/tls-alert.js +226 -0
- package/dist_ts/tls/index.d.ts +18 -0
- package/dist_ts/tls/index.js +27 -0
- package/dist_ts/tls/sni/client-hello-parser.d.ts +100 -0
- package/dist_ts/tls/sni/client-hello-parser.js +463 -0
- package/dist_ts/tls/sni/index.d.ts +4 -0
- package/dist_ts/tls/sni/index.js +5 -0
- package/dist_ts/tls/sni/sni-extraction.d.ts +58 -0
- package/dist_ts/tls/sni/sni-extraction.js +275 -0
- package/dist_ts/tls/sni/sni-handler.d.ts +154 -0
- package/dist_ts/tls/sni/sni-handler.js +191 -0
- package/dist_ts/tls/utils/index.d.ts +4 -0
- package/dist_ts/tls/utils/index.js +5 -0
- package/dist_ts/tls/utils/tls-utils.d.ts +158 -0
- package/dist_ts/tls/utils/tls-utils.js +187 -0
- package/package.json +1 -1
- package/readme.md +499 -220
- package/readme.plan.md +253 -469
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/certificate/acme/acme-factory.ts +48 -0
- package/ts/certificate/acme/challenge-handler.ts +110 -0
- package/ts/certificate/acme/index.ts +3 -0
- package/ts/certificate/events/certificate-events.ts +36 -0
- package/ts/certificate/index.ts +67 -0
- package/ts/certificate/models/certificate-types.ts +88 -0
- package/ts/certificate/providers/cert-provisioner.ts +326 -0
- package/ts/certificate/providers/index.ts +3 -0
- package/ts/certificate/storage/file-storage.ts +234 -0
- package/ts/certificate/storage/index.ts +3 -0
- package/ts/certificate/utils/certificate-helpers.ts +50 -0
- package/ts/common/eventUtils.ts +1 -1
- package/ts/common/port80-adapter.ts +1 -1
- package/ts/core/events/index.ts +3 -0
- package/ts/core/index.ts +8 -0
- package/ts/core/models/common-types.ts +91 -0
- package/ts/core/models/index.ts +5 -0
- package/ts/core/utils/event-utils.ts +34 -0
- package/ts/core/utils/index.ts +7 -0
- package/ts/core/utils/ip-utils.ts +175 -0
- package/ts/core/utils/validation-utils.ts +177 -0
- package/ts/{smartproxy/forwarding → forwarding/config}/domain-config.ts +1 -1
- package/ts/{smartproxy/forwarding → forwarding/config}/domain-manager.ts +8 -8
- package/ts/{smartproxy/types/forwarding.types.ts → forwarding/config/forwarding-types.ts} +6 -6
- package/ts/forwarding/config/index.ts +7 -0
- package/ts/{smartproxy/forwarding/forwarding.factory.ts → forwarding/factory/forwarding-factory.ts} +12 -11
- package/ts/forwarding/factory/index.ts +5 -0
- package/ts/{smartproxy/forwarding/forwarding.handler.ts → forwarding/handlers/base-handler.ts} +2 -2
- package/ts/{smartproxy/forwarding/http.handler.ts → forwarding/handlers/http-handler.ts} +13 -4
- package/ts/{smartproxy/forwarding/https-passthrough.handler.ts → forwarding/handlers/https-passthrough-handler.ts} +13 -4
- package/ts/{smartproxy/forwarding/https-terminate-to-http.handler.ts → forwarding/handlers/https-terminate-to-http-handler.ts} +3 -3
- package/ts/{smartproxy/forwarding/https-terminate-to-https.handler.ts → forwarding/handlers/https-terminate-to-https-handler.ts} +3 -3
- package/ts/forwarding/handlers/index.ts +9 -0
- package/ts/forwarding/index.ts +34 -0
- package/ts/http/index.ts +23 -0
- package/ts/http/models/http-types.ts +105 -0
- package/ts/http/port80/acme-interfaces.ts +85 -0
- package/ts/http/port80/challenge-responder.ts +246 -0
- package/ts/http/port80/index.ts +13 -0
- package/ts/{port80handler/classes.port80handler.ts → http/port80/port80-handler.ts} +164 -161
- package/ts/http/redirects/index.ts +3 -0
- package/ts/http/router/index.ts +5 -0
- package/ts/{classes.router.ts → http/router/proxy-router.ts} +27 -20
- package/ts/index.ts +32 -9
- package/ts/plugins.ts +2 -1
- package/ts/proxies/index.ts +8 -0
- package/ts/{networkproxy/classes.np.certificatemanager.ts → proxies/network-proxy/certificate-manager.ts} +17 -16
- package/ts/{networkproxy/classes.np.connectionpool.ts → proxies/network-proxy/connection-pool.ts} +3 -3
- package/ts/proxies/network-proxy/index.ts +13 -0
- package/ts/proxies/network-proxy/models/index.ts +4 -0
- package/ts/{networkproxy/classes.np.types.ts → proxies/network-proxy/models/types.ts} +7 -11
- package/ts/{networkproxy/classes.np.networkproxy.ts → proxies/network-proxy/network-proxy.ts} +31 -24
- package/ts/{networkproxy/classes.np.requesthandler.ts → proxies/network-proxy/request-handler.ts} +12 -7
- package/ts/{networkproxy/classes.np.websockethandler.ts → proxies/network-proxy/websocket-handler.ts} +6 -6
- package/ts/proxies/nftables-proxy/index.ts +5 -0
- package/ts/proxies/nftables-proxy/models/errors.ts +30 -0
- package/ts/proxies/nftables-proxy/models/index.ts +5 -0
- package/ts/proxies/nftables-proxy/models/interfaces.ts +94 -0
- package/ts/{nfttablesproxy/classes.nftablesproxy.ts → proxies/nftables-proxy/nftables-proxy.ts} +24 -126
- package/ts/{smartproxy/classes.pp.connectionhandler.ts → proxies/smart-proxy/connection-handler.ts} +12 -12
- package/ts/{smartproxy/classes.pp.connectionmanager.ts → proxies/smart-proxy/connection-manager.ts} +8 -8
- package/ts/{smartproxy/classes.pp.domainconfigmanager.ts → proxies/smart-proxy/domain-config-manager.ts} +15 -14
- package/ts/proxies/smart-proxy/index.ts +18 -0
- package/ts/proxies/smart-proxy/models/index.ts +4 -0
- package/ts/{smartproxy/classes.pp.interfaces.ts → proxies/smart-proxy/models/interfaces.ts} +12 -8
- package/ts/{smartproxy/classes.pp.networkproxybridge.ts → proxies/smart-proxy/network-proxy-bridge.ts} +14 -14
- package/ts/{smartproxy/classes.pp.portrangemanager.ts → proxies/smart-proxy/port-range-manager.ts} +1 -1
- package/ts/{smartproxy/classes.pp.securitymanager.ts → proxies/smart-proxy/security-manager.ts} +3 -3
- package/ts/{smartproxy/classes.smartproxy.ts → proxies/smart-proxy/smart-proxy.ts} +29 -24
- package/ts/{smartproxy/classes.pp.timeoutmanager.ts → proxies/smart-proxy/timeout-manager.ts} +3 -3
- package/ts/{smartproxy/classes.pp.tlsmanager.ts → proxies/smart-proxy/tls-manager.ts} +3 -3
- package/ts/tls/alerts/index.ts +3 -0
- package/ts/{smartproxy/classes.pp.tlsalert.ts → tls/alerts/tls-alert.ts} +44 -43
- package/ts/tls/index.ts +33 -0
- package/ts/tls/sni/client-hello-parser.ts +629 -0
- package/ts/tls/sni/index.ts +3 -0
- package/ts/tls/sni/sni-extraction.ts +353 -0
- package/ts/tls/sni/sni-handler.ts +264 -0
- package/ts/tls/utils/index.ts +3 -0
- package/ts/tls/utils/tls-utils.ts +201 -0
- package/ts/common/acmeFactory.ts +0 -23
- package/ts/helpers.certificates.ts +0 -30
- package/ts/networkproxy/index.ts +0 -7
- package/ts/smartproxy/classes.pp.certprovisioner.ts +0 -200
- package/ts/smartproxy/classes.pp.snihandler.ts +0 -1281
- package/ts/smartproxy/forwarding/index.ts +0 -52
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@push.rocks/smartproxy',
|
|
6
|
-
version: '
|
|
6
|
+
version: '13.1.3',
|
|
7
7
|
description: 'A powerful proxy package that effectively handles high traffic, with features such as SSL/TLS support, port proxying, WebSocket handling, dynamic routing with authentication options, and automatic ACME certificate management.'
|
|
8
8
|
};
|
|
9
9
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSx3QkFBd0I7SUFDOUIsT0FBTyxFQUFFLFFBQVE7SUFDakIsV0FBVyxFQUFFLG1PQUFtTztDQUNqUCxDQUFBIn0=
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { IAcmeOptions } from '../models/certificate-types.js';
|
|
2
|
+
import { Port80Handler } from '../../http/port80/port80-handler.js';
|
|
3
|
+
/**
|
|
4
|
+
* Factory to create a Port80Handler with common setup.
|
|
5
|
+
* Ensures the certificate store directory exists and instantiates the handler.
|
|
6
|
+
* @param options Port80Handler configuration options
|
|
7
|
+
* @returns A new Port80Handler instance
|
|
8
|
+
*/
|
|
9
|
+
export declare function buildPort80Handler(options: IAcmeOptions): Port80Handler;
|
|
10
|
+
/**
|
|
11
|
+
* Creates default ACME options with sensible defaults
|
|
12
|
+
* @param email Account email for ACME provider
|
|
13
|
+
* @param certificateStore Path to store certificates
|
|
14
|
+
* @param useProduction Whether to use production ACME servers
|
|
15
|
+
* @returns Configured ACME options
|
|
16
|
+
*/
|
|
17
|
+
export declare function createDefaultAcmeOptions(email: string, certificateStore: string, useProduction?: boolean): IAcmeOptions;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import { ensureCertificateDirectory } from '../utils/certificate-helpers.js';
|
|
4
|
+
// We'll need to update this import when we move the Port80Handler
|
|
5
|
+
import { Port80Handler } from '../../http/port80/port80-handler.js';
|
|
6
|
+
/**
|
|
7
|
+
* Factory to create a Port80Handler with common setup.
|
|
8
|
+
* Ensures the certificate store directory exists and instantiates the handler.
|
|
9
|
+
* @param options Port80Handler configuration options
|
|
10
|
+
* @returns A new Port80Handler instance
|
|
11
|
+
*/
|
|
12
|
+
export function buildPort80Handler(options) {
|
|
13
|
+
if (options.certificateStore) {
|
|
14
|
+
ensureCertificateDirectory(options.certificateStore);
|
|
15
|
+
console.log(`Ensured certificate store directory: ${options.certificateStore}`);
|
|
16
|
+
}
|
|
17
|
+
return new Port80Handler(options);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Creates default ACME options with sensible defaults
|
|
21
|
+
* @param email Account email for ACME provider
|
|
22
|
+
* @param certificateStore Path to store certificates
|
|
23
|
+
* @param useProduction Whether to use production ACME servers
|
|
24
|
+
* @returns Configured ACME options
|
|
25
|
+
*/
|
|
26
|
+
export function createDefaultAcmeOptions(email, certificateStore, useProduction = false) {
|
|
27
|
+
return {
|
|
28
|
+
accountEmail: email,
|
|
29
|
+
enabled: true,
|
|
30
|
+
port: 80,
|
|
31
|
+
useProduction,
|
|
32
|
+
httpsRedirectPort: 443,
|
|
33
|
+
renewThresholdDays: 30,
|
|
34
|
+
renewCheckIntervalHours: 24,
|
|
35
|
+
autoRenew: true,
|
|
36
|
+
certificateStore,
|
|
37
|
+
skipConfiguredCerts: false
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWNtZS1mYWN0b3J5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vdHMvY2VydGlmaWNhdGUvYWNtZS9hY21lLWZhY3RvcnkudHMiXSw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
|
1
|
+
import * as plugins from '../../plugins.js';
|
|
2
|
+
import type { IAcmeOptions } from '../models/certificate-types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Manages ACME challenges and certificate validation
|
|
5
|
+
*/
|
|
6
|
+
export declare class AcmeChallengeHandler extends plugins.EventEmitter {
|
|
7
|
+
private options;
|
|
8
|
+
private client;
|
|
9
|
+
private pendingChallenges;
|
|
10
|
+
/**
|
|
11
|
+
* Creates a new ACME challenge handler
|
|
12
|
+
* @param options ACME configuration options
|
|
13
|
+
*/
|
|
14
|
+
constructor(options: IAcmeOptions);
|
|
15
|
+
/**
|
|
16
|
+
* Gets or creates the ACME account key
|
|
17
|
+
*/
|
|
18
|
+
private getAccountKey;
|
|
19
|
+
/**
|
|
20
|
+
* Validates a domain using HTTP-01 challenge
|
|
21
|
+
* @param domain Domain to validate
|
|
22
|
+
* @param challengeToken ACME challenge token
|
|
23
|
+
* @param keyAuthorization Key authorization for the challenge
|
|
24
|
+
*/
|
|
25
|
+
handleHttpChallenge(domain: string, challengeToken: string, keyAuthorization: string): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Responds to an HTTP-01 challenge request
|
|
28
|
+
* @param token Challenge token from the request path
|
|
29
|
+
* @returns The key authorization if found
|
|
30
|
+
*/
|
|
31
|
+
getChallengeResponse(token: string): string | null;
|
|
32
|
+
/**
|
|
33
|
+
* Checks if a request path is an ACME challenge
|
|
34
|
+
* @param path Request path
|
|
35
|
+
* @returns True if this is an ACME challenge request
|
|
36
|
+
*/
|
|
37
|
+
isAcmeChallenge(path: string): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Extracts the challenge token from an ACME challenge path
|
|
40
|
+
* @param path Request path
|
|
41
|
+
* @returns The challenge token if valid
|
|
42
|
+
*/
|
|
43
|
+
extractChallengeToken(path: string): string | null;
|
|
44
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import * as plugins from '../../plugins.js';
|
|
2
|
+
import { CertificateEvents } from '../events/certificate-events.js';
|
|
3
|
+
/**
|
|
4
|
+
* Manages ACME challenges and certificate validation
|
|
5
|
+
*/
|
|
6
|
+
export class AcmeChallengeHandler extends plugins.EventEmitter {
|
|
7
|
+
/**
|
|
8
|
+
* Creates a new ACME challenge handler
|
|
9
|
+
* @param options ACME configuration options
|
|
10
|
+
*/
|
|
11
|
+
constructor(options) {
|
|
12
|
+
super();
|
|
13
|
+
this.options = options;
|
|
14
|
+
this.pendingChallenges = new Map();
|
|
15
|
+
// Initialize ACME client if needed
|
|
16
|
+
// This is just a placeholder implementation since we don't use the actual
|
|
17
|
+
// client directly in this implementation - it's handled by Port80Handler
|
|
18
|
+
this.client = null;
|
|
19
|
+
console.log('Created challenge handler with options:', options.accountEmail, options.useProduction ? 'production' : 'staging');
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Gets or creates the ACME account key
|
|
23
|
+
*/
|
|
24
|
+
getAccountKey() {
|
|
25
|
+
// Implementation details would depend on plugin requirements
|
|
26
|
+
// This is a simplified version
|
|
27
|
+
if (!this.options.certificateStore) {
|
|
28
|
+
throw new Error('Certificate store is required for ACME challenges');
|
|
29
|
+
}
|
|
30
|
+
// This is just a placeholder - actual implementation would check for
|
|
31
|
+
// existing account key and create one if needed
|
|
32
|
+
return Buffer.from('account-key-placeholder');
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Validates a domain using HTTP-01 challenge
|
|
36
|
+
* @param domain Domain to validate
|
|
37
|
+
* @param challengeToken ACME challenge token
|
|
38
|
+
* @param keyAuthorization Key authorization for the challenge
|
|
39
|
+
*/
|
|
40
|
+
async handleHttpChallenge(domain, challengeToken, keyAuthorization) {
|
|
41
|
+
// Store challenge for response
|
|
42
|
+
this.pendingChallenges.set(challengeToken, keyAuthorization);
|
|
43
|
+
try {
|
|
44
|
+
// Wait for challenge validation - this would normally be handled by the ACME client
|
|
45
|
+
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
46
|
+
this.emit(CertificateEvents.CERTIFICATE_ISSUED, {
|
|
47
|
+
domain,
|
|
48
|
+
success: true
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
this.emit(CertificateEvents.CERTIFICATE_FAILED, {
|
|
53
|
+
domain,
|
|
54
|
+
error: error instanceof Error ? error.message : String(error),
|
|
55
|
+
isRenewal: false
|
|
56
|
+
});
|
|
57
|
+
throw error;
|
|
58
|
+
}
|
|
59
|
+
finally {
|
|
60
|
+
// Clean up the challenge
|
|
61
|
+
this.pendingChallenges.delete(challengeToken);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Responds to an HTTP-01 challenge request
|
|
66
|
+
* @param token Challenge token from the request path
|
|
67
|
+
* @returns The key authorization if found
|
|
68
|
+
*/
|
|
69
|
+
getChallengeResponse(token) {
|
|
70
|
+
return this.pendingChallenges.get(token) || null;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Checks if a request path is an ACME challenge
|
|
74
|
+
* @param path Request path
|
|
75
|
+
* @returns True if this is an ACME challenge request
|
|
76
|
+
*/
|
|
77
|
+
isAcmeChallenge(path) {
|
|
78
|
+
return path.startsWith('/.well-known/acme-challenge/');
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Extracts the challenge token from an ACME challenge path
|
|
82
|
+
* @param path Request path
|
|
83
|
+
* @returns The challenge token if valid
|
|
84
|
+
*/
|
|
85
|
+
extractChallengeToken(path) {
|
|
86
|
+
if (!this.isAcmeChallenge(path))
|
|
87
|
+
return null;
|
|
88
|
+
const parts = path.split('/');
|
|
89
|
+
return parts[parts.length - 1] || null;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hhbGxlbmdlLWhhbmRsZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi90cy9jZXJ0aWZpY2F0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FBRyxDQUFDLEtBQUssQ0FBQyxJQUFJLElBQUksQ0FBQztJQUNuRCxDQUFDO0lBRUQ7Ozs7T0FJRztJQUNJLGVBQWUsQ0FBQyxJQUFZO1FBQ2pDLE9BQU8sSUFBSSxDQUFDLFVBQVUsQ0FBQyw4QkFBOEIsQ0FBQyxDQUFDO0lBQ3pELENBQUM7SUFFRDs7OztPQUlHO0lBQ0kscUJBQXFCLENBQUMsSUFBWTtRQUN2QyxJQUFJLENBQUMsSUFBSSxDQUFDLGVBQWUsQ0FBQyxJQUFJLENBQUM7WUFBRSxPQUFPLElBQUksQ0FBQztRQUU3QyxNQUFNLEtBQUssR0FBRyxJQUFJLENBQUMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxDQUFDO1FBQzlCLE9BQU8sS0FBSyxDQUFDLEtBQUssQ0FBQyxNQUFNLEdBQUcsQ0FBQyxDQUFDLElBQUksSUFBSSxDQUFDO0lBQ3pDLENBQUM7Q0FDRiJ9
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
/**
|
|
3
|
+
* ACME certificate provisioning
|
|
4
|
+
*/
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi90cy9jZXJ0aWZpY2F0ZS9hY21lL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTs7R0FFRyJ9
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Certificate-related events emitted by certificate management components
|
|
3
|
+
*/
|
|
4
|
+
export declare enum CertificateEvents {
|
|
5
|
+
CERTIFICATE_ISSUED = "certificate-issued",
|
|
6
|
+
CERTIFICATE_RENEWED = "certificate-renewed",
|
|
7
|
+
CERTIFICATE_FAILED = "certificate-failed",
|
|
8
|
+
CERTIFICATE_EXPIRING = "certificate-expiring",
|
|
9
|
+
CERTIFICATE_APPLIED = "certificate-applied",
|
|
10
|
+
MANAGER_STARTED = "manager-started",
|
|
11
|
+
MANAGER_STOPPED = "manager-stopped"
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Port80Handler-specific events including certificate-related ones
|
|
15
|
+
* @deprecated Use CertificateEvents and HttpEvents instead
|
|
16
|
+
*/
|
|
17
|
+
export declare enum Port80HandlerEvents {
|
|
18
|
+
CERTIFICATE_ISSUED = "certificate-issued",
|
|
19
|
+
CERTIFICATE_RENEWED = "certificate-renewed",
|
|
20
|
+
CERTIFICATE_FAILED = "certificate-failed",
|
|
21
|
+
CERTIFICATE_EXPIRING = "certificate-expiring",
|
|
22
|
+
MANAGER_STARTED = "manager-started",
|
|
23
|
+
MANAGER_STOPPED = "manager-stopped",
|
|
24
|
+
REQUEST_FORWARDED = "request-forwarded"
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Certificate provider events
|
|
28
|
+
*/
|
|
29
|
+
export declare enum CertProvisionerEvents {
|
|
30
|
+
CERTIFICATE_ISSUED = "certificate",
|
|
31
|
+
CERTIFICATE_RENEWED = "certificate",
|
|
32
|
+
CERTIFICATE_FAILED = "certificate-failed"
|
|
33
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Certificate-related events emitted by certificate management components
|
|
3
|
+
*/
|
|
4
|
+
export var CertificateEvents;
|
|
5
|
+
(function (CertificateEvents) {
|
|
6
|
+
CertificateEvents["CERTIFICATE_ISSUED"] = "certificate-issued";
|
|
7
|
+
CertificateEvents["CERTIFICATE_RENEWED"] = "certificate-renewed";
|
|
8
|
+
CertificateEvents["CERTIFICATE_FAILED"] = "certificate-failed";
|
|
9
|
+
CertificateEvents["CERTIFICATE_EXPIRING"] = "certificate-expiring";
|
|
10
|
+
CertificateEvents["CERTIFICATE_APPLIED"] = "certificate-applied";
|
|
11
|
+
// Events moved from Port80Handler for compatibility
|
|
12
|
+
CertificateEvents["MANAGER_STARTED"] = "manager-started";
|
|
13
|
+
CertificateEvents["MANAGER_STOPPED"] = "manager-stopped";
|
|
14
|
+
})(CertificateEvents || (CertificateEvents = {}));
|
|
15
|
+
/**
|
|
16
|
+
* Port80Handler-specific events including certificate-related ones
|
|
17
|
+
* @deprecated Use CertificateEvents and HttpEvents instead
|
|
18
|
+
*/
|
|
19
|
+
export var Port80HandlerEvents;
|
|
20
|
+
(function (Port80HandlerEvents) {
|
|
21
|
+
Port80HandlerEvents["CERTIFICATE_ISSUED"] = "certificate-issued";
|
|
22
|
+
Port80HandlerEvents["CERTIFICATE_RENEWED"] = "certificate-renewed";
|
|
23
|
+
Port80HandlerEvents["CERTIFICATE_FAILED"] = "certificate-failed";
|
|
24
|
+
Port80HandlerEvents["CERTIFICATE_EXPIRING"] = "certificate-expiring";
|
|
25
|
+
Port80HandlerEvents["MANAGER_STARTED"] = "manager-started";
|
|
26
|
+
Port80HandlerEvents["MANAGER_STOPPED"] = "manager-stopped";
|
|
27
|
+
Port80HandlerEvents["REQUEST_FORWARDED"] = "request-forwarded";
|
|
28
|
+
})(Port80HandlerEvents || (Port80HandlerEvents = {}));
|
|
29
|
+
/**
|
|
30
|
+
* Certificate provider events
|
|
31
|
+
*/
|
|
32
|
+
export var CertProvisionerEvents;
|
|
33
|
+
(function (CertProvisionerEvents) {
|
|
34
|
+
CertProvisionerEvents["CERTIFICATE_ISSUED"] = "certificate";
|
|
35
|
+
CertProvisionerEvents["CERTIFICATE_RENEWED"] = "certificate";
|
|
36
|
+
CertProvisionerEvents["CERTIFICATE_FAILED"] = "certificate-failed";
|
|
37
|
+
})(CertProvisionerEvents || (CertProvisionerEvents = {}));
|
|
38
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2VydGlmaWNhdGUtZXZlbnRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vdHMvY2VydGlmaWNhdGUvZXZlbnRzL2NlcnRpZmljYXRlLWV2ZW50cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUNILE1BQU0sQ0FBTixJQUFZLGlCQVNYO0FBVEQsV0FBWSxpQkFBaUI7SUFDM0IsOERBQXlDLENBQUE7SUFDekMsZ0VBQTJDLENBQUE7SUFDM0MsOERBQXlDLENBQUE7SUFDekMsa0VBQTZDLENBQUE7SUFDN0MsZ0VBQTJDLENBQUE7SUFDM0Msb0RBQW9EO0lBQ3BELHdEQUFtQyxDQUFBO0lBQ25DLHdEQUFtQyxDQUFBO0FBQ3JDLENBQUMsRUFUVyxpQkFBaUIsS0FBakIsaUJBQWlCLFFBUzVCO0FBRUQ7OztHQUdHO0FBQ0gsTUFBTSxDQUFOLElBQVksbUJBUVg7QUFSRCxXQUFZLG1CQUFtQjtJQUM3QixnRUFBeUMsQ0FBQTtJQUN6QyxrRUFBMkMsQ0FBQTtJQUMzQyxnRUFBeUMsQ0FBQTtJQUN6QyxvRUFBNkMsQ0FBQTtJQUM3QywwREFBbUMsQ0FBQTtJQUNuQywwREFBbUMsQ0FBQTtJQUNuQyw4REFBdUMsQ0FBQTtBQUN6QyxDQUFDLEVBUlcsbUJBQW1CLEtBQW5CLG1CQUFtQixRQVE5QjtBQUVEOztHQUVHO0FBQ0gsTUFBTSxDQUFOLElBQVkscUJBSVg7QUFKRCxXQUFZLHFCQUFxQjtJQUMvQiwyREFBa0MsQ0FBQTtJQUNsQyw0REFBbUMsQ0FBQTtJQUNuQyxrRUFBeUMsQ0FBQTtBQUMzQyxDQUFDLEVBSlcscUJBQXFCLEtBQXJCLHFCQUFxQixRQUloQyJ9
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Certificate management module for SmartProxy
|
|
3
|
+
* Provides certificate provisioning, storage, and management capabilities
|
|
4
|
+
*/
|
|
5
|
+
export * from './models/certificate-types.js';
|
|
6
|
+
export * from './events/certificate-events.js';
|
|
7
|
+
export * from './providers/cert-provisioner.js';
|
|
8
|
+
export * from './acme/acme-factory.js';
|
|
9
|
+
export * from './acme/challenge-handler.js';
|
|
10
|
+
export * from './utils/certificate-helpers.js';
|
|
11
|
+
export * from './storage/file-storage.js';
|
|
12
|
+
import { CertProvisioner } from './providers/cert-provisioner.js';
|
|
13
|
+
import type { IAcmeOptions } from './models/certificate-types.js';
|
|
14
|
+
import type { IDomainConfig } from '../forwarding/config/domain-config.js';
|
|
15
|
+
/**
|
|
16
|
+
* Creates a complete certificate provisioning system with default settings
|
|
17
|
+
* @param domainConfigs Domain configurations
|
|
18
|
+
* @param acmeOptions ACME options for certificate provisioning
|
|
19
|
+
* @param networkProxyBridge Bridge to apply certificates to network proxy
|
|
20
|
+
* @param certProvider Optional custom certificate provider
|
|
21
|
+
* @returns Configured CertProvisioner
|
|
22
|
+
*/
|
|
23
|
+
export declare function createCertificateProvisioner(domainConfigs: IDomainConfig[], acmeOptions: IAcmeOptions, networkProxyBridge: any, // Placeholder until NetworkProxyBridge is migrated
|
|
24
|
+
certProvider?: any): CertProvisioner;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Certificate management module for SmartProxy
|
|
3
|
+
* Provides certificate provisioning, storage, and management capabilities
|
|
4
|
+
*/
|
|
5
|
+
// Certificate types and models
|
|
6
|
+
export * from './models/certificate-types.js';
|
|
7
|
+
// Certificate events
|
|
8
|
+
export * from './events/certificate-events.js';
|
|
9
|
+
// Certificate providers
|
|
10
|
+
export * from './providers/cert-provisioner.js';
|
|
11
|
+
// ACME related exports
|
|
12
|
+
export * from './acme/acme-factory.js';
|
|
13
|
+
export * from './acme/challenge-handler.js';
|
|
14
|
+
// Certificate utilities
|
|
15
|
+
export * from './utils/certificate-helpers.js';
|
|
16
|
+
// Certificate storage
|
|
17
|
+
export * from './storage/file-storage.js';
|
|
18
|
+
// Convenience function to create a certificate provisioner with common settings
|
|
19
|
+
import { CertProvisioner } from './providers/cert-provisioner.js';
|
|
20
|
+
import { buildPort80Handler } from './acme/acme-factory.js';
|
|
21
|
+
/**
|
|
22
|
+
* Creates a complete certificate provisioning system with default settings
|
|
23
|
+
* @param domainConfigs Domain configurations
|
|
24
|
+
* @param acmeOptions ACME options for certificate provisioning
|
|
25
|
+
* @param networkProxyBridge Bridge to apply certificates to network proxy
|
|
26
|
+
* @param certProvider Optional custom certificate provider
|
|
27
|
+
* @returns Configured CertProvisioner
|
|
28
|
+
*/
|
|
29
|
+
export function createCertificateProvisioner(domainConfigs, acmeOptions, networkProxyBridge, // Placeholder until NetworkProxyBridge is migrated
|
|
30
|
+
certProvider // Placeholder until cert provider type is properly defined
|
|
31
|
+
) {
|
|
32
|
+
// Build the Port80Handler for ACME challenges
|
|
33
|
+
const port80Handler = buildPort80Handler(acmeOptions);
|
|
34
|
+
// Extract ACME-specific configuration
|
|
35
|
+
const { renewThresholdDays = 30, renewCheckIntervalHours = 24, autoRenew = true, domainForwards = [] } = acmeOptions;
|
|
36
|
+
// Create and return the certificate provisioner
|
|
37
|
+
return new CertProvisioner(domainConfigs, port80Handler, networkProxyBridge, certProvider, renewThresholdDays, renewCheckIntervalHours, autoRenew, domainForwards);
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9jZXJ0aWZpY2F0ZS9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7O0dBR0c7QUFFSCwrQkFBK0I7QUFDL0IsY0FBYywrQkFBK0IsQ0FBQztBQUU5QyxxQkFBcUI7QUFDckIsY0FBYyxnQ0FBZ0MsQ0FBQztBQUUvQyx3QkFBd0I7QUFDeEIsY0FBYyxpQ0FBaUMsQ0FBQztBQUVoRCx1QkFBdUI7QUFDdkIsY0FBYyx3QkFBd0IsQ0FBQztBQUN2QyxjQUFjLDZCQUE2QixDQUFDO0FBRTVDLHdCQUF3QjtBQUN4QixjQUFjLGdDQUFnQyxDQUFDO0FBRS9DLHNCQUFzQjtBQUN0QixjQUFjLDJCQUEyQixDQUFDO0FBRTFDLGdGQUFnRjtBQUNoRixPQUFPLEVBQUUsZUFBZSxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDbEUsT0FBTyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFJNUQ7Ozs7Ozs7R0FPRztBQUNILE1BQU0sVUFBVSw0QkFBNEIsQ0FDMUMsYUFBOEIsRUFDOUIsV0FBeUIsRUFDekIsa0JBQXVCLEVBQUUsbURBQW1EO0FBQzVFLFlBQWtCLENBQUMsMkRBQTJEOztJQUU5RSw4Q0FBOEM7SUFDOUMsTUFBTSxhQUFhLEdBQUcsa0JBQWtCLENBQUMsV0FBVyxDQUFDLENBQUM7SUFFdEQsc0NBQXNDO0lBQ3RDLE1BQU0sRUFDSixrQkFBa0IsR0FBRyxFQUFFLEVBQ3ZCLHVCQUF1QixHQUFHLEVBQUUsRUFDNUIsU0FBUyxHQUFHLElBQUksRUFDaEIsY0FBYyxHQUFHLEVBQUUsRUFDcEIsR0FBRyxXQUFXLENBQUM7SUFFaEIsZ0RBQWdEO0lBQ2hELE9BQU8sSUFBSSxlQUFlLENBQ3hCLGFBQWEsRUFDYixhQUFhLEVBQ2Isa0JBQWtCLEVBQ2xCLFlBQVksRUFDWixrQkFBa0IsRUFDbEIsdUJBQXVCLEVBQ3ZCLFNBQVMsRUFDVCxjQUFjLENBQ2YsQ0FBQztBQUNKLENBQUMifQ==
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Certificate data structure containing all necessary information
|
|
3
|
+
* about a certificate
|
|
4
|
+
*/
|
|
5
|
+
export interface ICertificateData {
|
|
6
|
+
domain: string;
|
|
7
|
+
certificate: string;
|
|
8
|
+
privateKey: string;
|
|
9
|
+
expiryDate: Date;
|
|
10
|
+
source?: 'static' | 'http01' | 'dns01';
|
|
11
|
+
isRenewal?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Certificates pair (private and public keys)
|
|
15
|
+
*/
|
|
16
|
+
export interface ICertificates {
|
|
17
|
+
privateKey: string;
|
|
18
|
+
publicKey: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Certificate failure payload type
|
|
22
|
+
*/
|
|
23
|
+
export interface ICertificateFailure {
|
|
24
|
+
domain: string;
|
|
25
|
+
error: string;
|
|
26
|
+
isRenewal: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Certificate expiry payload type
|
|
30
|
+
*/
|
|
31
|
+
export interface ICertificateExpiring {
|
|
32
|
+
domain: string;
|
|
33
|
+
expiryDate: Date;
|
|
34
|
+
daysRemaining: number;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Domain forwarding configuration
|
|
38
|
+
*/
|
|
39
|
+
export interface IForwardConfig {
|
|
40
|
+
ip: string;
|
|
41
|
+
port: number;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Domain-specific forwarding configuration for ACME challenges
|
|
45
|
+
*/
|
|
46
|
+
export interface IDomainForwardConfig {
|
|
47
|
+
domain: string;
|
|
48
|
+
forwardConfig?: IForwardConfig;
|
|
49
|
+
acmeForwardConfig?: IForwardConfig;
|
|
50
|
+
sslRedirect?: boolean;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Domain configuration options
|
|
54
|
+
*/
|
|
55
|
+
export interface IDomainOptions {
|
|
56
|
+
domainName: string;
|
|
57
|
+
sslRedirect: boolean;
|
|
58
|
+
acmeMaintenance: boolean;
|
|
59
|
+
forward?: IForwardConfig;
|
|
60
|
+
acmeForward?: IForwardConfig;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Unified ACME configuration options used across proxies and handlers
|
|
64
|
+
*/
|
|
65
|
+
export interface IAcmeOptions {
|
|
66
|
+
accountEmail?: string;
|
|
67
|
+
enabled?: boolean;
|
|
68
|
+
port?: number;
|
|
69
|
+
useProduction?: boolean;
|
|
70
|
+
httpsRedirectPort?: number;
|
|
71
|
+
renewThresholdDays?: number;
|
|
72
|
+
renewCheckIntervalHours?: number;
|
|
73
|
+
autoRenew?: boolean;
|
|
74
|
+
certificateStore?: string;
|
|
75
|
+
skipConfiguredCerts?: boolean;
|
|
76
|
+
domainForwards?: IDomainForwardConfig[];
|
|
77
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import * as plugins from '../../plugins.js';
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2VydGlmaWNhdGUtdHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi90cy9jZXJ0aWZpY2F0ZS9tb2RlbHMvY2VydGlmaWNhdGUtdHlwZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLE9BQU8sTUFBTSxrQkFBa0IsQ0FBQyJ9
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import * as plugins from '../../plugins.js';
|
|
2
|
+
import type { IDomainConfig } from '../../forwarding/config/domain-config.js';
|
|
3
|
+
import type { ICertificateData, IDomainForwardConfig } from '../models/certificate-types.js';
|
|
4
|
+
import { Port80Handler } from '../../http/port80/port80-handler.js';
|
|
5
|
+
interface INetworkProxyBridge {
|
|
6
|
+
applyExternalCertificate(certData: ICertificateData): void;
|
|
7
|
+
}
|
|
8
|
+
export type TSmartProxyCertProvisionObject = plugins.tsclass.network.ICert | 'http01';
|
|
9
|
+
/**
|
|
10
|
+
* Type for static certificate provisioning
|
|
11
|
+
*/
|
|
12
|
+
export type TCertProvisionObject = plugins.tsclass.network.ICert | 'http01' | 'dns01';
|
|
13
|
+
/**
|
|
14
|
+
* CertProvisioner manages certificate provisioning and renewal workflows,
|
|
15
|
+
* unifying static certificates and HTTP-01 challenges via Port80Handler.
|
|
16
|
+
*/
|
|
17
|
+
export declare class CertProvisioner extends plugins.EventEmitter {
|
|
18
|
+
private domainConfigs;
|
|
19
|
+
private port80Handler;
|
|
20
|
+
private networkProxyBridge;
|
|
21
|
+
private certProvisionFunction?;
|
|
22
|
+
private forwardConfigs;
|
|
23
|
+
private renewThresholdDays;
|
|
24
|
+
private renewCheckIntervalHours;
|
|
25
|
+
private autoRenew;
|
|
26
|
+
private renewManager?;
|
|
27
|
+
private provisionMap;
|
|
28
|
+
/**
|
|
29
|
+
* @param domainConfigs Array of domain configuration objects
|
|
30
|
+
* @param port80Handler HTTP-01 challenge handler instance
|
|
31
|
+
* @param networkProxyBridge Bridge for applying external certificates
|
|
32
|
+
* @param certProvider Optional callback returning a static cert or 'http01'
|
|
33
|
+
* @param renewThresholdDays Days before expiry to trigger renewals
|
|
34
|
+
* @param renewCheckIntervalHours Interval in hours to check for renewals
|
|
35
|
+
* @param autoRenew Whether to automatically schedule renewals
|
|
36
|
+
* @param forwardConfigs Domain forwarding configurations for ACME challenges
|
|
37
|
+
*/
|
|
38
|
+
constructor(domainConfigs: IDomainConfig[], port80Handler: Port80Handler, networkProxyBridge: INetworkProxyBridge, certProvider?: (domain: string) => Promise<TCertProvisionObject>, renewThresholdDays?: number, renewCheckIntervalHours?: number, autoRenew?: boolean, forwardConfigs?: IDomainForwardConfig[]);
|
|
39
|
+
/**
|
|
40
|
+
* Start initial provisioning and schedule renewals.
|
|
41
|
+
*/
|
|
42
|
+
start(): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Set up event subscriptions for certificate events
|
|
45
|
+
*/
|
|
46
|
+
private setupEventSubscriptions;
|
|
47
|
+
/**
|
|
48
|
+
* Set up forwarding configurations for the Port80Handler
|
|
49
|
+
*/
|
|
50
|
+
private setupForwardingConfigs;
|
|
51
|
+
/**
|
|
52
|
+
* Provision certificates for all configured domains
|
|
53
|
+
*/
|
|
54
|
+
private provisionAllDomains;
|
|
55
|
+
/**
|
|
56
|
+
* Provision a certificate for a single domain
|
|
57
|
+
* @param domain Domain to provision
|
|
58
|
+
*/
|
|
59
|
+
private provisionDomain;
|
|
60
|
+
/**
|
|
61
|
+
* Schedule certificate renewals using a task manager
|
|
62
|
+
*/
|
|
63
|
+
private scheduleRenewals;
|
|
64
|
+
/**
|
|
65
|
+
* Perform renewals for all domains that need it
|
|
66
|
+
*/
|
|
67
|
+
private performRenewals;
|
|
68
|
+
/**
|
|
69
|
+
* Renew a certificate for a specific domain
|
|
70
|
+
* @param domain Domain to renew
|
|
71
|
+
* @param provisionType Type of provisioning for this domain
|
|
72
|
+
*/
|
|
73
|
+
private renewDomain;
|
|
74
|
+
/**
|
|
75
|
+
* Stop all scheduled renewal tasks.
|
|
76
|
+
*/
|
|
77
|
+
stop(): Promise<void>;
|
|
78
|
+
/**
|
|
79
|
+
* Request a certificate on-demand for the given domain.
|
|
80
|
+
* @param domain Domain name to provision
|
|
81
|
+
*/
|
|
82
|
+
requestCertificate(domain: string): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* Add a new domain for certificate provisioning
|
|
85
|
+
* @param domain Domain to add
|
|
86
|
+
* @param options Domain configuration options
|
|
87
|
+
*/
|
|
88
|
+
addDomain(domain: string, options?: {
|
|
89
|
+
sslRedirect?: boolean;
|
|
90
|
+
acmeMaintenance?: boolean;
|
|
91
|
+
}): Promise<void>;
|
|
92
|
+
}
|
|
93
|
+
export { CertProvisioner as CertificateProvisioner };
|