@serve.zone/interfaces 32.86.0 → 32.88.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.md +15 -0
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/data/gateway.d.ts +20 -0
- package/dist_ts/data/gateway.js +125 -1
- package/dist_ts/data/gatewayareas.d.ts +891 -0
- package/dist_ts/data/gatewayareas.js +298 -0
- package/dist_ts/data/gatewayareas.validation.d.ts +133 -0
- package/dist_ts/data/gatewayareas.validation.js +1832 -0
- package/dist_ts/data/gatewayconnector.d.ts +73 -1
- package/dist_ts/data/gatewayconnector.js +145 -2
- package/dist_ts/data/index.d.ts +2 -0
- package/dist_ts/data/index.js +3 -1
- package/dist_ts/private/enginekeyentries.d.ts +17 -0
- package/dist_ts/private/enginekeyentries.js +34 -0
- package/dist_ts/requests/gatewayconnector.d.ts +44 -0
- package/package.json +2 -2
- package/readme.md +161 -3
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/data/gateway.ts +149 -0
- package/ts/data/gatewayareas.ts +1135 -0
- package/ts/data/gatewayareas.validation.ts +2100 -0
- package/ts/data/gatewayconnector.ts +186 -0
- package/ts/data/index.ts +2 -0
- package/ts/private/enginekeyentries.ts +38 -0
- package/ts/requests/gatewayconnector.ts +45 -0
|
@@ -0,0 +1,1135 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The typed content of the five gateway configuration areas (Linus rulings 117 §2 and 121): what
|
|
3
|
+
* `IGatewayAreaTable.content` and `IGatewayAreaExport.content` hold for each area name of
|
|
4
|
+
* `gatewayConfigAreaApplyOrder`. `validateGatewayAreaTables` (`gatewayareas.validation.ts`) judges
|
|
5
|
+
* a document's contents; both sides digest a table with `computeGatewayAreaTableDigest` unchanged.
|
|
6
|
+
*
|
|
7
|
+
* Intent only. A table holds what an operator, a gateway client or the controller authored. What a
|
|
8
|
+
* gateway derives from intent plus live state stays on the gateway and is never exported or pushed
|
|
9
|
+
* (`managedBy` DNS records, ACME challenge records, DKIM public records and active selectors,
|
|
10
|
+
* redirects, SmartProxy's run-time HTTP-01 answers, reactive blocks, `email`/`dns` system routes),
|
|
11
|
+
* and so do observed state (provider zone listings and mirrored provider records, delegation
|
|
12
|
+
* evidence, provider health) and local state (VPN keys and clients, DKIM private keys, the ACME
|
|
13
|
+
* account and certificate store, spool, logs, stats, testing, connector state, host facts).
|
|
14
|
+
*
|
|
15
|
+
* Canonical form, every area, both sides:
|
|
16
|
+
*
|
|
17
|
+
* - An area's content is one object with exactly the members its type names.
|
|
18
|
+
* - A member is either a row list or a singleton. A row list holds objects with a string `id`,
|
|
19
|
+
* strictly ascending by `compareWireTokens` (so each `id` once); rows hold no nested row lists.
|
|
20
|
+
* A singleton is one object or `null`, except the `edges` hub and the `mail` server settings,
|
|
21
|
+
* which are always an object (`IGatewayEdgesArea.hub`, `IGatewayMailArea.server`). No row list carries meaning in its order: where order
|
|
22
|
+
* matters it is data (`IGatewayDnsServerSettings.primaryNameserver`).
|
|
23
|
+
* - Exact keys. An absent value is `null`, never a missing key or `undefined`. Where the gateway
|
|
24
|
+
* reads an absent list as an empty one (its documentation says so per member), the canonical form
|
|
25
|
+
* is the empty list and never `null`, so one meaning has one spelling.
|
|
26
|
+
* - A set inside a typed member is strictly ascending (`compareWireTokens` for strings, numeric
|
|
27
|
+
* for numbers, the member's stated order for objects). A list whose order carries meaning
|
|
28
|
+
* (`sourceBindings`, `extendsProfiles`, a network target's hosts) keeps its stated order.
|
|
29
|
+
* Arrays inside engine configuration keep their stated order.
|
|
30
|
+
* - Numbers are safe integers; strings are Unicode scalar strings (`createGatewayAreaTableDigestInput`).
|
|
31
|
+
* - No time stamps, authors, counters of the gateway's own bookkeeping, resolution snapshots or
|
|
32
|
+
* observed values. No record value in a row id.
|
|
33
|
+
* - One meaning has one spelling also where two authors write it (the gateway's exporter before a
|
|
34
|
+
* takeover, the controller's compile after it), or every push would move the digest: a route's
|
|
35
|
+
* `match.ports` is the list `canonicalizeGatewayRoutePorts` answers and a route target's `port` an
|
|
36
|
+
* integer or `'preserve'` (`IGatewayRouteRow.route`); an edge setting that states nothing is `null`,
|
|
37
|
+
* never an object of `null` members or an empty list (`IGatewayEdgePerformance`, `IGatewayEdgeEgress`
|
|
38
|
+
* members). Where `null` and an object would mean the same, the object is canonical and the member
|
|
39
|
+
* is never `null` (Linus ruling 128, B2): the mail server's `emailPortConfig` (none is
|
|
40
|
+
* `{ portMapping: null, portSettings: {} }`) and an edge's `egress` (the gateway reads no policy as
|
|
41
|
+
* a disabled one, so off is the disabled policy).
|
|
42
|
+
*
|
|
43
|
+
* Engine configuration (`TGatewayEngineConfig`) is configuration whose type another engine owns:
|
|
44
|
+
* SmartProxy (routes, route security, rate limits, challenges, the proxy security policy), SmartMTA
|
|
45
|
+
* (`emailConfig`). It travels as a strict JSON object; the gateway judges its engine semantics in
|
|
46
|
+
* the same check-first pass (`invalid-table`). Every type dcrouter declares is typed exactly here,
|
|
47
|
+
* not only those in its `ts_interfaces`, and so are the remote-ingress shapes it stores in its own
|
|
48
|
+
* documents (Linus rulings 121 Q15 and 124 §2). The secrets the gateway needs are lifted into typed
|
|
49
|
+
* sealed members. What is enforced where (Linus ruling 124, part 2):
|
|
50
|
+
*
|
|
51
|
+
* - This package refuses the closed key vocabulary `gatewayAreaRefusedEngineKeys` (secret names,
|
|
52
|
+
* host-path names, header-injection members) at any depth of every engine configuration, record
|
|
53
|
+
* keys included (`validateGatewayAreaTables`). It does not know the engine types and does not claim
|
|
54
|
+
* that a name outside the vocabulary is safe.
|
|
55
|
+
* - Completeness against the engine types is the gateway's: dcrouter classifies every member of its
|
|
56
|
+
* pinned SmartProxy and SmartMTA types, checked against those types (every secret or host-path
|
|
57
|
+
* member's name is in the vocabulary, no safe member's name is), refuses a stored engine path it has
|
|
58
|
+
* not classified by name at export, and refuses one as `invalid-table` at apply.
|
|
59
|
+
*
|
|
60
|
+
* Canonical spelling is the author's: the gateway's exporter and, after takeover, the controller's
|
|
61
|
+
* compile write the canonical form. The validators judge it and never rewrite a value.
|
|
62
|
+
*
|
|
63
|
+
* Secret classes:
|
|
64
|
+
*
|
|
65
|
+
* - `sealed` (`IGatewaySealedValue`): a value the gateway needs in plaintext to serve. It travels in
|
|
66
|
+
* the table over the authenticated connector socket and is sealed at rest in Cloudly: DNS provider
|
|
67
|
+
* API tokens, route and mail TLS keys, route and source profile basic-auth user lists and JWT
|
|
68
|
+
* secrets, route request headers, remote ingress edge secrets.
|
|
69
|
+
* - `verifier`: a credential the gateway only checks, carried as its verifier and never as the
|
|
70
|
+
* secret: API token hashes (`IGatewayTokenHash`), SMTP and WorkApp SCRAM verifiers
|
|
71
|
+
* (`IGatewayScramVerifier`), CoreMail argon2id verifiers (`IGatewayCoreMailCredentialVerifier`).
|
|
72
|
+
* - Revisions, diffs, logs and refusals name row ids, member paths and sealed versions, never a
|
|
73
|
+
* value (`listGatewayAreaSecrets`).
|
|
74
|
+
*
|
|
75
|
+
* Hard references are validated: a missing target would widen access or leave a row unservable.
|
|
76
|
+
* They are exactly `routes.routes[].metadata.networkTargetRef` (→ `routes.networkTargets`),
|
|
77
|
+
* `routes.routes[].metadata.sourceBindings[].sourceProfileRef` and
|
|
78
|
+
* `routes.sourceProfiles[].extendsProfiles[]` (→ `routes.sourceProfiles`),
|
|
79
|
+
* `dns.records[].domainId` (→ a `dcrouter`-source row of `dns.domains`),
|
|
80
|
+
* `dns.domains[].providerId` (→ `dns.providers`) and the cross-area
|
|
81
|
+
* `mail.domains[].linkedDomainId` (→ `dns.domains`), plus `dns.server.primaryNameserver`
|
|
82
|
+
* (→ `dns.nameservers`). Cross-area references point backwards in apply order and are judged per
|
|
83
|
+
* whole document. Every other reference is soft and resolves to nothing when its target is absent:
|
|
84
|
+
* target profile `routeRefs`, edge filters (edge ids or tags), VPN client ids in route security,
|
|
85
|
+
* gateway client ids in attributions and token policies, CoreMail service ids, mail identity
|
|
86
|
+
* domains, `disabledSystemRoutes`.
|
|
87
|
+
*/
|
|
88
|
+
|
|
89
|
+
import type { TCoreMailCredentialState, TCoreMailCredentialVerifierFormat } from './coremail.js';
|
|
90
|
+
import type {
|
|
91
|
+
IGatewayTokenCapabilities,
|
|
92
|
+
TGatewayClientType,
|
|
93
|
+
TGatewayRouteDnsMode,
|
|
94
|
+
TGatewayTokenRole,
|
|
95
|
+
TManagedRouteKind,
|
|
96
|
+
} from './gateway.js';
|
|
97
|
+
import type { TGatewayConfigArea } from './gatewayconnector.js';
|
|
98
|
+
|
|
99
|
+
// ---------------------------------------------------------------------------------------------
|
|
100
|
+
// Bounds and vocabulary
|
|
101
|
+
// ---------------------------------------------------------------------------------------------
|
|
102
|
+
|
|
103
|
+
/** The bounds every area content obeys; `validateGatewayAreaTables` refuses beyond them. */
|
|
104
|
+
export const gatewayAreaContentContract = Object.freeze({
|
|
105
|
+
/** A row id: 1 to this many UTF-16 code units, no control character. */
|
|
106
|
+
maximumRowIdLength: 256,
|
|
107
|
+
/** A name, a username, a hostname pattern or another short text. */
|
|
108
|
+
maximumNameLength: 256,
|
|
109
|
+
/** A description or a reason. */
|
|
110
|
+
maximumTextLength: 1024,
|
|
111
|
+
/** A sealed value's `value`, in UTF-16 code units. */
|
|
112
|
+
maximumSealedValueLength: 16_384,
|
|
113
|
+
/** A DNS record value, in UTF-16 code units. */
|
|
114
|
+
maximumRecordValueLength: 8192,
|
|
115
|
+
/** One engine configuration object, as the length of its strict canonical JSON. */
|
|
116
|
+
maximumEngineConfigLength: 65_536,
|
|
117
|
+
/** Entries of a set or ordered list inside a row (scopes, tags, ports, filters, bindings). */
|
|
118
|
+
maximumListEntries: 1024,
|
|
119
|
+
/** Rows per member. */
|
|
120
|
+
maximumRows: Object.freeze({
|
|
121
|
+
security: Object.freeze({ blockRules: 4096, apiTokens: 1024 }),
|
|
122
|
+
dns: Object.freeze({
|
|
123
|
+
nameservers: 16,
|
|
124
|
+
providers: 64,
|
|
125
|
+
domains: 1024,
|
|
126
|
+
records: 65_536,
|
|
127
|
+
staticRecords: 1024,
|
|
128
|
+
protectedHostnames: 4096,
|
|
129
|
+
authorityZones: 1024,
|
|
130
|
+
clientHostnames: 4096,
|
|
131
|
+
}),
|
|
132
|
+
routes: Object.freeze({
|
|
133
|
+
routes: 4096,
|
|
134
|
+
sourceProfiles: 1024,
|
|
135
|
+
networkTargets: 1024,
|
|
136
|
+
targetProfiles: 1024,
|
|
137
|
+
disabledSystemRoutes: 1024,
|
|
138
|
+
}),
|
|
139
|
+
mail: Object.freeze({ domains: 1024, smtpAccounts: 1024, identities: 16_384, coreMailPeers: 256 }),
|
|
140
|
+
edges: Object.freeze({ edges: 256 }),
|
|
141
|
+
}),
|
|
142
|
+
} as const);
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* The API token scopes a gateway (dcrouter) knows, in its own order: the vocabulary a controller
|
|
146
|
+
* mints from. A table carries any scope of the scope syntax (`isGatewayApiTokenScope`), and a scope
|
|
147
|
+
* the gateway does not know authorizes nothing, so a newer scope never makes a table invalid.
|
|
148
|
+
*/
|
|
149
|
+
export const gatewayApiTokenScopes = Object.freeze([
|
|
150
|
+
'*',
|
|
151
|
+
'routes:read',
|
|
152
|
+
'routes:write',
|
|
153
|
+
'config:read',
|
|
154
|
+
'stats:read',
|
|
155
|
+
'logs:read',
|
|
156
|
+
'config-events:read',
|
|
157
|
+
'config-events:write',
|
|
158
|
+
'security:read',
|
|
159
|
+
'security:write',
|
|
160
|
+
'emails:read',
|
|
161
|
+
'emails:write',
|
|
162
|
+
'certificates:read',
|
|
163
|
+
'certificates:write',
|
|
164
|
+
'tokens:read',
|
|
165
|
+
'tokens:manage',
|
|
166
|
+
'users:read',
|
|
167
|
+
'users:manage',
|
|
168
|
+
'source-profiles:read',
|
|
169
|
+
'source-profiles:write',
|
|
170
|
+
'target-profiles:read',
|
|
171
|
+
'target-profiles:write',
|
|
172
|
+
'targets:read',
|
|
173
|
+
'targets:write',
|
|
174
|
+
'dns-providers:read',
|
|
175
|
+
'dns-providers:write',
|
|
176
|
+
'domains:read',
|
|
177
|
+
'domains:write',
|
|
178
|
+
'dns-authority:read',
|
|
179
|
+
'dns-authority:write',
|
|
180
|
+
'dns-records:read',
|
|
181
|
+
'dns-records:write',
|
|
182
|
+
'acme-config:read',
|
|
183
|
+
'acme-config:write',
|
|
184
|
+
'email-domains:read',
|
|
185
|
+
'email-domains:write',
|
|
186
|
+
'smtp-accounts:read',
|
|
187
|
+
'smtp-accounts:write',
|
|
188
|
+
'remote-ingress:read',
|
|
189
|
+
'remote-ingress:write',
|
|
190
|
+
'vpn:read',
|
|
191
|
+
'vpn:write',
|
|
192
|
+
'radius:read',
|
|
193
|
+
'radius:write',
|
|
194
|
+
'gateway-clients:read',
|
|
195
|
+
'gateway-clients:write',
|
|
196
|
+
'workhosters:read',
|
|
197
|
+
'workhosters:write',
|
|
198
|
+
'testing:read',
|
|
199
|
+
'testing:write',
|
|
200
|
+
'testing:manage',
|
|
201
|
+
] as const);
|
|
202
|
+
|
|
203
|
+
/** One scope of `gatewayApiTokenScopes`. */
|
|
204
|
+
export type TGatewayApiTokenScope = typeof gatewayApiTokenScopes[number];
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* The scope syntax: `*`, or `<resource>:<action>` where each part is a lowercase letter followed by
|
|
208
|
+
* lowercase letters, digits or hyphens; at most 64 characters.
|
|
209
|
+
*/
|
|
210
|
+
export const isGatewayApiTokenScope = (valueArg: unknown): valueArg is string => (
|
|
211
|
+
typeof valueArg === 'string'
|
|
212
|
+
&& valueArg.length <= 64
|
|
213
|
+
&& (valueArg === '*' || /^[a-z][a-z0-9-]*:[a-z][a-z0-9-]*$/.test(valueArg))
|
|
214
|
+
);
|
|
215
|
+
|
|
216
|
+
/** The iteration count of every WorkApp mail identity verifier (Linus ruling 121, Q10). */
|
|
217
|
+
export const gatewayMailIdentityScramIterations = 4096;
|
|
218
|
+
|
|
219
|
+
// ---------------------------------------------------------------------------------------------
|
|
220
|
+
// Shared shapes
|
|
221
|
+
// ---------------------------------------------------------------------------------------------
|
|
222
|
+
|
|
223
|
+
/** A JSON value in strict canonical form: safe integers only, no `undefined`. */
|
|
224
|
+
export type TGatewayStrictJsonValue =
|
|
225
|
+
| null
|
|
226
|
+
| boolean
|
|
227
|
+
| number
|
|
228
|
+
| string
|
|
229
|
+
| TGatewayStrictJsonValue[]
|
|
230
|
+
| { [key: string]: TGatewayStrictJsonValue };
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Configuration whose type SmartProxy or SmartMTA owns, carried as a strict JSON object. Its keys
|
|
234
|
+
* follow the engine's own type (an absent engine member is an absent key); its arrays keep their
|
|
235
|
+
* stated order.
|
|
236
|
+
*/
|
|
237
|
+
export type TGatewayEngineConfig = { [key: string]: TGatewayStrictJsonValue };
|
|
238
|
+
|
|
239
|
+
/** A row of a row list that holds nothing but its key. */
|
|
240
|
+
export interface IGatewayAreaKeyRow {
|
|
241
|
+
id: string;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* A secret the gateway needs in plaintext (secret class `sealed`).
|
|
246
|
+
*
|
|
247
|
+
* `version` is minted by whoever sets `value` (a controller write, or a gateway's local write and
|
|
248
|
+
* its 34.9.0 data step before the takeover) and stored beside it; a new value gets a new version
|
|
249
|
+
* and an export never mints one. Revisions, diffs, logs and refusals carry the version, never the
|
|
250
|
+
* value; the version also salts the table digest against guessing a weak value. The same version
|
|
251
|
+
* with a different value than the one a gateway stored is the gateway's `invalid-table` refusal:
|
|
252
|
+
* a validator over one document cannot see it.
|
|
253
|
+
*/
|
|
254
|
+
export interface IGatewaySealedValue {
|
|
255
|
+
/** 22 base64url characters (128 random bits). */
|
|
256
|
+
version: string;
|
|
257
|
+
/** 1 to `gatewayAreaContentContract.maximumSealedValueLength` characters. */
|
|
258
|
+
value: string;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/** The verifier of an API token: the lowercase hex SHA-256 of the token (secret class `verifier`). */
|
|
262
|
+
export interface IGatewayTokenHash {
|
|
263
|
+
algorithm: 'sha256';
|
|
264
|
+
/** 64 lowercase hex digits. */
|
|
265
|
+
hash: string;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* A SCRAM-SHA-256 verifier (RFC 5802/7677 stored form, SmartMTA's `ISmtpScramVerifier`; secret
|
|
270
|
+
* class `verifier`). A WorkApp mail identity's verifier uses
|
|
271
|
+
* `gatewayMailIdentityScramIterations` iterations.
|
|
272
|
+
*/
|
|
273
|
+
export interface IGatewayScramVerifier {
|
|
274
|
+
algorithm: 'SCRAM-SHA-256';
|
|
275
|
+
/** Canonical padded base64 of the PBKDF2 salt, 16 to 64 bytes. */
|
|
276
|
+
salt: string;
|
|
277
|
+
/** 4096 to 1000000. */
|
|
278
|
+
iterations: number;
|
|
279
|
+
/** Canonical padded base64 of 32 bytes. */
|
|
280
|
+
storedKey: string;
|
|
281
|
+
/** Canonical padded base64 of 32 bytes. */
|
|
282
|
+
serverKey: string;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* A CoreMail binding credential verifier: `data.ICoreMailBindingCredentialVerifier` in canonical
|
|
287
|
+
* form, `acceptUntil` `null` exactly for a `current` credential (secret class `verifier`).
|
|
288
|
+
*/
|
|
289
|
+
export interface IGatewayCoreMailCredentialVerifier {
|
|
290
|
+
credentialId: string;
|
|
291
|
+
version: number;
|
|
292
|
+
state: TCoreMailCredentialState;
|
|
293
|
+
format: TCoreMailCredentialVerifierFormat;
|
|
294
|
+
/** The canonical argon2id PHC string (`normalizeCoreMailCredentialVerifier`). */
|
|
295
|
+
verificationHash: string;
|
|
296
|
+
/** Unix milliseconds, positive; `null` exactly for a `current` credential. */
|
|
297
|
+
acceptUntil: number | null;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* The gateway client that authored a client-authored row: routes, DNS hostname claims, mail
|
|
302
|
+
* identities and CoreMail peers carry this one shape. Gateway clients themselves are local to the
|
|
303
|
+
* gateway (frozen at takeover); the id is a soft reference.
|
|
304
|
+
*
|
|
305
|
+
* `appId` and `externalKey` are set on every row the client keyed, routes included (dcrouter stores
|
|
306
|
+
* both on every gateway-client route), and are `null` only where the gateway stored none: a DNS
|
|
307
|
+
* hostname claim has no `externalKey`, a CoreMail peer neither.
|
|
308
|
+
*/
|
|
309
|
+
export interface IGatewayRowClientAttribution {
|
|
310
|
+
gatewayClientType: TGatewayClientType;
|
|
311
|
+
/** `isGatewayClientIdText`. */
|
|
312
|
+
gatewayClientId: string;
|
|
313
|
+
/** The client's application. */
|
|
314
|
+
appId: string | null;
|
|
315
|
+
/** The client's own key for the row. */
|
|
316
|
+
externalKey: string | null;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// ---------------------------------------------------------------------------------------------
|
|
320
|
+
// security
|
|
321
|
+
// ---------------------------------------------------------------------------------------------
|
|
322
|
+
|
|
323
|
+
/** Block rule types, sorted. */
|
|
324
|
+
export const gatewayBlockRuleTypes = Object.freeze(['asn', 'cidr', 'ip', 'organization'] as const);
|
|
325
|
+
export type TGatewayBlockRuleType = typeof gatewayBlockRuleTypes[number];
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* One static block rule. The address set an `asn` or `organization` rule compiles to is derived on
|
|
329
|
+
* the gateway from its IP intelligence and never stored here.
|
|
330
|
+
*/
|
|
331
|
+
export interface IGatewayBlockRuleRow {
|
|
332
|
+
id: string;
|
|
333
|
+
type: TGatewayBlockRuleType;
|
|
334
|
+
value: string;
|
|
335
|
+
/** Set exactly on an `organization` rule (the gateway reads an absent mode as `contains`). */
|
|
336
|
+
matchMode: 'exact' | 'contains' | null;
|
|
337
|
+
reason: string | null;
|
|
338
|
+
enabled: boolean;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/** One host a gateway client token may route to (`data.IGatewayRouteTargetAllowance`, canonical). */
|
|
342
|
+
export interface IGatewayApiTokenRouteTarget {
|
|
343
|
+
host: string;
|
|
344
|
+
/** A set of ports, 1 to 65535, ascending. */
|
|
345
|
+
ports: number[];
|
|
346
|
+
/** The gateway reads an absent flag as `false`. */
|
|
347
|
+
allowAnyPort: boolean;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Every capability flag a gateway client token can carry (`data.IGatewayTokenCapabilities`),
|
|
352
|
+
* each stated: the gateway reads an absent flag as `false`.
|
|
353
|
+
*/
|
|
354
|
+
export type TGatewayApiTokenCapabilities = Required<IGatewayTokenCapabilities>;
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* A token's policy (dcrouter's `IApiTokenPolicy`), canonical. Testing credentials are local to the
|
|
358
|
+
* gateway, so `testingClient` is no role here. The gateway reads an absent list as an empty one
|
|
359
|
+
* and absent capabilities as all `false`; those are the canonical spellings.
|
|
360
|
+
*/
|
|
361
|
+
export interface IGatewayApiTokenPolicy {
|
|
362
|
+
role: TGatewayTokenRole;
|
|
363
|
+
/** Scopes the policy adds to the token's own; a canonical scope list (as the row's `scopes`). */
|
|
364
|
+
scopes: string[];
|
|
365
|
+
/** Set exactly on role `gatewayClient`: the client the token is bound to. */
|
|
366
|
+
gatewayClient: { type: TGatewayClientType; id: string; policyGeneration: number } | null;
|
|
367
|
+
/** A set of hostname patterns. */
|
|
368
|
+
hostnamePatterns: string[];
|
|
369
|
+
/** A set, ascending by `host`, then by `ports`, then `allowAnyPort`. */
|
|
370
|
+
allowedRouteTargets: IGatewayApiTokenRouteTarget[];
|
|
371
|
+
/** A set of canonical address prefixes (`validateGatewayAllowedDnsRecordAddresses`). */
|
|
372
|
+
allowedDnsRecordAddresses: string[];
|
|
373
|
+
capabilities: TGatewayApiTokenCapabilities;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* One API token the controller minted. The token itself is shown once at minting and never stored;
|
|
378
|
+
* the gateway checks a presented token against `credential` locally, controller away or not. The
|
|
379
|
+
* gateway's local tokens (its environment admin token `env-admin-token`, testing credentials) never
|
|
380
|
+
* appear here; a table row with a local token's id is the gateway's `invalid-table`.
|
|
381
|
+
*/
|
|
382
|
+
export interface IGatewayApiTokenRow {
|
|
383
|
+
id: string;
|
|
384
|
+
name: string;
|
|
385
|
+
credential: IGatewayTokenHash;
|
|
386
|
+
/** A canonical scope list: scope syntax (`isGatewayApiTokenScope`), strictly ascending. */
|
|
387
|
+
scopes: string[];
|
|
388
|
+
/** `null` for a token without a policy. */
|
|
389
|
+
policy: IGatewayApiTokenPolicy | null;
|
|
390
|
+
/** Unix milliseconds; `null` never expires. */
|
|
391
|
+
expiresAt: number | null;
|
|
392
|
+
enabled: boolean;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/** The `security` area. */
|
|
396
|
+
export interface IGatewaySecurityArea {
|
|
397
|
+
blockRules: IGatewayBlockRuleRow[];
|
|
398
|
+
apiTokens: IGatewayApiTokenRow[];
|
|
399
|
+
/** SmartProxy's static security policy (config.json `smartProxyConfig.securityPolicy`). */
|
|
400
|
+
proxyPolicy: TGatewayEngineConfig | null;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
// ---------------------------------------------------------------------------------------------
|
|
404
|
+
// dns
|
|
405
|
+
// ---------------------------------------------------------------------------------------------
|
|
406
|
+
|
|
407
|
+
/** The record types a gateway stores, sorted. */
|
|
408
|
+
export const gatewayDnsRecordTypes = Object.freeze(['A', 'AAAA', 'CAA', 'CNAME', 'MX', 'NS', 'SOA', 'TXT'] as const);
|
|
409
|
+
export type TGatewayDnsRecordType = typeof gatewayDnsRecordTypes[number];
|
|
410
|
+
|
|
411
|
+
/** The record types of a static record (config.json `dnsRecords`), sorted. */
|
|
412
|
+
export const gatewayDnsStaticRecordTypes = Object.freeze(['A', 'AAAA', 'CNAME', 'MX', 'NS', 'SOA', 'TXT'] as const);
|
|
413
|
+
export type TGatewayDnsStaticRecordType = typeof gatewayDnsStaticRecordTypes[number];
|
|
414
|
+
|
|
415
|
+
/** The gateway's own name service; `null` exactly when `nameservers` is empty. */
|
|
416
|
+
export interface IGatewayDnsServerSettings {
|
|
417
|
+
/** The SOA mname (config.json `dnsNsDomains[0]`): one of `nameservers`. */
|
|
418
|
+
primaryNameserver: string;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/** One DNS provider the gateway writes provider zones through. Cloudflare is the only type. */
|
|
422
|
+
export interface IGatewayDnsProviderRow {
|
|
423
|
+
id: string;
|
|
424
|
+
name: string;
|
|
425
|
+
credentials: { type: 'cloudflare'; apiToken: IGatewaySealedValue };
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* One zone. The provider's zone id, nameservers and last sync are observed and stay on the
|
|
430
|
+
* gateway; `authoritative` is derived. `source` and `providerId` never change under one id
|
|
431
|
+
* (`validateGatewayAreaContentChange`): moving a zone is a new row.
|
|
432
|
+
*/
|
|
433
|
+
export interface IGatewayDnsDomainRow {
|
|
434
|
+
id: string;
|
|
435
|
+
/** Lowercase zone name, no trailing dot; unique among the domains. */
|
|
436
|
+
name: string;
|
|
437
|
+
source: 'dcrouter' | 'provider';
|
|
438
|
+
/** A row of `providers`, set exactly on a `provider` zone. */
|
|
439
|
+
providerId: string | null;
|
|
440
|
+
description: string | null;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* One authored record of a `dcrouter`-source zone. Records of provider zones are the provider's
|
|
445
|
+
* (observed), and records a reconciler owns (`managedBy`) are derived; neither is ever here.
|
|
446
|
+
*/
|
|
447
|
+
export interface IGatewayDnsRecordRow {
|
|
448
|
+
id: string;
|
|
449
|
+
/** A `dcrouter`-source row of `domains`. */
|
|
450
|
+
domainId: string;
|
|
451
|
+
/**
|
|
452
|
+
* Inside its zone: the zone's `name` itself, or a name that ends in `.` and the zone's `name`,
|
|
453
|
+
* compared as written.
|
|
454
|
+
*/
|
|
455
|
+
name: string;
|
|
456
|
+
type: TGatewayDnsRecordType;
|
|
457
|
+
/**
|
|
458
|
+
* The record value in the gateway's value syntax. An `A` value is one dotted IPv4 address (four
|
|
459
|
+
* decimal octets of one to three digits, each at most 255) and an `AAAA` value one IPv6 address in
|
|
460
|
+
* hex groups of one to four digits, either case, eight groups or fewer with exactly one `::`, no
|
|
461
|
+
* IPv4 tail and no zone id: the forms the gateway's DNS encoder takes, with nothing around them.
|
|
462
|
+
*/
|
|
463
|
+
value: string;
|
|
464
|
+
/** Seconds, positive. */
|
|
465
|
+
ttl: number;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* One static record (config.json `dnsRecords`). Its id is derived from the record
|
|
470
|
+
* (`createGatewayDnsStaticRecordId`), never the record value itself.
|
|
471
|
+
*/
|
|
472
|
+
export interface IGatewayDnsStaticRecordRow {
|
|
473
|
+
/** `static-` followed by 64 lowercase hex digits. */
|
|
474
|
+
id: string;
|
|
475
|
+
name: string;
|
|
476
|
+
type: TGatewayDnsStaticRecordType;
|
|
477
|
+
/** As `IGatewayDnsRecordRow.value`, the `A` and `AAAA` forms included. */
|
|
478
|
+
value: string;
|
|
479
|
+
/** Seconds; `null` for the gateway's default. */
|
|
480
|
+
ttl: number | null;
|
|
481
|
+
/** `null` for the gateway's default (`true`). */
|
|
482
|
+
useIngressProxy: boolean | null;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
/** A hostname no automation may write at, except to release. */
|
|
486
|
+
export interface IGatewayDnsProtectedHostnameRow {
|
|
487
|
+
/** The exact hostname: lowercase, no trailing dot, no wildcard. */
|
|
488
|
+
id: string;
|
|
489
|
+
reason: string;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
/**
|
|
493
|
+
* A gateway client's claim on a hostname without a route. The record the gateway writes for it,
|
|
494
|
+
* its conflict outcome and the orphan verdict are derived on the gateway; once the controller owns
|
|
495
|
+
* dns a claim is served because it is in the table.
|
|
496
|
+
*/
|
|
497
|
+
export interface IGatewayDnsClientHostnameRow {
|
|
498
|
+
/** The hostname (`isGatewayClientHostname`). */
|
|
499
|
+
id: string;
|
|
500
|
+
/** `appId` set, `externalKey` `null`. */
|
|
501
|
+
client: IGatewayRowClientAttribution;
|
|
502
|
+
/** The address record the client asks for; `null` for a certificate-only claim. */
|
|
503
|
+
record: { type: 'A' | 'AAAA'; value: string; ttl: number } | null;
|
|
504
|
+
holdsCertificate: boolean;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
/** The certificate issuer. The ACME account and issued keys stay on the gateway. */
|
|
508
|
+
export interface IGatewayAcmeSettings {
|
|
509
|
+
accountEmail: string;
|
|
510
|
+
enabled: boolean;
|
|
511
|
+
useProduction: boolean;
|
|
512
|
+
/** Another CA's directory; `null` for Let's Encrypt. */
|
|
513
|
+
directoryUrl: string | null;
|
|
514
|
+
autoRenew: boolean;
|
|
515
|
+
/** Days, positive. */
|
|
516
|
+
renewThresholdDays: number;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
/** The `dns` area. */
|
|
520
|
+
export interface IGatewayDnsArea {
|
|
521
|
+
server: IGatewayDnsServerSettings | null;
|
|
522
|
+
/** The gateway's nameserver hostnames (config.json `dnsNsDomains`), keyed by hostname. */
|
|
523
|
+
nameservers: IGatewayAreaKeyRow[];
|
|
524
|
+
acme: IGatewayAcmeSettings | null;
|
|
525
|
+
providers: IGatewayDnsProviderRow[];
|
|
526
|
+
domains: IGatewayDnsDomainRow[];
|
|
527
|
+
records: IGatewayDnsRecordRow[];
|
|
528
|
+
staticRecords: IGatewayDnsStaticRecordRow[];
|
|
529
|
+
protectedHostnames: IGatewayDnsProtectedHostnameRow[];
|
|
530
|
+
/**
|
|
531
|
+
* Zones the gateway may answer for once it has proven their delegation itself, keyed by zone
|
|
532
|
+
* name. The proof and its evidence stay on the gateway; it serves the proven ones.
|
|
533
|
+
*/
|
|
534
|
+
authorityZones: IGatewayAreaKeyRow[];
|
|
535
|
+
clientHostnames: IGatewayDnsClientHostnameRow[];
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
// ---------------------------------------------------------------------------------------------
|
|
539
|
+
// routes
|
|
540
|
+
// ---------------------------------------------------------------------------------------------
|
|
541
|
+
|
|
542
|
+
/** dcrouter's route path classes, in its own order. */
|
|
543
|
+
export const gatewayRoutePathClasses = Object.freeze([
|
|
544
|
+
'git-smart-http', 'static', 'normal-html', 'expensive-html', 'raw', 'archive',
|
|
545
|
+
] as const);
|
|
546
|
+
export type TGatewayRoutePathClass = typeof gatewayRoutePathClasses[number];
|
|
547
|
+
|
|
548
|
+
/**
|
|
549
|
+
* A source-policy override of a profile member (dcrouter's tri-state): `inherit` keeps the
|
|
550
|
+
* profile's value (an absent member), `clear` removes it (`null`), `set` replaces it with `value`.
|
|
551
|
+
* `value` is set exactly for `set`; it is SmartProxy configuration (a rate limit or a challenge).
|
|
552
|
+
*/
|
|
553
|
+
export interface IGatewayRoutePolicyOverride {
|
|
554
|
+
mode: 'inherit' | 'clear' | 'set';
|
|
555
|
+
value: TGatewayEngineConfig | null;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
/** The answer a source policy gives when a limit is exceeded. */
|
|
559
|
+
export interface IGatewayRouteExceededAction {
|
|
560
|
+
type: '429';
|
|
561
|
+
errorMessage: string | null;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
/** One path-class variant inside a source binding (dcrouter's `IRoutePathPolicyBinding`). */
|
|
565
|
+
export interface IGatewayRoutePathPolicyBinding {
|
|
566
|
+
id: string | null;
|
|
567
|
+
pathClass: TGatewayRoutePathClass;
|
|
568
|
+
/** A set of path patterns; `null` for the class's built-in patterns. */
|
|
569
|
+
pathPatterns: string[] | null;
|
|
570
|
+
rateLimit: IGatewayRoutePolicyOverride;
|
|
571
|
+
challenge: IGatewayRoutePolicyOverride;
|
|
572
|
+
/** Non-negative; `null` inherits. */
|
|
573
|
+
maxConnections: number | null;
|
|
574
|
+
onExceeded: IGatewayRouteExceededAction | null;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
/** One source binding of a route (dcrouter's `IRouteSourceBinding` without its name snapshot). */
|
|
578
|
+
export interface IGatewayRouteSourceBinding {
|
|
579
|
+
id: string | null;
|
|
580
|
+
/** A row of `sourceProfiles` (hard reference). */
|
|
581
|
+
sourceProfileRef: string;
|
|
582
|
+
rateLimit: IGatewayRoutePolicyOverride;
|
|
583
|
+
challenge: IGatewayRoutePolicyOverride;
|
|
584
|
+
/** Non-negative; `null` inherits. */
|
|
585
|
+
maxConnections: number | null;
|
|
586
|
+
onExceeded: IGatewayRouteExceededAction | null;
|
|
587
|
+
/** In stated order; path-specific variants win over the fallback. */
|
|
588
|
+
pathPolicies: IGatewayRoutePathPolicyBinding[];
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
/** What a route row says about its owner and its references (dcrouter's `IRouteMetadata`). */
|
|
592
|
+
export interface IGatewayRouteRowMetadata {
|
|
593
|
+
/** The gateway reads an absent owner type as `operator`. */
|
|
594
|
+
ownerType: 'operator' | 'gatewayClient' | 'system';
|
|
595
|
+
/** Set exactly on a `gatewayClient` row, with `appId` and `externalKey` as the gateway stored them. */
|
|
596
|
+
client: IGatewayRowClientAttribution | null;
|
|
597
|
+
/** In stated order: the first matching source profile wins. */
|
|
598
|
+
sourceBindings: IGatewayRouteSourceBinding[];
|
|
599
|
+
/** A row of `networkTargets` (hard reference); the gateway resolves the route's targets from it. */
|
|
600
|
+
networkTargetRef: string | null;
|
|
601
|
+
dnsMode: TGatewayRouteDnsMode | null;
|
|
602
|
+
dnsProxied: boolean | null;
|
|
603
|
+
/** An HTTP-01 forward is an ordinary stored route; SmartProxy's challenge answers are derived. */
|
|
604
|
+
managedRouteKind: TManagedRouteKind | null;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
/** The ingress paths a route accepts (dcrouter's `IRouteIngress`). */
|
|
608
|
+
export interface IGatewayRouteIngress {
|
|
609
|
+
directHub: boolean;
|
|
610
|
+
smartVpn: boolean;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
/** A route's remote ingress (dcrouter's `IRouteRemoteIngress`). */
|
|
614
|
+
export interface IGatewayRouteRemoteIngress {
|
|
615
|
+
enabled: boolean;
|
|
616
|
+
/** A set of edge ids or tags; empty reaches every edge (the gateway reads absent as empty). */
|
|
617
|
+
edgeFilter: string[];
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
/**
|
|
621
|
+
* The secrets lifted out of a route's SmartProxy configuration; the gateway merges each back at
|
|
622
|
+
* its engine path. Each is set exactly when its engine member is present.
|
|
623
|
+
*
|
|
624
|
+
* `security.basicAuth` and `security.jwtAuth` stay in the route as objects without their secret, and
|
|
625
|
+
* the validator holds "the object exactly when its secret is set": there is no representation of a
|
|
626
|
+
* basic-auth object with an empty user list or a JWT object without a secret. A gateway that stores
|
|
627
|
+
* one refuses to export it, by name (Linus ruling 124, part 2 (iii)).
|
|
628
|
+
*/
|
|
629
|
+
export interface IGatewayRouteSecrets {
|
|
630
|
+
/** `action.tls.certificate.key`; set exactly when `action.tls.certificate` is an object. */
|
|
631
|
+
tlsKey: IGatewaySealedValue | null;
|
|
632
|
+
/** `security.basicAuth.users`, the whole list (`encodeGatewayBasicAuthUsers`); set exactly with `security.basicAuth`. */
|
|
633
|
+
basicAuthUsers: IGatewaySealedValue | null;
|
|
634
|
+
/** `security.jwtAuth.secret`; set exactly with `security.jwtAuth`. */
|
|
635
|
+
jwtSecret: IGatewaySealedValue | null;
|
|
636
|
+
/** `headers.request`, the whole record (`encodeGatewayRequestHeaders`); `null` without request headers. */
|
|
637
|
+
requestHeaders: IGatewaySealedValue | null;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
/**
|
|
641
|
+
* One entry of a route's `match.ports`: a port, or a range `{ from, to }`. In the table's spelling a
|
|
642
|
+
* range is a run of two or more consecutive ports (`from < to`); both ends are 1 to 65535. An object
|
|
643
|
+
* type, so a canonical list goes into engine configuration (`TGatewayEngineConfig`) as it is.
|
|
644
|
+
*/
|
|
645
|
+
export type TGatewayRoutePortEntry = number | { from: number; to: number };
|
|
646
|
+
|
|
647
|
+
/**
|
|
648
|
+
* Every spelling SmartProxy 27.22.1 takes for `match.ports` (`TPortRange`): one port, or a list of
|
|
649
|
+
* ports and `{ from, to }` ranges in any order. `canonicalizeGatewayRoutePorts` turns one into the
|
|
650
|
+
* table's spelling.
|
|
651
|
+
*/
|
|
652
|
+
export type TGatewayRoutePortsInput = number | readonly TGatewayRoutePortEntry[];
|
|
653
|
+
|
|
654
|
+
/**
|
|
655
|
+
* One stored route. Routes the gateway derives from mail and DNS intent (`email`, `dns` origins)
|
|
656
|
+
* are never here; their operator toggle is `disabledSystemRoutes`. The gateway orders routes for
|
|
657
|
+
* SmartProxy by `(priority desc, id)`.
|
|
658
|
+
*/
|
|
659
|
+
export interface IGatewayRouteRow {
|
|
660
|
+
id: string;
|
|
661
|
+
/** `config` for a route from config.json, else `api`. */
|
|
662
|
+
origin: 'api' | 'config';
|
|
663
|
+
/** Set exactly on a `config` row: `config:<route name>`. */
|
|
664
|
+
systemKey: string | null;
|
|
665
|
+
enabled: boolean;
|
|
666
|
+
/**
|
|
667
|
+
* The SmartProxy route (dcrouter's `IDcRouterRouteConfig`) without the members typed beside it
|
|
668
|
+
* (`ingress`, `remoteIngress`, `vpnOnly`), without the secrets `secrets` carries, and without
|
|
669
|
+
* `action.targets` when `metadata.networkTargetRef` is set.
|
|
670
|
+
*
|
|
671
|
+
* Its ports have one spelling each, whoever writes the row. `match.ports` is always a list of the
|
|
672
|
+
* maximal port runs in ascending order: a port alone is a number, a run of two or more consecutive
|
|
673
|
+
* ports is `{ from, to }` with `from < to`, no two entries overlap or touch, every port is 1 to
|
|
674
|
+
* 65535 (`canonicalizeGatewayRoutePorts` answers it from any spelling SmartProxy takes: a bare
|
|
675
|
+
* `443` is `[443]`, `[80, 443, 444, 445]` is `[80, { from: 443, to: 445 }]`). Each
|
|
676
|
+
* `action.targets[].port` is an integer 1 to 65535 or `'preserve'`; a digit string is refused, so
|
|
677
|
+
* a gateway that stored one writes its number. The validator refuses any other spelling and never
|
|
678
|
+
* rewrites one; the authors canonicalise.
|
|
679
|
+
*/
|
|
680
|
+
route: TGatewayEngineConfig;
|
|
681
|
+
ingress: IGatewayRouteIngress | null;
|
|
682
|
+
remoteIngress: IGatewayRouteRemoteIngress | null;
|
|
683
|
+
/** Read only while `ingress` is `null`; the gateway reads absent as `false`. */
|
|
684
|
+
vpnOnly: boolean;
|
|
685
|
+
secrets: IGatewayRouteSecrets;
|
|
686
|
+
metadata: IGatewayRouteRowMetadata;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* The secrets lifted out of a source profile's security, under the same rule as
|
|
691
|
+
* `IGatewayRouteSecrets`: `basicAuth` and `jwtAuth` are objects exactly when their secret is set, and
|
|
692
|
+
* a gateway refuses to export an empty user list or a secret-less JWT object, by name.
|
|
693
|
+
*/
|
|
694
|
+
export interface IGatewaySourceProfileSecrets {
|
|
695
|
+
/** `security.basicAuth.users`, the whole list; set exactly with `security.basicAuth`. */
|
|
696
|
+
basicAuthUsers: IGatewaySealedValue | null;
|
|
697
|
+
/** `security.jwtAuth.secret`; set exactly with `security.jwtAuth`. */
|
|
698
|
+
jwtSecret: IGatewaySealedValue | null;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
/** One reusable source policy routes bind to. */
|
|
702
|
+
export interface IGatewaySourceProfileRow {
|
|
703
|
+
id: string;
|
|
704
|
+
name: string;
|
|
705
|
+
description: string | null;
|
|
706
|
+
/** dcrouter's `IRouteSecurity` (SmartProxy route security) without the secrets `secrets` carries. */
|
|
707
|
+
security: TGatewayEngineConfig;
|
|
708
|
+
secrets: IGatewaySourceProfileSecrets;
|
|
709
|
+
/** Rows of `sourceProfiles` (hard references), in stated order, each once, never the row itself. */
|
|
710
|
+
extendsProfiles: string[];
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
/** One named backend routes refer to. */
|
|
714
|
+
export interface IGatewayNetworkTargetRow {
|
|
715
|
+
id: string;
|
|
716
|
+
name: string;
|
|
717
|
+
description: string | null;
|
|
718
|
+
/** One host, or at least two in stated order. */
|
|
719
|
+
host: string | string[];
|
|
720
|
+
/** 1 to 65535. */
|
|
721
|
+
port: number;
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
/** One target profile; the gateway's local VPN clients reference these by id. */
|
|
725
|
+
export interface IGatewayTargetProfileRow {
|
|
726
|
+
id: string;
|
|
727
|
+
/** Unique among the target profiles. */
|
|
728
|
+
name: string;
|
|
729
|
+
description: string | null;
|
|
730
|
+
/** A set of domain patterns. */
|
|
731
|
+
domains: string[];
|
|
732
|
+
/** A set, ascending by `ip`, then `port`. */
|
|
733
|
+
targets: { ip: string; port: number }[];
|
|
734
|
+
/** A set of route row ids (soft references). */
|
|
735
|
+
routeRefs: string[];
|
|
736
|
+
allowRoutesByClientSourceIp: boolean;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
/**
|
|
740
|
+
* HTTP/3 augmentation of every qualifying route. This package owns the stored and the wire shape
|
|
741
|
+
* (Linus ruling 124, §2): dcrouter's stored home holds exactly this shape and imports it, so its
|
|
742
|
+
* export is a read and its apply a write. dcrouter's `IHttp3Config` remains only its config.json
|
|
743
|
+
* seed and augmentation option type, until 35.0.0 removes the seed.
|
|
744
|
+
*/
|
|
745
|
+
export interface IGatewayHttp3Settings {
|
|
746
|
+
/** `null` for the gateway's default (`true`). */
|
|
747
|
+
enabled: boolean | null;
|
|
748
|
+
quicSettings: {
|
|
749
|
+
maxIdleTimeout: number | null;
|
|
750
|
+
maxConcurrentBidiStreams: number | null;
|
|
751
|
+
maxConcurrentUniStreams: number | null;
|
|
752
|
+
initialCongestionWindow: number | null;
|
|
753
|
+
} | null;
|
|
754
|
+
altSvc: { port: number | null; maxAge: number | null } | null;
|
|
755
|
+
udpSettings: {
|
|
756
|
+
sessionTimeout: number | null;
|
|
757
|
+
maxSessionsPerIP: number | null;
|
|
758
|
+
maxDatagramSize: number | null;
|
|
759
|
+
} | null;
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
/** The `routes` area. */
|
|
763
|
+
export interface IGatewayRoutesArea {
|
|
764
|
+
routes: IGatewayRouteRow[];
|
|
765
|
+
sourceProfiles: IGatewaySourceProfileRow[];
|
|
766
|
+
networkTargets: IGatewayNetworkTargetRow[];
|
|
767
|
+
targetProfiles: IGatewayTargetProfileRow[];
|
|
768
|
+
/** `systemKey`s of derived `email`/`dns` routes the operator disabled. */
|
|
769
|
+
disabledSystemRoutes: IGatewayAreaKeyRow[];
|
|
770
|
+
http3: IGatewayHttp3Settings | null;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
// ---------------------------------------------------------------------------------------------
|
|
774
|
+
// mail
|
|
775
|
+
// ---------------------------------------------------------------------------------------------
|
|
776
|
+
|
|
777
|
+
/** One port's settings in the email port configuration. */
|
|
778
|
+
export interface IGatewayMailPortSettings {
|
|
779
|
+
/** The gateway reads an absent flag as `false`. */
|
|
780
|
+
terminateTls: boolean;
|
|
781
|
+
/** A non-empty route name; `null` for the gateway's own. */
|
|
782
|
+
routeName: string | null;
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
/**
|
|
786
|
+
* dcrouter's `IEmailPortConfig`, canonical. Record keys are decimal ports 1 to 65535 without a
|
|
787
|
+
* leading zero. `receivedEmailsPath` is a host path and stays on the gateway.
|
|
788
|
+
*
|
|
789
|
+
* Always stated (Linus ruling 128, B2): no port configuration is `{ portMapping: null,
|
|
790
|
+
* portSettings: {} }`, never `null`; the gateway may store the object for `receivedEmailsPath`
|
|
791
|
+
* alone, so its presence says nothing about the row.
|
|
792
|
+
*/
|
|
793
|
+
export interface IGatewayMailPortConfig {
|
|
794
|
+
/**
|
|
795
|
+
* External to internal port, at least one entry; `null` for the gateway's default mapping. The
|
|
796
|
+
* gateway maps a port the mapping does not name to port + 10000, as it does without a mapping, so
|
|
797
|
+
* `{}` is a second spelling of `null` and refused.
|
|
798
|
+
*/
|
|
799
|
+
portMapping: Record<string, number> | null;
|
|
800
|
+
/** The gateway reads absent settings as none. */
|
|
801
|
+
portSettings: Record<string, IGatewayMailPortSettings>;
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
/**
|
|
805
|
+
* The mail server settings singleton (the stored settings, never the run-time options).
|
|
806
|
+
* `emailConfig` is SmartMTA's server options. `auth.users` and `auth.accounts` are out; the rest of
|
|
807
|
+
* `auth` (`required`, `methods`) travels inside `emailConfig` (Linus ruling 126, which amends ruling
|
|
808
|
+
* 121). SMTP accounts are rows of `smtpAccounts`; plaintext `auth.users` logins have no table form,
|
|
809
|
+
* so a gateway that holds one refuses to export by name. Host paths stay out, and `tls.keyPem` is
|
|
810
|
+
* `tlsKey`.
|
|
811
|
+
*/
|
|
812
|
+
export interface IGatewayMailServerSettings {
|
|
813
|
+
enabled: boolean;
|
|
814
|
+
outboundMode: 'direct' | 'remoteIngress';
|
|
815
|
+
emailConfig: TGatewayEngineConfig | null;
|
|
816
|
+
/** `emailConfig.tls.keyPem`; only with `emailConfig.tls`. */
|
|
817
|
+
tlsKey: IGatewaySealedValue | null;
|
|
818
|
+
emailPortConfig: IGatewayMailPortConfig;
|
|
819
|
+
/** The effective source: what the gateway serves for settings stored without one. */
|
|
820
|
+
tlsSource: 'managedCertificate' | 'configuredMaterial';
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
/** dcrouter's `IEmailDomainRateLimits`, canonical. */
|
|
824
|
+
export interface IGatewayMailDomainRateLimits {
|
|
825
|
+
outbound: {
|
|
826
|
+
messagesPerMinute: number | null;
|
|
827
|
+
messagesPerHour: number | null;
|
|
828
|
+
messagesPerDay: number | null;
|
|
829
|
+
} | null;
|
|
830
|
+
inbound: {
|
|
831
|
+
messagesPerMinute: number | null;
|
|
832
|
+
connectionsPerIp: number | null;
|
|
833
|
+
recipientsPerMessage: number | null;
|
|
834
|
+
} | null;
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
/**
|
|
838
|
+
* One mail domain. The active DKIM selector (`dkim.selector` on the gateway), DKIM keys, public
|
|
839
|
+
* records and the DNS status are derived or local on the gateway.
|
|
840
|
+
*/
|
|
841
|
+
export interface IGatewayMailDomainRow {
|
|
842
|
+
id: string;
|
|
843
|
+
/** Unique among the mail domains. */
|
|
844
|
+
domain: string;
|
|
845
|
+
/** A row of the dns area's `domains` (hard cross-area reference). */
|
|
846
|
+
linkedDomainId: string;
|
|
847
|
+
/** A non-empty prefix; `null` for the bare domain. */
|
|
848
|
+
subdomain: string | null;
|
|
849
|
+
dkim: {
|
|
850
|
+
/** The selector of the domain's first key. */
|
|
851
|
+
initialSelector: string;
|
|
852
|
+
keySize: number;
|
|
853
|
+
rotateKeys: boolean;
|
|
854
|
+
rotationIntervalDays: number;
|
|
855
|
+
retirementOverlapDays: number | null;
|
|
856
|
+
};
|
|
857
|
+
rateLimits: IGatewayMailDomainRateLimits | null;
|
|
858
|
+
/** A set of edge ids or tags; empty reaches every mail edge (the gateway reads absent as empty). */
|
|
859
|
+
edgeFilter: string[];
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
/** One SMTP submission account. */
|
|
863
|
+
export interface IGatewaySmtpAccountRow {
|
|
864
|
+
id: string;
|
|
865
|
+
/** Unique among the SMTP accounts. */
|
|
866
|
+
username: string;
|
|
867
|
+
description: string;
|
|
868
|
+
enabled: boolean;
|
|
869
|
+
credential: IGatewayScramVerifier;
|
|
870
|
+
/** Sets; both empty is an unrestricted sender scope. */
|
|
871
|
+
senderScope: { addresses: string[]; domains: string[] };
|
|
872
|
+
/** Sets, enforced only for `restricted`. */
|
|
873
|
+
recipientScope: { mode: 'any' | 'restricted'; addresses: string[]; domains: string[] };
|
|
874
|
+
mailPolicy: { dkimSign: boolean; queue: 'normal' | 'priority' | 'bulk' | null };
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
/** Where a WorkApp mail identity's inbound mail goes (`data.IMailInboundTarget`, the kinds dcrouter serves). */
|
|
878
|
+
export type TGatewayMailIdentityInboundTarget =
|
|
879
|
+
| {
|
|
880
|
+
type: 'smtpForward';
|
|
881
|
+
smtpForward: {
|
|
882
|
+
host: string;
|
|
883
|
+
port: number;
|
|
884
|
+
credentialRef: string | null;
|
|
885
|
+
preserveHeaders: boolean | null;
|
|
886
|
+
addHeaders: Record<string, string> | null;
|
|
887
|
+
};
|
|
888
|
+
}
|
|
889
|
+
| {
|
|
890
|
+
type: 'typedEndpoint';
|
|
891
|
+
typedEndpoint: {
|
|
892
|
+
method: string;
|
|
893
|
+
serviceRef: string | null;
|
|
894
|
+
queueName: string | null;
|
|
895
|
+
timeoutMs: number | null;
|
|
896
|
+
};
|
|
897
|
+
}
|
|
898
|
+
| { type: 'coreMail'; coreMail: { coreMailServiceId: string } };
|
|
899
|
+
|
|
900
|
+
/**
|
|
901
|
+
* One WorkApp mail identity, one row per identity. Its SMTP credential is a verifier with
|
|
902
|
+
* `gatewayMailIdentityScramIterations` iterations (`deriveGatewayScramVerifier`); the password is
|
|
903
|
+
* never stored by the gateway or in a table.
|
|
904
|
+
*/
|
|
905
|
+
export interface IGatewayMailIdentityRow {
|
|
906
|
+
id: string;
|
|
907
|
+
/** `appId` (the WorkApp) and `externalKey` set. */
|
|
908
|
+
client: IGatewayRowClientAttribution;
|
|
909
|
+
/** Lowercase; the address is `localPart@domain`, unique among the identities. */
|
|
910
|
+
localPart: string;
|
|
911
|
+
/** Lowercase ASCII domain. */
|
|
912
|
+
domain: string;
|
|
913
|
+
enabled: boolean;
|
|
914
|
+
displayName: string | null;
|
|
915
|
+
inboundTarget: TGatewayMailIdentityInboundTarget | null;
|
|
916
|
+
smtp: { enabled: boolean; username: string };
|
|
917
|
+
credential: IGatewayScramVerifier;
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
/** One CoreMail service's gateway binding. */
|
|
921
|
+
export interface IGatewayCoreMailPeerRow {
|
|
922
|
+
id: string;
|
|
923
|
+
/** `appId` and `externalKey` `null`. */
|
|
924
|
+
client: IGatewayRowClientAttribution;
|
|
925
|
+
coreMailServiceId: string;
|
|
926
|
+
transferOrigin: string;
|
|
927
|
+
/** Strictly ascending by `version`. */
|
|
928
|
+
credentials: IGatewayCoreMailCredentialVerifier[];
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
/** The `mail` area. */
|
|
932
|
+
export interface IGatewayMailArea {
|
|
933
|
+
/**
|
|
934
|
+
* Always stated, never `null` (Linus ruling 128, B1): a gateway always stores mail server
|
|
935
|
+
* settings. Mail a gateway never configured is exported as `{ enabled: false, outboundMode:
|
|
936
|
+
* 'remoteIngress', emailConfig: null, tlsKey: null, emailPortConfig: { portMapping: null,
|
|
937
|
+
* portSettings: {} }, tlsSource: 'managedCertificate' }` (dcrouter's seeded settings document with
|
|
938
|
+
* its defaults).
|
|
939
|
+
*/
|
|
940
|
+
server: IGatewayMailServerSettings;
|
|
941
|
+
domains: IGatewayMailDomainRow[];
|
|
942
|
+
smtpAccounts: IGatewaySmtpAccountRow[];
|
|
943
|
+
identities: IGatewayMailIdentityRow[];
|
|
944
|
+
coreMailPeers: IGatewayCoreMailPeerRow[];
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
// ---------------------------------------------------------------------------------------------
|
|
948
|
+
// edges
|
|
949
|
+
// ---------------------------------------------------------------------------------------------
|
|
950
|
+
|
|
951
|
+
/**
|
|
952
|
+
* dcrouter's `IRemoteIngressPerformanceConfig`, canonical; `null` members take the gateway default.
|
|
953
|
+
* At least one member is set: settings that state nothing are the owner's `performance: null`, never
|
|
954
|
+
* an object of `null` members (Linus ruling 125, Q-b7; the gateway stores and exports them as no
|
|
955
|
+
* setting).
|
|
956
|
+
*/
|
|
957
|
+
export interface IGatewayEdgePerformance {
|
|
958
|
+
profile: 'balanced' | 'throughput' | 'highConcurrency' | null;
|
|
959
|
+
maxStreamsPerEdge: number | null;
|
|
960
|
+
totalWindowBudgetBytes: number | null;
|
|
961
|
+
minStreamWindowBytes: number | null;
|
|
962
|
+
maxStreamWindowBytes: number | null;
|
|
963
|
+
sustainedStreamWindowBytes: number | null;
|
|
964
|
+
quicDatagramReceiveBufferBytes: number | null;
|
|
965
|
+
streamFramePayloadBytes: number | null;
|
|
966
|
+
firstDataConnectTimeoutMs: number | null;
|
|
967
|
+
clientWriteTimeoutMs: number | null;
|
|
968
|
+
maxHalfClosedStreams: number | null;
|
|
969
|
+
halfCloseDrainTimeoutMs: number | null;
|
|
970
|
+
/** A non-empty set of ports; `null` for none (never `[]`). */
|
|
971
|
+
serverFirstPorts: number[] | null;
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
/**
|
|
975
|
+
* dcrouter's `IRemoteIngressEgressPolicyConfig`, canonical; `null` members take the gateway default.
|
|
976
|
+
* An enabled policy states its ports (the gateway's default `[25]` is written out, never `null`); a
|
|
977
|
+
* disabled one states nothing else, every other member `null`, because the gateway keeps only
|
|
978
|
+
* `enabled` of it. A list member is `null` or non-empty, never `[]` (Linus ruling 125, Q-b7).
|
|
979
|
+
*
|
|
980
|
+
* Always stated on an edge row (`IGatewayEdgeRow.egress`): the gateway reads an edge without a
|
|
981
|
+
* policy and one with a disabled policy alike, so egress off has the one spelling
|
|
982
|
+
* `{ enabled: false, allowedPorts: null, allowPrivateRanges: null, deniedCidrs: null,
|
|
983
|
+
* allowedHostPatterns: null, maxConcurrentStreams: null }` and never `null` (the object is
|
|
984
|
+
* canonical, as for the mail port configuration, Linus ruling 128 B2).
|
|
985
|
+
*/
|
|
986
|
+
export interface IGatewayEdgeEgress {
|
|
987
|
+
enabled: boolean;
|
|
988
|
+
/** A non-empty set of ports exactly when `enabled`; `null` otherwise. */
|
|
989
|
+
allowedPorts: number[] | null;
|
|
990
|
+
allowPrivateRanges: boolean | null;
|
|
991
|
+
/** A non-empty set of CIDRs, or `null`. */
|
|
992
|
+
deniedCidrs: string[] | null;
|
|
993
|
+
/** A non-empty set of host patterns, or `null`. */
|
|
994
|
+
allowedHostPatterns: string[] | null;
|
|
995
|
+
maxConcurrentStreams: number | null;
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
/** One remote ingress edge. Its tunnel listener port is a host fact and never here. */
|
|
999
|
+
export interface IGatewayEdgeRow {
|
|
1000
|
+
id: string;
|
|
1001
|
+
name: string;
|
|
1002
|
+
/** The edge's tunnel secret. */
|
|
1003
|
+
secret: IGatewaySealedValue;
|
|
1004
|
+
/** A set of manually listed TCP ports; derived ports are computed on the gateway. */
|
|
1005
|
+
listenPorts: number[];
|
|
1006
|
+
/** A set of manually listed UDP ports (the gateway reads absent as empty). */
|
|
1007
|
+
listenPortsUdp: number[];
|
|
1008
|
+
enabled: boolean;
|
|
1009
|
+
autoDerivePorts: boolean;
|
|
1010
|
+
performance: IGatewayEdgePerformance | null;
|
|
1011
|
+
/** Never `null`: egress off is the disabled policy (`IGatewayEdgeEgress`). */
|
|
1012
|
+
egress: IGatewayEdgeEgress;
|
|
1013
|
+
/** A set of tags (the gateway reads absent as empty). */
|
|
1014
|
+
tags: string[];
|
|
1015
|
+
publicIp: string | null;
|
|
1016
|
+
/** dcrouter stores it as `publicIpV6`. */
|
|
1017
|
+
publicIpv6: string | null;
|
|
1018
|
+
mailHostname: string | null;
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
/** The tunnel hub singleton, without its listener port and TLS files. */
|
|
1022
|
+
export interface IGatewayEdgeHubSettings {
|
|
1023
|
+
enabled: boolean;
|
|
1024
|
+
hubDomain: string | null;
|
|
1025
|
+
performance: IGatewayEdgePerformance | null;
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
/** The `edges` area. */
|
|
1029
|
+
export interface IGatewayEdgesArea {
|
|
1030
|
+
/**
|
|
1031
|
+
* Always stated, never `null` (Linus ruling 125, Q-b5): a gateway always has hub settings. A hub
|
|
1032
|
+
* that is off is `enabled: false`, with `hubDomain` and `performance` `null` when it has none.
|
|
1033
|
+
*/
|
|
1034
|
+
hub: IGatewayEdgeHubSettings;
|
|
1035
|
+
edges: IGatewayEdgeRow[];
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
// ---------------------------------------------------------------------------------------------
|
|
1039
|
+
// The five contents
|
|
1040
|
+
// ---------------------------------------------------------------------------------------------
|
|
1041
|
+
|
|
1042
|
+
/** The content type of each area's table, by area name. */
|
|
1043
|
+
export interface IGatewayAreaContents {
|
|
1044
|
+
security: IGatewaySecurityArea;
|
|
1045
|
+
dns: IGatewayDnsArea;
|
|
1046
|
+
routes: IGatewayRoutesArea;
|
|
1047
|
+
mail: IGatewayMailArea;
|
|
1048
|
+
edges: IGatewayEdgesArea;
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
/** The content of one area's table. */
|
|
1052
|
+
export type TGatewayAreaContent<TArea extends TGatewayConfigArea = TGatewayConfigArea> = IGatewayAreaContents[TArea];
|
|
1053
|
+
|
|
1054
|
+
/** The members of each area, in the order its doc lists them. */
|
|
1055
|
+
export const gatewayAreaMembers = Object.freeze({
|
|
1056
|
+
security: Object.freeze(['blockRules', 'apiTokens', 'proxyPolicy'] as const),
|
|
1057
|
+
dns: Object.freeze([
|
|
1058
|
+
'server', 'nameservers', 'acme', 'providers', 'domains', 'records', 'staticRecords', 'protectedHostnames',
|
|
1059
|
+
'authorityZones', 'clientHostnames',
|
|
1060
|
+
] as const),
|
|
1061
|
+
routes: Object.freeze([
|
|
1062
|
+
'routes', 'sourceProfiles', 'networkTargets', 'targetProfiles', 'disabledSystemRoutes', 'http3',
|
|
1063
|
+
] as const),
|
|
1064
|
+
mail: Object.freeze(['server', 'domains', 'smtpAccounts', 'identities', 'coreMailPeers'] as const),
|
|
1065
|
+
edges: Object.freeze(['hub', 'edges'] as const),
|
|
1066
|
+
} as const);
|
|
1067
|
+
|
|
1068
|
+
/**
|
|
1069
|
+
* The closed key vocabulary refused inside every engine configuration (a route's `route`, a source
|
|
1070
|
+
* profile's `security`, the mail server's `emailConfig`, the proxy policy, and every policy override
|
|
1071
|
+
* `value`), at any depth and in every position: a record key that is one of these names is refused
|
|
1072
|
+
* like a member (`validateGatewayAreaTables`). Each list is ascending by `compareWireTokens`.
|
|
1073
|
+
*
|
|
1074
|
+
* - `secret` (`secret-in-engine-config`): keys that denote a secret. The ones the gateway needs
|
|
1075
|
+
* travel in typed sealed members instead (`IGatewayRouteSecrets`, `IGatewaySourceProfileSecrets`,
|
|
1076
|
+
* `IGatewayMailServerSettings.tlsKey`); the rest have no table form.
|
|
1077
|
+
* - `hostPath` (`host-path-in-engine-config`): key names that denote a path on the gateway's host.
|
|
1078
|
+
* - `headerInjection` (`secret-in-engine-config`): members whose headers the engine adds to a
|
|
1079
|
+
* request, which can carry a credential.
|
|
1080
|
+
*
|
|
1081
|
+
* An entry is a key name or `parent.name`. A key name is refused under any parent; `parent.name` is
|
|
1082
|
+
* a key `name` directly inside a key `parent` (a list between them is transparent) and refuses only
|
|
1083
|
+
* there, so a member that mixes settings and credentials keeps its settings (all three
|
|
1084
|
+
* lists share this one matcher).
|
|
1085
|
+
*
|
|
1086
|
+
* The vocabulary is what the pinned engine types name, read from their declarations: SmartProxy
|
|
1087
|
+
* 27.22.1 `dist_ts/proxies/smart-proxy/models/route-types.d.ts` (and its `ISmartProxySecurityPolicy`,
|
|
1088
|
+
* which names none), smartchallenge 1.1.0 `IRouteChallengeConfig` (names none; its `settings` record is
|
|
1089
|
+
* walked like every record), SmartMTA 13.1.0 `IUnifiedEmailServerOptions` and `IEmailAction`, and the
|
|
1090
|
+
* host-path members dcrouter adds to them. SmartMTA 13.1.0's config-shaped `auth` keys are exactly
|
|
1091
|
+
* `IUnifiedEmailServerOptions.auth` (`required`, `methods`, `users`, `accounts`) and the route action's
|
|
1092
|
+
* `forward.auth` (`{ user, pass }`); its other `auth` declarations are parameters of
|
|
1093
|
+
* `RustSecurityBridge` methods (`ISmtpSendOptions`, `ISmtpSendRawTransportOptions`,
|
|
1094
|
+
* `ISmtpVerifyOptions`), never configuration. A SmartMTA pin bump that adds a config-shaped `auth`
|
|
1095
|
+
* member gets its own path entry through dcrouter's classification (Linus rulings 124 and 126).
|
|
1096
|
+
* Version skew (Linus ruling 124): a controller with an
|
|
1097
|
+
* older vocabulary than a gateway's could store a newly named secret before the gateway refuses it,
|
|
1098
|
+
* so Cloudly writes no engine configuration for a gateway stating a newer `interfacesVersion` than
|
|
1099
|
+
* its own.
|
|
1100
|
+
*/
|
|
1101
|
+
export const gatewayAreaRefusedEngineKeys = Object.freeze({
|
|
1102
|
+
secret: Object.freeze([
|
|
1103
|
+
'auth.accounts', // SmartMTA `IUnifiedEmailServerOptions.auth.accounts` (`ISmtpAuthAccount[]`; the rows are `smtpAccounts`)
|
|
1104
|
+
'credential', // SmartMTA `ISmtpAuthAccount.credential` (`{ verifier }` or `{ password }`)
|
|
1105
|
+
'credentials', // SmartProxy `IRouteAuthentication.credentials` (`security.authentication`)
|
|
1106
|
+
'forward.auth', // SmartMTA `IEmailAction.forward.auth` (`{ user, pass }`), refused whole whatever its members
|
|
1107
|
+
'jwtSecret', // SmartProxy `IRouteAuthentication.jwtSecret`
|
|
1108
|
+
'key', // SmartProxy `IRouteTls.certificate.key` (action and target `tls`; lifted to `secrets.tlsKey`)
|
|
1109
|
+
'keyPem', // SmartMTA `IUnifiedEmailServerOptions.tls.keyPem` (lifted to `tlsKey`)
|
|
1110
|
+
'oauthClientSecret', // SmartProxy `IRouteAuthentication.oauthClientSecret`
|
|
1111
|
+
'pass', // SmartMTA `IEmailAction.forward.auth.pass`
|
|
1112
|
+
'password', // SmartProxy `basicAuth.users[].password`, `IRouteAuthentication.credentials[].password`; SmartMTA `auth.users[].password`, `ISmtpAuthAccount.credential.password`
|
|
1113
|
+
'privateKey', // SmartMTA `IEmailAction.options.mtaOptions.dkimOptions.privateKey`
|
|
1114
|
+
'secret', // SmartProxy `IRouteSecurity.jwtAuth.secret` (lifted to `secrets.jwtSecret`)
|
|
1115
|
+
'serverKey', // SmartMTA `ISmtpScramVerifier.serverKey`
|
|
1116
|
+
'storedKey', // SmartMTA `ISmtpScramVerifier.storedKey`
|
|
1117
|
+
'users', // SmartProxy `IRouteSecurity.basicAuth.users` (lifted to `secrets.basicAuthUsers`); SmartMTA `auth.users` (no table form)
|
|
1118
|
+
'verifier', // SmartMTA `ISmtpAuthAccount.credential.verifier` (`ISmtpScramVerifier`)
|
|
1119
|
+
] as const),
|
|
1120
|
+
hostPath: Object.freeze([
|
|
1121
|
+
'caPath', // dcrouter `IDcRouterOptions.tls.caPath` (Linus ruling 121, Q10)
|
|
1122
|
+
'certFile', // SmartProxy `IRouteTls.certificate.certFile`
|
|
1123
|
+
'certPath', // dcrouter `IDcRouterEmailTlsConfig.certPath` (SmartMTA `tls` plus paths)
|
|
1124
|
+
'directory', // SmartProxy `IRouteStaticFiles.directory` (`advanced.staticFiles`)
|
|
1125
|
+
'keyFile', // SmartProxy `IRouteTls.certificate.keyFile`
|
|
1126
|
+
'keyPath', // dcrouter `IDcRouterEmailTlsConfig.keyPath`
|
|
1127
|
+
'receivedEmailsPath', // dcrouter `IEmailPortConfig.receivedEmailsPath`
|
|
1128
|
+
'root', // SmartProxy `IRouteStaticFiles.root` (`advanced.staticFiles`)
|
|
1129
|
+
] as const),
|
|
1130
|
+
headerInjection: Object.freeze([
|
|
1131
|
+
'advanced.headers', // SmartProxy `IRouteAdvanced.headers` (action and every target)
|
|
1132
|
+
'customHeaders', // SmartProxy `IRouteWebSocket.customHeaders` (action and every target)
|
|
1133
|
+
'headers.request', // SmartProxy `IRouteHeaders.request` (route and every target; lifted to `secrets.requestHeaders`)
|
|
1134
|
+
] as const),
|
|
1135
|
+
} as const);
|