mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 13:27:25 +01:00
loki-mailgate is the receiving half of the fleet email standard: one public address per app on its own host (hello@<app host>), no mail server or mailbox per app. - Receive-only SMTP on :25 (smtp-server). Routes by apps.conf (Loki's live copy, refreshed by every deploy, plus the one installed beside it), so a new site gets mail after the next deploy with no step here. Accepts only hello@, postmaster@ and abuse@; refuses everything else at SMTP time, so it never bounces and cannot relay. - SPF / DKIM / DMARC checked (mailauth); failures are marked, not dropped. - Spooled to disk before "250", then POSTed to http://127.0.0.1:<port>/api/mail/inbound signed with the fleet key MAIL_INBOUND_SECRET (mail-kit 0.2 inbound contract), retried with backoff until the app says 2xx. Delivered mail is pruned after 14 days: the app's own retention governs its copy. - Bundled to one file; a systemd unit with CAP_NET_BIND_SERVICE as ubuntu, ProtectSystem=strict; install-mailgate.sh creates the secret and its own STARTTLS key and opens 25/tcp; the manual Mailgate workflow tests, bundles and installs. test:mailgate joins verify. Checked end to end against the bundle: hello@skif accepted and delivered with a valid signature; another mailbox and an unknown host refused 550. Claude-Session: https://claude.ai/code/session_01TTH5cy8bKmEqzdTyAsbbT8 Co-authored-by: Claude <noreply@anthropic.com>
36 lines
1.1 KiB
JSON
36 lines
1.1 KiB
JSON
{
|
|
"name": "loki-mailgate",
|
|
"version": "0.1.0",
|
|
"description": "The fleet's mail gateway: receives mail for every app host (hello@<host>), checks where it came from, and delivers it signed to the app.",
|
|
"private": true,
|
|
"type": "module",
|
|
"main": "dist/server.js",
|
|
"scripts": {
|
|
"build": "tsc",
|
|
"start": "node dist/server.js",
|
|
"dev": "tsx src/server.ts",
|
|
"type-check": "tsc --noEmit",
|
|
"test": "tsx --test test/*.test.ts",
|
|
"bundle": "esbuild src/server.ts --bundle --platform=node --target=node20 --format=esm --outfile=dist/mailgate.mjs --log-level=warning --banner:js=\"import{createRequire as __cr}from'node:module';const require=__cr(import.meta.url);\""
|
|
},
|
|
"engines": {
|
|
"node": ">=20"
|
|
},
|
|
"dependencies": {
|
|
"@bitbaum/mail-kit": "^0.2.0",
|
|
"mailauth": "^8.0.1",
|
|
"mailparser": "^3.12.2",
|
|
"smtp-server": "^3.21.0"
|
|
},
|
|
"devDependencies": {
|
|
"@types/mailparser": "^3.4.6",
|
|
"@types/node": "^26",
|
|
"@types/nodemailer": "^8.0.2",
|
|
"@types/smtp-server": "^3.5.13",
|
|
"nodemailer": "^10.2.0",
|
|
"tsx": "^4.23.15",
|
|
"typescript": "^5.6.0",
|
|
"esbuild": "^0.28.2"
|
|
}
|
|
}
|