@serve.zone/dcrouter 18.1.0 → 18.2.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.
Files changed (49) hide show
  1. package/deno.json +1 -1
  2. package/dist_serve/bundle.js +2072 -1624
  3. package/dist_ts/00_commitinfo_data.js +1 -1
  4. package/dist_ts/classes.dcrouter.d.ts +64 -2
  5. package/dist_ts/classes.dcrouter.js +187 -6
  6. package/dist_ts/db/documents/classes.authentication-event.doc.d.ts +25 -0
  7. package/dist_ts/db/documents/classes.authentication-event.doc.js +273 -0
  8. package/dist_ts/db/documents/classes.email-traffic-bucket.doc.d.ts +25 -0
  9. package/dist_ts/db/documents/classes.email-traffic-bucket.doc.js +200 -0
  10. package/dist_ts/db/documents/index.d.ts +2 -0
  11. package/dist_ts/db/documents/index.js +3 -1
  12. package/dist_ts/email/classes.accepted-email-spool.d.ts +67 -0
  13. package/dist_ts/email/classes.accepted-email-spool.js +245 -17
  14. package/dist_ts/email/classes.workapp-mail-manager.js +5 -2
  15. package/dist_ts/monitoring/classes.metricsmanager.d.ts +19 -0
  16. package/dist_ts/monitoring/classes.metricsmanager.js +240 -44
  17. package/dist_ts/opsserver/handlers/admin.handler.d.ts +1 -0
  18. package/dist_ts/opsserver/handlers/admin.handler.js +61 -14
  19. package/dist_ts/opsserver/handlers/security.handler.js +21 -3
  20. package/dist_ts/opsserver/handlers/stats.handler.js +27 -10
  21. package/dist_ts/security/classes.authentication-event-manager.d.ts +35 -0
  22. package/dist_ts/security/classes.authentication-event-manager.js +185 -0
  23. package/dist_ts/security/index.d.ts +1 -0
  24. package/dist_ts/security/index.js +2 -1
  25. package/dist_ts_interfaces/data/stats.d.ts +16 -0
  26. package/dist_ts_migrations/index.js +74 -15
  27. package/dist_ts_web/00_commitinfo_data.js +1 -1
  28. package/dist_ts_web/elements/overview/ops-view-overview.js +3 -2
  29. package/dist_ts_web/elements/security/ops-view-security-authentication.js +20 -13
  30. package/dist_ts_web/elements/security/ops-view-security-overview.js +8 -11
  31. package/package.json +3 -3
  32. package/readme.md +24 -0
  33. package/ts/00_commitinfo_data.ts +1 -1
  34. package/ts/classes.dcrouter.ts +230 -6
  35. package/ts/db/documents/classes.authentication-event.doc.ts +248 -0
  36. package/ts/db/documents/classes.email-traffic-bucket.doc.ts +161 -0
  37. package/ts/db/documents/index.ts +2 -0
  38. package/ts/email/classes.accepted-email-spool.ts +319 -21
  39. package/ts/email/classes.workapp-mail-manager.ts +4 -1
  40. package/ts/monitoring/classes.metricsmanager.ts +287 -50
  41. package/ts/opsserver/handlers/admin.handler.ts +74 -15
  42. package/ts/opsserver/handlers/security.handler.ts +23 -2
  43. package/ts/opsserver/handlers/stats.handler.ts +29 -9
  44. package/ts/security/classes.authentication-event-manager.ts +221 -0
  45. package/ts/security/index.ts +1 -0
  46. package/ts_web/00_commitinfo_data.ts +1 -1
  47. package/ts_web/elements/overview/ops-view-overview.ts +2 -1
  48. package/ts_web/elements/security/ops-view-security-authentication.ts +20 -13
  49. package/ts_web/elements/security/ops-view-security-overview.ts +7 -12
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@serve.zone/dcrouter',
6
- version: '18.1.0',
6
+ version: '18.2.0',
7
7
  description: 'A multifaceted routing service handling mail and SMS delivery functions.'
8
8
  };
9
9
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSxzQkFBc0I7SUFDNUIsT0FBTyxFQUFFLFFBQVE7SUFDakIsV0FBVyxFQUFFLDBFQUEwRTtDQUN4RixDQUFBIn0=
@@ -9,7 +9,7 @@ import { RadiusServer, type IRadiusServerConfig } from './radius/index.js';
9
9
  import { RemoteIngressHubLifecycle, RemoteIngressManager, TunnelManager } from './remoteingress/index.js';
10
10
  import { VpnAccessResolver, VpnManager } from './vpn/index.js';
11
11
  import { RouteConfigManager, ApiTokenManager, GatewayClientManager, ReferenceResolver, TargetProfileManager } from './config/index.js';
12
- import { SecurityPolicyManager, RoutePolicyAugmenter } from './security/index.js';
12
+ import { SecurityPolicyManager, RoutePolicyAugmenter, AuthenticationEventManager } from './security/index.js';
13
13
  import { type IHttp3Config } from './http3/index.js';
14
14
  import { DnsManager } from './dns/manager.dns.js';
15
15
  import { DnsAuthorityManager } from './dns/manager.dns-authority.js';
