@lilaquadrat/studio 10.0.0-beta.5 → 10.0.0-beta.6
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/lib/services.d.ts +1 -3
- package/lib/services.js +6 -3
- package/lib/services.js.map +1 -1
- package/lib/src/services/certificates.service.d.ts +0 -56
- package/lib/src/services/certificates.service.js +198 -168
- package/lib/src/services/certificates.service.js.map +1 -1
- package/lib/src/services/certificatesAction.service.d.ts +0 -41
- package/lib/src/services/certificatesAction.service.js +236 -187
- package/lib/src/services/certificatesAction.service.js.map +1 -1
- package/lib/src/services/domains.service.d.ts +2 -9
- package/lib/src/services/domains.service.js +72 -48
- package/lib/src/services/domains.service.js.map +1 -1
- package/package.json +1 -5
package/lib/services.d.ts
CHANGED
|
@@ -5,8 +5,6 @@ import idService from './src/services/id.service.js';
|
|
|
5
5
|
import publishService from './src/services/publish.service.js';
|
|
6
6
|
import publishMethodService from './src/services/publishMethod.service.js';
|
|
7
7
|
import secretService from './src/services/secret.service.js';
|
|
8
|
-
import certificatesService from './src/services/certificates.service.js';
|
|
9
|
-
import certificatesActionService from './src/services/certificatesAction.service.js';
|
|
10
8
|
import domainsService from './src/services/domains.service.js';
|
|
11
9
|
import confService from './src/services/conf.service.js';
|
|
12
10
|
import hostingCommandsService from './src/services/hostingCommands.service.js';
|
|
@@ -35,4 +33,4 @@ import jetstreamService from './src/services/jetstream.service.js';
|
|
|
35
33
|
import storageService from './src/services/storage.service.js';
|
|
36
34
|
import editorService from './src/services/editor.service.js';
|
|
37
35
|
import uploadService from './src/services/upload.service.js';
|
|
38
|
-
export { editorService as EditorService, editorBaseService as EditorBaseService, historyService as HistoryService, handleFileService as HandleFileService, idService as IdService, publishService as PublishService, secretService as SecretService, publishMethodService as PublishMethodService,
|
|
36
|
+
export { editorService as EditorService, editorBaseService as EditorBaseService, historyService as HistoryService, handleFileService as HandleFileService, idService as IdService, publishService as PublishService, secretService as SecretService, publishMethodService as PublishMethodService, domainsService as DomainsService, confService as ConfService, hostingCommandsService as HostingCommandsService, hostingService as HostingService, hostingAdminService as HostingAdminService, mediaService as MediaService, customersService as CustomersService, listsService as ListsService, listParticipantsService as ListParticipantsService, spamAnalasysService as SpamAnalasysService, webhooksCallsService as WebhooksCallsService, paymentsService as PaymentsService, paymentProvidersService as PaymentProvidersService, permissionsService as PermissionsService, importService as ImportService, structuresService as StructuresService, meService, MeService, AccessService, PublishDataService, MailFromService, CartService, AiService, LoggingService, shareService as ShareService, jetstreamService as JetStreamService, storageService as StorageService, uploadService as UploadService };
|
package/lib/services.js
CHANGED
|
@@ -6,8 +6,8 @@ import idService from './src/services/id.service.js';
|
|
|
6
6
|
import publishService from './src/services/publish.service.js';
|
|
7
7
|
import publishMethodService from './src/services/publishMethod.service.js';
|
|
8
8
|
import secretService from './src/services/secret.service.js';
|
|
9
|
-
import certificatesService from './src/services/certificates.service.js';
|
|
10
|
-
import certificatesActionService from './src/services/certificatesAction.service.js';
|
|
9
|
+
// import certificatesService from './src/services/certificates.service.js';
|
|
10
|
+
// import certificatesActionService from './src/services/certificatesAction.service.js';
|
|
11
11
|
import domainsService from './src/services/domains.service.js';
|
|
12
12
|
import confService from './src/services/conf.service.js';
|
|
13
13
|
import hostingCommandsService from './src/services/hostingCommands.service.js';
|
|
@@ -38,5 +38,8 @@ import editorService from './src/services/editor.service.js';
|
|
|
38
38
|
import uploadService from './src/services/upload.service.js';
|
|
39
39
|
export { editorService as EditorService, editorBaseService as EditorBaseService, historyService as HistoryService, handleFileService as HandleFileService, idService as IdService,
|
|
40
40
|
// universalService as UniversalService,
|
|
41
|
-
publishService as PublishService, secretService as SecretService, publishMethodService as PublishMethodService,
|
|
41
|
+
publishService as PublishService, secretService as SecretService, publishMethodService as PublishMethodService,
|
|
42
|
+
// certificatesService as CertificatesService,
|
|
43
|
+
// certificatesActionService as CertificatesActionService,
|
|
44
|
+
domainsService as DomainsService, confService as ConfService, hostingCommandsService as HostingCommandsService, hostingService as HostingService, hostingAdminService as HostingAdminService, mediaService as MediaService, customersService as CustomersService, listsService as ListsService, listParticipantsService as ListParticipantsService, spamAnalasysService as SpamAnalasysService, webhooksCallsService as WebhooksCallsService, paymentsService as PaymentsService, paymentProvidersService as PaymentProvidersService, permissionsService as PermissionsService, importService as ImportService, structuresService as StructuresService, meService, MeService, AccessService, PublishDataService, MailFromService, CartService, AiService, LoggingService, shareService as ShareService, jetstreamService as JetStreamService, storageService as StorageService, uploadService as UploadService };
|
|
42
45
|
//# sourceMappingURL=services.js.map
|
package/lib/services.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"services.js","sourceRoot":"","sources":["../services.ts"],"names":[],"mappings":"AACA,OAAO,iBAAiB,MAAM,sCAAsC,CAAC;AACrE,OAAO,cAAc,MAAM,mCAAmC,CAAC;AAC/D,OAAO,iBAAiB,MAAM,sCAAsC,CAAC;AACrE,OAAO,SAAS,MAAM,8BAA8B,CAAC;AACrD,sEAAsE;AACtE,OAAO,cAAc,MAAM,mCAAmC,CAAC;AAC/D,OAAO,oBAAoB,MAAM,yCAAyC,CAAC;AAC3E,OAAO,aAAa,MAAM,kCAAkC,CAAC;AAC7D,
|
|
1
|
+
{"version":3,"file":"services.js","sourceRoot":"","sources":["../services.ts"],"names":[],"mappings":"AACA,OAAO,iBAAiB,MAAM,sCAAsC,CAAC;AACrE,OAAO,cAAc,MAAM,mCAAmC,CAAC;AAC/D,OAAO,iBAAiB,MAAM,sCAAsC,CAAC;AACrE,OAAO,SAAS,MAAM,8BAA8B,CAAC;AACrD,sEAAsE;AACtE,OAAO,cAAc,MAAM,mCAAmC,CAAC;AAC/D,OAAO,oBAAoB,MAAM,yCAAyC,CAAC;AAC3E,OAAO,aAAa,MAAM,kCAAkC,CAAC;AAC7D,4EAA4E;AAC5E,wFAAwF;AACxF,OAAO,cAAc,MAAM,mCAAmC,CAAC;AAC/D,OAAO,WAAW,MAAM,gCAAgC,CAAC;AACzD,OAAO,sBAAsB,M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AAa,IAAI,aAAa,EAC9B,oBAAoB,IAAI,oBAAoB;AAC5C,8CAA8C;AAC9C,0DAA0D;AAC1D,cAAc,IAAI,cAAc,EAChC,WAAW,IAAI,WAAW,EAC1B,sBAAsB,IAAI,sBAAsB,EAChD,cAAc,IAAI,cAAc,EAChC,mBAAmB,IAAI,mBAAmB,EAC1C,YAAY,IAAI,YAAY,EAC5B,gBAAgB,IAAI,gBAAgB,EACpC,YAAY,IAAI,YAAY,EAC5B,uBAAuB,IAAI,uBAAuB,EAClD,mBAAmB,IAAI,mBAAmB,EAC1C,oBAAoB,IAAI,oBAAoB,EAC5C,eAAe,IAAI,eAAe,EAClC,uBAAuB,IAAI,uBAAuB,EAClD,kBAAkB,IAAI,kBAAkB,EACxC,aAAa,IAAI,aAAa,EAC9B,iBAAiB,IAAI,iBAAiB,EACtC,SAAS,EACT,SAAS,EACT,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,WAAW,EACX,SAAS,EACT,cAAc,EACd,YAAY,IAAI,YAAY,EAC5B,gBAAgB,IAAI,gBAAgB,EACpC,cAAc,IAAI,cAAc,EAChC,aAAa,IAAI,aAAa,EAC/B,CAAC"}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { PeerCertificate } from 'tls';
|
|
2
|
-
import { ClientSecretCredential, DefaultAzureCredential } from '@azure/identity';
|
|
3
|
-
import Immutable from '../Immutable.class.js';
|
|
4
|
-
import { BasicData, Certificate, CertificateAction, ShareClientInterface, UserApp, WildcardCertificates } from '@lilaquadrat/interfaces';
|
|
5
|
-
export declare class CertificatesService extends Immutable<Certificate> {
|
|
6
|
-
model: import("../classes/modelv2.class.js").default<Certificate, "change" | "create-domain" | "create-wildcard">;
|
|
7
|
-
shareClient?: ShareClientInterface;
|
|
8
|
-
acme_email?: string;
|
|
9
|
-
acme_directory: string;
|
|
10
|
-
constructor(acme_email?: string, acmeMode?: 'staging' | 'live', shareClient?: ShareClientInterface);
|
|
11
|
-
exists(domain: string, company: string, project: string): Promise<number>;
|
|
12
|
-
/**
|
|
13
|
-
* gets a valid domain based certificate for the provided domain, if no certificate matches, a new one will be requested
|
|
14
|
-
*/
|
|
15
|
-
getOrRequest(domain: string, company: string, project: string, user: string, app: string): Promise<{
|
|
16
|
-
type: 'certificate';
|
|
17
|
-
data: BasicData<Certificate>;
|
|
18
|
-
} | {
|
|
19
|
-
type: 'request';
|
|
20
|
-
data: BasicData<CertificateAction>['_id'];
|
|
21
|
-
}>;
|
|
22
|
-
getOrRequestWildcard(domain: string, options: Required<UserApp> & {
|
|
23
|
-
forceFile?: boolean;
|
|
24
|
-
saveInVault?: boolean;
|
|
25
|
-
}): Promise<{
|
|
26
|
-
type: 'certificate';
|
|
27
|
-
data: BasicData<Certificate>;
|
|
28
|
-
} | {
|
|
29
|
-
type: 'request';
|
|
30
|
-
data: BasicData<CertificateAction>['_id'];
|
|
31
|
-
}>;
|
|
32
|
-
getCertificateDetails(cert: string): PeerCertificate;
|
|
33
|
-
getBase(inputDomains: string[], type: 'wildcard' | 'domain', privateKey: string, privateServerKey: string): Promise<{
|
|
34
|
-
acme: any;
|
|
35
|
-
account: any;
|
|
36
|
-
accountKey: any;
|
|
37
|
-
csr: any;
|
|
38
|
-
domains: string[];
|
|
39
|
-
}>;
|
|
40
|
-
/**
|
|
41
|
-
* creates a letsencrypt wildcard SSL certificate on the given azure subscription
|
|
42
|
-
*/
|
|
43
|
-
createWildcard(domain: string, privateKey: string, privateServerKey: string, credentials: ClientSecretCredential | DefaultAzureCredential, azureSubscriptionId: string): Promise<WildcardCertificates>;
|
|
44
|
-
convertToPfx(certificate: string, privateKey: string, tempName: string): Promise<Buffer<ArrayBufferLike>>;
|
|
45
|
-
/**
|
|
46
|
-
* creates a letsencrypt certificate for all given domain
|
|
47
|
-
* http challenge will be used
|
|
48
|
-
*/
|
|
49
|
-
createSSl(domains: string[], company: string, project: string, privateKey: string, privateServerKey: string): Promise<WildcardCertificates>;
|
|
50
|
-
/**
|
|
51
|
-
* calls ``http://DOMAIN/.studio/check/`` to check if the response code is 202
|
|
52
|
-
*/
|
|
53
|
-
checkResponses(domains: string[]): Promise<boolean>;
|
|
54
|
-
}
|
|
55
|
-
declare const _default: CertificatesService;
|
|
56
|
-
export default _default;
|
|
@@ -1,169 +1,199 @@
|
|
|
1
|
-
import tls from 'tls';
|
|
2
|
-
import net from 'net';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
1
|
+
// import tls, { PeerCertificate } from 'tls';
|
|
2
|
+
// import net from 'net';
|
|
3
|
+
// import { ClientSecretCredential, DefaultAzureCredential } from '@azure/identity';
|
|
4
|
+
// import fs from 'fs';
|
|
5
|
+
// import ACME from '@root/acme';
|
|
6
|
+
// import CSR from '@root/csr';
|
|
7
|
+
// import PEM from '@root/pem/packer';
|
|
8
|
+
// import Keypairs from '@root/keypairs';
|
|
9
|
+
// import { exec } from 'child_process';
|
|
10
|
+
// import fetch from 'node-fetch';
|
|
11
|
+
// import { X509Certificate } from 'node:crypto';
|
|
12
|
+
// import CertificateModel from '../models/certificate.model.js';
|
|
13
|
+
// import Immutable from '../Immutable.class.js';
|
|
14
|
+
// import certificatesActionsService from './certificatesAction.service.js';
|
|
15
|
+
// import HttpSslChallenge from '../http.challenge.class.js';
|
|
16
|
+
// import logger from '../logger.js';
|
|
17
|
+
// import DnsSslChallenge from '../dns.challenge.class.js';
|
|
18
|
+
// import { BasicData, Certificate, CertificateAction, ShareClientInterface, UserApp, WildcardCertificates } from '@lilaquadrat/interfaces';
|
|
19
|
+
// export class CertificatesService extends Immutable<Certificate> {
|
|
20
|
+
// model = CertificateModel;
|
|
21
|
+
// shareClient?: ShareClientInterface;
|
|
22
|
+
// acme_email?: string;
|
|
23
|
+
// acme_directory: string;
|
|
24
|
+
// constructor(acme_email?: string, acmeMode?: 'staging' | 'live', shareClient?: ShareClientInterface) {
|
|
25
|
+
// super();
|
|
26
|
+
// this.shareClient = shareClient;
|
|
27
|
+
// this.acme_email = acme_email;
|
|
28
|
+
// this.acme_directory = acmeMode === 'live'
|
|
29
|
+
// ? 'https://acme-v02.api.letsencrypt.org/directory'
|
|
30
|
+
// : 'https://acme-staging-v02.api.letsencrypt.org/directory';
|
|
31
|
+
// }
|
|
32
|
+
// exists(domain: string, company: string, project: string) {
|
|
33
|
+
// return this.model.db.countDocuments({ domains: { $in: [domain] }, company, project });
|
|
34
|
+
// }
|
|
35
|
+
// /**
|
|
36
|
+
// * gets a valid domain based certificate for the provided domain, if no certificate matches, a new one will be requested
|
|
37
|
+
// */
|
|
38
|
+
// async getOrRequest(domain: string, company: string, project: string, user: string, app: string):
|
|
39
|
+
// Promise<{ type: 'certificate', data: BasicData<Certificate> } | { type: 'request', data: BasicData<CertificateAction>['_id'] }> {
|
|
40
|
+
// const certificate = await this.model.db.findOne({
|
|
41
|
+
// domains: {
|
|
42
|
+
// $in: [domain],
|
|
43
|
+
// },
|
|
44
|
+
// 'valid.from': { $lte: new Date() },
|
|
45
|
+
// 'valid.to': { $gte: new Date() },
|
|
46
|
+
// company,
|
|
47
|
+
// project,
|
|
48
|
+
// });
|
|
49
|
+
// if (certificate) return { type: 'certificate', data: certificate };
|
|
50
|
+
// const request = await certificatesActionsService.request(
|
|
51
|
+
// [domain],
|
|
52
|
+
// 'domain',
|
|
53
|
+
// 'pem',
|
|
54
|
+
// true,
|
|
55
|
+
// {
|
|
56
|
+
// company,
|
|
57
|
+
// project,
|
|
58
|
+
// user,
|
|
59
|
+
// app,
|
|
60
|
+
// timeout: 120,
|
|
61
|
+
// forceFile: true,
|
|
62
|
+
// },
|
|
63
|
+
// );
|
|
64
|
+
// return {
|
|
65
|
+
// type: 'request',
|
|
66
|
+
// data: request._id,
|
|
67
|
+
// };
|
|
68
|
+
// }
|
|
69
|
+
// async getOrRequestWildcard(domain: string, options: Required<UserApp> & { forceFile?: boolean, saveInVault?: boolean }):
|
|
70
|
+
// Promise<{ type: 'certificate', data: BasicData<Certificate> } | { type: 'request', data: BasicData<CertificateAction>['_id'] }> {
|
|
71
|
+
// const certificate = await this.model.db.findOne({ domains: { $in: [domain] } });
|
|
72
|
+
// if (certificate) return { type: 'certificate', data: certificate };
|
|
73
|
+
// const request = await certificatesActionsService.request(
|
|
74
|
+
// [domain],
|
|
75
|
+
// 'wildcard',
|
|
76
|
+
// 'pem',
|
|
77
|
+
// true,
|
|
78
|
+
// options,
|
|
79
|
+
// );
|
|
80
|
+
// return {
|
|
81
|
+
// type: 'request',
|
|
82
|
+
// data: request._id,
|
|
83
|
+
// };
|
|
84
|
+
// }
|
|
85
|
+
// getCertificateDetails(cert: string): PeerCertificate {
|
|
86
|
+
// const secureContext = tls.createSecureContext({ cert });
|
|
87
|
+
// const secureSocket = new tls.TLSSocket(new net.Socket(), { secureContext });
|
|
88
|
+
// const details = secureSocket.getCertificate() as PeerCertificate;
|
|
89
|
+
// secureSocket.destroy();
|
|
90
|
+
// return details;
|
|
91
|
+
// }
|
|
92
|
+
// async getBase(inputDomains: string[], type: 'wildcard' | 'domain', privateKey: string, privateServerKey: string) {
|
|
93
|
+
// const domains = type === 'wildcard' ? [`*.${inputDomains[0]}`] : inputDomains;
|
|
94
|
+
// const acme = ACME.create({ maintainerEmail: this.acme_email, packageAgent: 'lilastudio/v1.4', notify: () => { } });
|
|
95
|
+
// await acme.init(this.acme_directory);
|
|
96
|
+
// const accountKey = await Keypairs.import({ pem: privateKey });
|
|
97
|
+
// const serverKey = await Keypairs.import({ pem: privateServerKey });
|
|
98
|
+
// const account = await acme.accounts.create({ accountKey, subscriberEmail: this.acme_email, agreeToTerms: true });
|
|
99
|
+
// const der = await CSR.csr(
|
|
100
|
+
// {
|
|
101
|
+
// domains,
|
|
102
|
+
// jwk: serverKey,
|
|
103
|
+
// encoding: 'der',
|
|
104
|
+
// },
|
|
105
|
+
// );
|
|
106
|
+
// const csr = await PEM.packBlock({ type: 'CERTIFICATE REQUEST', bytes: der });
|
|
107
|
+
// return {
|
|
108
|
+
// acme,
|
|
109
|
+
// account,
|
|
110
|
+
// accountKey,
|
|
111
|
+
// csr,
|
|
112
|
+
// domains,
|
|
113
|
+
// };
|
|
114
|
+
// }
|
|
115
|
+
// /**
|
|
116
|
+
// * creates a letsencrypt wildcard SSL certificate on the given azure subscription
|
|
117
|
+
// */
|
|
118
|
+
// async createWildcard(
|
|
119
|
+
// domain: string,
|
|
120
|
+
// privateKey: string,
|
|
121
|
+
// privateServerKey: string,
|
|
122
|
+
// credentials: ClientSecretCredential | DefaultAzureCredential,
|
|
123
|
+
// azureSubscriptionId: string,
|
|
124
|
+
// ) {
|
|
125
|
+
// const optionsBase = await this.getBase([domain], 'wildcard', privateKey, privateServerKey);
|
|
126
|
+
// const options = {
|
|
127
|
+
// account: optionsBase.account,
|
|
128
|
+
// accountKey: optionsBase.accountKey,
|
|
129
|
+
// csr: optionsBase.csr,
|
|
130
|
+
// domains: optionsBase.domains,
|
|
131
|
+
// challenges: {
|
|
132
|
+
// 'dns-01': new DnsSslChallenge(domain, credentials, process.env.AZURE_RESOURCE_GROUP as string, azureSubscriptionId),
|
|
133
|
+
// },
|
|
134
|
+
// };
|
|
135
|
+
// const certificate: WildcardCertificates = await optionsBase.acme.certificates.create(options);
|
|
136
|
+
// const crypto = new X509Certificate(`${certificate.cert}\n${certificate.chain}\n`);
|
|
137
|
+
// certificate.valid = {
|
|
138
|
+
// from: new Date(crypto.validFrom),
|
|
139
|
+
// to: new Date(crypto.validTo),
|
|
140
|
+
// };
|
|
141
|
+
// return certificate;
|
|
142
|
+
// }
|
|
143
|
+
// convertToPfx(certificate: string, privateKey: string, tempName: string) {
|
|
144
|
+
// return new Promise<Buffer>((resolve, reject) => {
|
|
145
|
+
// exec(`openssl pkcs12 -export -passout pass: -inkey <(echo "${privateKey}") -in <(echo "${certificate}") -out ${tempName}.pfx`, { timeout: 5000 }, (e, stdout, stderr) => {
|
|
146
|
+
// // if (this.debug) {
|
|
147
|
+
// logger.debug('stdout ', stdout);
|
|
148
|
+
// logger.debug('stderr ', stderr);
|
|
149
|
+
// // }
|
|
150
|
+
// if (e instanceof Error) {
|
|
151
|
+
// return reject(e);
|
|
152
|
+
// }
|
|
153
|
+
// const content = fs.readFileSync(`${tempName}.pfx`);
|
|
154
|
+
// fs.rm(`${tempName}.pfx`, () => {});
|
|
155
|
+
// return resolve(content);
|
|
156
|
+
// });
|
|
157
|
+
// });
|
|
158
|
+
// }
|
|
159
|
+
// /**
|
|
160
|
+
// * creates a letsencrypt certificate for all given domain
|
|
161
|
+
// * http challenge will be used
|
|
162
|
+
// */
|
|
163
|
+
// async createSSl(
|
|
164
|
+
// domains: string[],
|
|
165
|
+
// company: string,
|
|
166
|
+
// project: string,
|
|
167
|
+
// privateKey: string,
|
|
168
|
+
// privateServerKey: string,
|
|
169
|
+
// ) {
|
|
170
|
+
// if (!this.shareClient) throw new Error('SHARECLIENT_NOT_INITIALIZED');
|
|
171
|
+
// const optionsBase = await this.getBase(domains, 'domain', privateKey, privateServerKey);
|
|
172
|
+
// const options = {
|
|
173
|
+
// account: optionsBase.account,
|
|
174
|
+
// accountKey: optionsBase.accountKey,
|
|
175
|
+
// csr: optionsBase.csr,
|
|
176
|
+
// domains: optionsBase.domains,
|
|
177
|
+
// challenges: {
|
|
178
|
+
// 'http-01': new HttpSslChallenge(company, project, this.shareClient),
|
|
179
|
+
// },
|
|
180
|
+
// };
|
|
181
|
+
// const certificate: WildcardCertificates = await optionsBase.acme.certificates.create(options);
|
|
182
|
+
// const crypto = new X509Certificate(`${certificate.cert}\n${certificate.chain}\n`);
|
|
183
|
+
// certificate.valid = {
|
|
184
|
+
// from: new Date(crypto.validFrom),
|
|
185
|
+
// to: new Date(crypto.validTo),
|
|
186
|
+
// };
|
|
187
|
+
// return certificate;
|
|
188
|
+
// }
|
|
189
|
+
// /**
|
|
190
|
+
// * calls ``http://DOMAIN/.studio/check/`` to check if the response code is 202
|
|
191
|
+
// */
|
|
192
|
+
// checkResponses(domains: string[]) {
|
|
193
|
+
// const PromiseArray = domains.map((single) => fetch(`http://${single}/.studio/check/`, { timeout: 5000 }));
|
|
194
|
+
// return Promise.all(PromiseArray)
|
|
195
|
+
// .then((responses) => responses.filter((single) => single.status !== 202).length === 0);
|
|
196
|
+
// }
|
|
197
|
+
// }
|
|
198
|
+
// export default new CertificatesService();
|
|
169
199
|
//# sourceMappingURL=certificates.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"certificates.service.js","sourceRoot":"","sources":["../../../src/services/certificates.service.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"certificates.service.js","sourceRoot":"","sources":["../../../src/services/certificates.service.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,yBAAyB;AACzB,oFAAoF;AACpF,uBAAuB;AACvB,iCAAiC;AACjC,+BAA+B;AAC/B,sC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AAEzF,4BAA4B;AAC5B,0CAA0C;AAC1C,sCAAsC;AACtC,SAAS;AAET,0BAA0B;AAE1B,MAAM;AAEN,QAAQ;AACR,mFAAmF;AACnF,QAAQ;AACR,wCAAwC;AAExC,iHAAiH;AAEjH,uCAAuC;AACvC,gGAAgG;AAEhG,MAAM;AAEN,IAAI;AACJ,4CAA4C"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { QueueClient, QueueServiceClient } from '@azure/storage-queue';
|
|
2
|
-
import { ObjectId } from 'mongodb';
|
|
3
|
-
import Immutable from '../Immutable.class.js';
|
|
4
|
-
import { CertificateAction, Certificate, BasicData, CertificateActionResult, CreateResult, ListCustomQueries, Options, SkipLimitSort, UserApp, UserAppWithOptions } from '@lilaquadrat/interfaces';
|
|
5
|
-
export declare class CertificatesActionsService extends Immutable<CertificateAction> {
|
|
6
|
-
model: import("../classes/modelv2.class.js").default<CertificateAction, import("../models/certificate-action.model.js").CertificateActions>;
|
|
7
|
-
service: QueueServiceClient;
|
|
8
|
-
client: QueueClient;
|
|
9
|
-
constructor(connectionString: string, storageAccount?: string);
|
|
10
|
-
request(domains: CertificateAction['domains'], type: 'domain', contentType: CertificateAction['contentType'], renew: boolean, options: Required<UserApp> & Required<Options> & {
|
|
11
|
-
timeout?: number;
|
|
12
|
-
forceFile?: CertificateAction['forceFile'];
|
|
13
|
-
saveInVault?: CertificateAction['saveInVault'];
|
|
14
|
-
}): Promise<CreateResult<CertificateAction>>;
|
|
15
|
-
request(domains: CertificateAction['domains'], type: 'wildcard', contentType: CertificateAction['contentType'], renew: boolean, options: Required<UserApp> & {
|
|
16
|
-
timeout?: number;
|
|
17
|
-
forceFile?: CertificateAction['forceFile'];
|
|
18
|
-
saveInVault?: CertificateAction['saveInVault'];
|
|
19
|
-
}): Promise<CreateResult<CertificateAction>>;
|
|
20
|
-
planRenew(certificate: Certificate, validPercent: number, options: Required<UserApp> & Options & {
|
|
21
|
-
timeout?: number;
|
|
22
|
-
forceFile?: CertificateAction['forceFile'];
|
|
23
|
-
saveInVault?: CertificateAction['saveInVault'];
|
|
24
|
-
}): Promise<void> | Promise<CreateResult<BasicData<CertificateAction>>>;
|
|
25
|
-
planRetry(certificateAction: BasicData<CertificateAction>, error: CertificateActionResult, retryTimeout: number | undefined, user: string, app: string): Promise<boolean>;
|
|
26
|
-
addToQueue(actionInternalId: ObjectId, visibilityTimeout?: number): Promise<import("@azure/storage-queue").QueueSendMessageResponse>;
|
|
27
|
-
single(actionInternalId: ObjectId): Promise<import("mongodb").WithId<CertificateAction> | null>;
|
|
28
|
-
latest(domain: string, company: string, project: string): Promise<import("mongodb").WithId<CertificateAction>>;
|
|
29
|
-
getPlanned(): Promise<import("mongodb").WithId<CertificateAction>[]>;
|
|
30
|
-
handlePlanned(): Promise<Promise<import("@azure/storage-queue").QueueSendMessageResponse>[]>;
|
|
31
|
-
setState(actionInternalId: ObjectId, state: CertificateAction['state'], user: string, app: string): Promise<import("mongodb").UpdateResult<BasicData<CertificateAction>>>;
|
|
32
|
-
setResult(actionInternalId: ObjectId, result: CertificateActionResult, state: CertificateAction['state'], user: string, app: string): Promise<import("mongodb").UpdateResult<BasicData<CertificateAction>>>;
|
|
33
|
-
getCustomQuery(filter: {
|
|
34
|
-
domain?: string;
|
|
35
|
-
state?: CertificateAction['state'];
|
|
36
|
-
}, options: UserAppWithOptions & SkipLimitSort): ListCustomQueries<CertificateAction>;
|
|
37
|
-
actionExistsForDomain(domain: string): Promise<boolean>;
|
|
38
|
-
cancel(internalId: ObjectId, options: Required<UserApp>): Promise<import("mongodb").UpdateResult<BasicData<CertificateAction>>>;
|
|
39
|
-
}
|
|
40
|
-
declare const _default: CertificatesActionsService;
|
|
41
|
-
export default _default;
|