@push.rocks/smartmta 9.4.1 → 9.6.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 +41 -0
- package/dist_rust/mailer-bin_linux_amd64 +0 -0
- package/dist_rust/mailer-bin_linux_amd64.tsrust-build.json +14 -0
- package/dist_rust/mailer-bin_linux_arm64 +0 -0
- package/dist_rust/mailer-bin_linux_arm64.tsrust-build.json +14 -0
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/index.d.ts +2 -0
- package/dist_ts/index.js +3 -1
- package/dist_ts/mail/delivery/classes.delivery.queue.d.ts +63 -2
- package/dist_ts/mail/delivery/classes.delivery.queue.js +749 -193
- package/dist_ts/mail/delivery/classes.delivery.system.d.ts +6 -0
- package/dist_ts/mail/delivery/classes.delivery.system.js +146 -62
- package/dist_ts/mail/delivery/functions.raw-email.d.ts +9 -0
- package/dist_ts/mail/delivery/functions.raw-email.js +85 -0
- package/dist_ts/mail/delivery/symbols.delivery.queue.d.ts +6 -0
- package/dist_ts/mail/delivery/symbols.delivery.queue.js +7 -0
- package/dist_ts/mail/index.d.ts +1 -0
- package/dist_ts/mail/index.js +1 -1
- package/dist_ts/mail/routing/classes.unified.email.server.d.ts +180 -4
- package/dist_ts/mail/routing/classes.unified.email.server.js +592 -172
- package/dist_ts/mail/routing/interfaces.d.ts +41 -0
- package/dist_ts/mail/routing/symbols.unified.email.server.d.ts +2 -0
- package/dist_ts/mail/routing/symbols.unified.email.server.js +3 -0
- package/dist_ts/security/classes.rustsecuritybridge.d.ts +11 -0
- package/dist_ts/security/classes.rustsecuritybridge.js +1 -1
- package/package.json +6 -6
- package/readme.md +78 -4
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/index.ts +2 -0
- package/ts/mail/delivery/classes.delivery.queue.ts +923 -226
- package/ts/mail/delivery/classes.delivery.system.ts +192 -80
- package/ts/mail/delivery/functions.raw-email.ts +111 -0
- package/ts/mail/delivery/symbols.delivery.queue.ts +6 -0
- package/ts/mail/index.ts +1 -0
- package/ts/mail/routing/classes.unified.email.server.ts +780 -192
- package/ts/mail/routing/interfaces.ts +43 -0
- package/ts/mail/routing/symbols.unified.email.server.ts +6 -0
- package/ts/security/classes.rustsecuritybridge.ts +6 -0
- package/readme.hints.md +0 -37
- package/readme.plan.md +0 -30
|
@@ -203,6 +203,49 @@ export interface ISmtpAuthAccount {
|
|
|
203
203
|
scope?: ISmtpAuthAccountScope;
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
+
/**
|
|
207
|
+
* Context handed to `hooks.onAuthenticate` for a PLAIN/LOGIN attempt whose
|
|
208
|
+
* username is not declared in `auth.accounts` or `auth.users`.
|
|
209
|
+
*/
|
|
210
|
+
export interface ISmtpAuthenticateContext {
|
|
211
|
+
/** Username exactly as supplied by the client. */
|
|
212
|
+
username: string;
|
|
213
|
+
/** Password exactly as supplied by the client. */
|
|
214
|
+
password: string;
|
|
215
|
+
/** SMTP session the attempt belongs to. */
|
|
216
|
+
sessionId: string;
|
|
217
|
+
/** Remote peer address of the SMTP connection. */
|
|
218
|
+
remoteAddress: string;
|
|
219
|
+
/** Aborted when the hook exceeds `smtp.authenticationTimeoutMs`. */
|
|
220
|
+
abortSignal?: AbortSignal;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Result of an `hooks.onAuthenticate` credential verification.
|
|
225
|
+
*/
|
|
226
|
+
export interface ISmtpAuthenticateDecision {
|
|
227
|
+
/** Whether the supplied credential is valid. */
|
|
228
|
+
accepted: boolean;
|
|
229
|
+
/**
|
|
230
|
+
* Reason for a rejection, recorded in the server log.
|
|
231
|
+
*
|
|
232
|
+
* It is deliberately NOT sent to the client: the SMTP listener answers every
|
|
233
|
+
* failed authentication with the same `535 5.7.8 Authentication credentials
|
|
234
|
+
* invalid`, so a caller cannot probe which usernames exist. Use this to make
|
|
235
|
+
* an operator's log say why a binding was refused.
|
|
236
|
+
*/
|
|
237
|
+
message?: string;
|
|
238
|
+
/**
|
|
239
|
+
* Send-authorization scope for the resulting session, enforced identically
|
|
240
|
+
* to a configured account's scope for the lifetime of that session.
|
|
241
|
+
*
|
|
242
|
+
* Absent scope = unrestricted, matching `ISmtpAuthAccount.scope`. A hook
|
|
243
|
+
* that authenticates tenants MUST return a scope; without one the session
|
|
244
|
+
* may send as any sender to any recipient.
|
|
245
|
+
*/
|
|
246
|
+
scope?: ISmtpAuthAccountScope;
|
|
247
|
+
}
|
|
248
|
+
|
|
206
249
|
/**
|
|
207
250
|
* Context for route evaluation
|
|
208
251
|
*/
|
|
@@ -446,8 +446,14 @@ interface ISmtpSendRawOptions {
|
|
|
446
446
|
envelopeFrom: string;
|
|
447
447
|
envelopeTo: string[];
|
|
448
448
|
rawMessageBase64: string;
|
|
449
|
+
dkim: { domain: string; selector: string; privateKey: string; keyType?: string };
|
|
450
|
+
connectionTimeoutSecs?: number;
|
|
451
|
+
socketTimeoutSecs?: number;
|
|
449
452
|
poolKey?: string;
|
|
453
|
+
maxPoolConnections?: number;
|
|
454
|
+
tlsOpportunistic?: boolean;
|
|
450
455
|
disablePooling?: boolean;
|
|
456
|
+
outboundAuthenticationCaptureId?: string;
|
|
451
457
|
}
|
|
452
458
|
|
|
453
459
|
interface ISmtpVerifyOptions {
|
package/readme.hints.md
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# Project Hints
|
|
2
|
-
|
|
3
|
-
## Rust Workspace
|
|
4
|
-
- Rust code lives in `rust/` with a Cargo workspace
|
|
5
|
-
- Crates: `mailer-core`, `mailer-smtp`, `mailer-security`, `mailer-napi`, `mailer-bin`
|
|
6
|
-
- `mailer-bin` is the binary target that `tsrust` builds for cross-compilation
|
|
7
|
-
- `mailer-napi` is a cdylib for N-API bindings (not built by tsrust, needs separate napi-rs build pipeline)
|
|
8
|
-
- tsrust only supports binary targets (looks for `src/main.rs` or `[[bin]]` entries)
|
|
9
|
-
- Cross-compilation targets: `linux_amd64`, `linux_arm64` (configured in `.smartconfig.json`)
|
|
10
|
-
- Build output goes to `dist_rust/`
|
|
11
|
-
|
|
12
|
-
## Build
|
|
13
|
-
- `pnpm build` runs `tsbuild tsfolders && tsrust`
|
|
14
|
-
- `pnpm run check` uses `@git.zone/tsbuild` 4.4.2 for production and test type checks
|
|
15
|
-
- `tsrust` independently works and produces binaries in `dist_rust/`
|
|
16
|
-
|
|
17
|
-
## Key Dependencies (Rust)
|
|
18
|
-
- `tokio` - async runtime
|
|
19
|
-
- `tokio-rustls` - TLS
|
|
20
|
-
- `hickory-dns` (hickory-resolver) - DNS resolution
|
|
21
|
-
- `mail-auth` - DKIM/SPF/DMARC (by Stalwart Labs)
|
|
22
|
-
- `mailparse` - MIME parsing
|
|
23
|
-
- `napi` + `napi-derive` - Node.js bindings
|
|
24
|
-
- `ring` - crypto primitives
|
|
25
|
-
- `dashmap` - concurrent hash maps
|
|
26
|
-
|
|
27
|
-
## Static Rust Binaries
|
|
28
|
-
|
|
29
|
-
- The Rust binaries in `dist_rust/` are statically linked (static-pie) via `"static": true` in the `@git.zone/tsrust` block of `.smartconfig.json` (tsrust >= 1.4.1). They run on both glibc (Debian/Ubuntu) and musl (Alpine) systems.
|
|
30
|
-
- tsrust injects `RUSTFLAGS="-C target-feature=+crt-static"` only into its own per-target cargo invocations and verifies the result (no `PT_INTERP` ELF header). Keep `rust/.cargo/config.toml` free of `rustflags` entries: the injected env variable would replace them, and a repo-wide `rustflags` would also break plain `cargo test`/`cargo check` (proc-macros cannot build with `+crt-static` on linux-gnu without an explicit `--target`).
|
|
31
|
-
- `pnpm run test:rust` runs the Rust unit tests; plain `cargo test` in `rust/` works as well.
|
|
32
|
-
- Verify linkage manually with `ldd dist_rust/<binary>_linux_amd64` → "statically linked".
|
|
33
|
-
|
|
34
|
-
## Type Checking
|
|
35
|
-
|
|
36
|
-
- `@git.zone/tsbuild` is pinned at 4.4.2 and the stricter production/test checks are clean.
|
|
37
|
-
- Do not downgrade tsbuild or add `skipLibCheck` to production configuration; fix source types at their origin.
|
package/readme.plan.md
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# Rust Migration Plan
|
|
2
|
-
|
|
3
|
-
## Completed Phases
|
|
4
|
-
|
|
5
|
-
### Phase 6: Durable Per-Recipient Delivery And Bounce Outbox
|
|
6
|
-
- Queue schema V2 stores explicit recipient dispositions and deterministic bounce operations in managed blob storage
|
|
7
|
-
- Final 250 acceptance, permanent 5xx terminal state, and unresolved 4xx retry semantics are checkpointed per recipient
|
|
8
|
-
- Built-in bounce processing is idempotent by operation ID; custom handlers receive the ID for at-least-once deduplication
|
|
9
|
-
- Queue and delivery observers are isolated from committed state, statistics, and downstream listeners
|
|
10
|
-
|
|
11
|
-
### Phase 3: Rust Primary Backend (DKIM/SPF/DMARC/IP Reputation)
|
|
12
|
-
- Rust is the mandatory security backend — no TS fallbacks
|
|
13
|
-
- All DKIM signing/verification, SPF, DMARC, IP reputation through Rust bridge
|
|
14
|
-
|
|
15
|
-
### Phase 5: BounceManager + ContentScanner
|
|
16
|
-
- BounceManager bounce detection delegated to Rust `detectBounce` IPC command
|
|
17
|
-
- ContentScanner pattern matching delegated to new Rust `scanContent` IPC command
|
|
18
|
-
- New module: `rust/crates/mailer-security/src/content_scanner.rs` (10 Rust tests)
|
|
19
|
-
- ~215 lines removed from BounceManager, ~350 lines removed from ContentScanner
|
|
20
|
-
- Binary attachment scanning (PE headers, VBA macros) stays in TS
|
|
21
|
-
- Custom rules (runtime-configured) stay in TS
|
|
22
|
-
- Net change: ~-560 TS lines, +265 Rust lines
|
|
23
|
-
|
|
24
|
-
## Deferred
|
|
25
|
-
|
|
26
|
-
| Component | Rationale |
|
|
27
|
-
|-----------|-----------|
|
|
28
|
-
| EmailValidator | Already thin; uses smartmail; minimal gain |
|
|
29
|
-
| DNS record generation | Pure string building; zero benefit from Rust |
|
|
30
|
-
| MIME building (`toRFC822String`) | Sync in TS, async via IPC; too much blast radius |
|