@@ -21,6 +21,24 @@ import { AcceptedEmailSpool, EmailDomainManager, EmailRouteBuilder, EmailSetting
21
21
  import { WebPushManager } from './webpush/index.js';
22
22
  import type { IEmailOutboundEgressStatus, IEmailPortConfig, IEmailServerSettings, TEmailOutboundMode, TEmailServerSettingsUpdate } from '../dist_ts_interfaces/data/email-settings.js';
23
23
  import type { IDcRouterRouteConfig, IRemoteIngressHubSettings, TRemoteIngressHubSettingsUpdate } from '../dist_ts_interfaces/data/remoteingress.js';
24
+ /**
25
+ * dcrouter's superset of SmartMTA's SMTP TLS options.
26
+ *
27
+ * SmartMTA consumes PEM content (`certPem`/`keyPem`). Deployments configure
28
+ * certificate FILES, so dcrouter accepts the path form too and loads it eagerly
29
+ * at startup — a path that cannot be read fails startup rather than silently
30
+ * leaving the listener without TLS.
31
+ */
32
+ export interface IDcRouterEmailTlsConfig extends NonNullable<IUnifiedEmailServerOptions['tls']> {
33
+ /** Path to the certificate chain PEM file. Requires keyPath. */
34
+ certPath?: string;
35
+ /** Path to the private key PEM file. Requires certPath. */
36
+ keyPath?: string;
37
+ }
38
+ /** dcrouter's email server options: SmartMTA's, with the path-shaped tls block. */
39
+ export type IDcRouterEmailConfig = Omit<IUnifiedEmailServerOptions, 'tls'> & {
40
+ tls?: IDcRouterEmailTlsConfig;
41
+ };
24
42
  export interface IDcRouterOptions {
25
43
  /** Base directory for all dcrouter data. Defaults to ~/.serve.zone/dcrouter */
26
44
  baseDir?: string;
@@ -35,7 +53,7 @@ export interface IDcRouterOptions {
35
53
  * Email server configuration
36
54
  * This enables all email handling with pattern-based routing
37
55
  */
38
- emailConfig?: IUnifiedEmailServerOptions;
56
+ emailConfig?: IDcRouterEmailConfig;
39
57
  /** SmartBucket configuration for durable SmartMTA queue and attachment blobs. */
40
58
  emailBlobStorage?: ISmartMtaBlobStorageConfig;
41
59
  /** Outbound SMTP connection mode. Defaults to direct unless DB settings override it. */
@@ -226,6 +244,7 @@ export declare class DcRouter {
226
244
  emailServer?: UnifiedEmailServer;
227
245
  radiusServer?: RadiusServer;
228
246
  opsServer: OpsServer;
247
+ private opsServerStopped;
229
248
  metricsManager?: MetricsManager;
230
249
  private emailEventSubscriptions;
231
250
  storageManager: IStorageManagerLike;
@@ -260,6 +279,7 @@ export declare class DcRouter {
260
279
  mailDnsSync: MailDnsSync;
261
280
  mailEdgeEligibility: MailEdgeEligibility;
262
281
  securityPolicyManager?: SecurityPolicyManager;
282
+ authenticationEventManager: AuthenticationEventManager;
263
283
  detectedPublicIp: string | null;
264
284
  certificateStatusMap: Map<string, {
265
285
  status: "valid" | "failed";
@@ -328,6 +348,7 @@ export declare class DcRouter {
328
348
  * Find ALL route names that match a given domain
329
349
  */
330
350
  findRouteNamesForDomain(domain: string): string[];
351
+ private stopOpsServer;
331
352
  stop(): Promise<void>;
332
353
  /**
333
354
  * Update SmartProxy configuration
@@ -339,6 +360,47 @@ export declare class DcRouter {
339
360
  * This implements the consolidated emailConfig approach
340
361
  */
341
362
  private setupUnifiedEmailHandling;
363
+ /**
364
+ * Resolve the PEM material for the SMTP listener.
365
+ *
366
+ * SmartMTA consumes `tls.certPem`/`tls.keyPem`; a path-shaped `tls` block is
367
+ * ignored, which leaves the Rust listener with no TLS material at all — no
368
+ * STARTTLS on the plain submission ports. Resolution order matches the
369
+ * RemoteIngress tunnel precedent: explicit paths, then the ACME cert store.
370
+ *
371
+ * Explicitly configured paths that cannot be read FAIL STARTUP. Silently
372
+ * continuing without TLS is what produced a cleartext submission port in
373
+ * production, so a broken explicit configuration must be impossible to miss.
374
+ */
375
+ private resolveEmailTlsMaterial;
376
+ /**
377
+ * Push renewed TLS material to the running SMTP listener.
378
+ *
379
+ * Only reacts to the mail hostname, and only when explicit paths are NOT
380
+ * configured — an operator-managed file pair is not superseded by an ACME
381
+ * renewal for the same name. SmartMTA restarts just the Rust listener when
382
+ * the PEM material actually changes.
383
+ */
384
+ private reapplyEmailTlsMaterial;
385
+ /**
386
+ * Internal SMTP ports whose public leg is TLS-terminated by CoreTraffic.
387
+ *
388
+ * Those backend legs arrive as plaintext even though the client's channel was
389
+ * encrypted, so without declaring them the AUTH-requires-encryption gate would
390
+ * refuse authentication on the only encrypted submission port. Derived from
391
+ * the generated route set rather than hardcoding 465, so it stays true when
392
+ * emailPortConfig changes.
393
+ */
394
+ private resolveEdgeTerminatedEmailPorts;
395
+ /**
396
+ * State the transport posture of every SMTP listener port at startup.
397
+ *
398
+ * AUTH is only offered on an encrypted transport, so an operator has to be
399
+ * able to see at a glance which submission ports can actually authenticate —
400
+ * missing certificate material silently disabling AUTH on 587 would otherwise
401
+ * look like a client problem.
402
+ */
403
+ private logEmailAuthTransportPosture;
342
404
  /**
343
405
  * Readiness of the RemoteIngress outbound mail egress path (mail-tagged edges).
344
406
  */