diff options
| -rw-r--r-- | Cargo.lock | 100 | ||||
| -rw-r--r-- | Cargo.toml | 9 | ||||
| -rw-r--r-- | README.md | 12 | ||||
| -rw-r--r-- | http2lmtp.service (renamed from mail-ingest.service) | 6 |
4 files changed, 25 insertions, 102 deletions
@@ -67,12 +67,6 @@ dependencies = [ ] [[package]] -name = "bitflags" -version = "2.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b588b76d00fde79687d7646a9b5bdf3cc0f655e0bbd080335a95d7e96f3587da" - -[[package]] name = "bytes" version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -85,16 +79,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] -name = "errno" -version = "0.3.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" -dependencies = [ - "libc", - "windows-sys", -] - -[[package]] name = "form_urlencoded" version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -170,6 +154,18 @@ dependencies = [ ] [[package]] +name = "http2lmtp" +version = "0.1.0" +dependencies = [ + "anyhow", + "axum", + "subtle", + "tokio", + "tracing", + "tracing-subscriber", +] + +[[package]] name = "httparse" version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -217,19 +213,6 @@ dependencies = [ ] [[package]] -name = "ingest" -version = "0.1.0" -dependencies = [ - "anyhow", - "axum", - "bytes", - "subtle", - "tokio", - "tracing", - "tracing-subscriber", -] - -[[package]] name = "itoa" version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -248,15 +231,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2" [[package]] -name = "lock_api" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" -dependencies = [ - "scopeguard", -] - -[[package]] name = "log" version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -307,29 +281,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" [[package]] -name = "parking_lot" -version = "0.12.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-link", -] - -[[package]] name = "percent-encoding" version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -360,27 +311,12 @@ dependencies = [ ] [[package]] -name = "redox_syscall" -version = "0.5.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" -dependencies = [ - "bitflags", -] - -[[package]] name = "ryu" version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" [[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - -[[package]] name = "serde" version = "1.0.229" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -455,16 +391,6 @@ dependencies = [ ] [[package]] -name = "signal-hook-registry" -version = "1.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" -dependencies = [ - "errno", - "libc", -] - -[[package]] name = "slab" version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -538,9 +464,7 @@ dependencies = [ "bytes", "libc", "mio", - "parking_lot", "pin-project-lite", - "signal-hook-registry", "socket2", "tokio-macros", "windows-sys", @@ -1,13 +1,14 @@ [package] -name = "ingest" +name = "http2lmtp" +description = "LMTP delivery daemon for HTTP-enveloped mail" +repository = "https://git.dilluti0n.com/http2lmtp" version = "0.1.0" -edition = "2024" +edition = "2021" [dependencies] axum = "0.8" -tokio = { version = "1", features = ["full"] } +tokio = { version = "1", features = ["rt-multi-thread", "net", "io-util", "macros"] } anyhow = "1" -bytes = "1" subtle = "2" tracing = "0.1" tracing-subscriber = "0.3" @@ -1,11 +1,11 @@ -# ingest +# http2lmtp Recieve HTTP-enveloped mail and route it as LMTP to local Unix socket. Cloudflare Email Workers can only reach a cf tunnel over HTTP, so the message has to be wrapped in an HTTP request to get through. On the -server side, `ingest` unwraps it and hands it to an LMTP-capable MDA -such as Dovecot. +server side, `http2lmtp` unwraps it and hands it to an LMTP-capable +MDA such as Dovecot. ## Quickstart @@ -55,7 +55,5 @@ export default { | `422 Unprocessable Entity` | LMTP replied with a permanent error (5xx), e.g. unknown recipient | Do not retry; bounce | | `503 Service Unavailable` | LMTP unreachable or replied with a temporary error (4xx) | Retry later | -`ingest` itself never retries. When a Worker throws on a non-2xx -response, Cloudflare returns a temporary error to the sending MTA, -which keeps the message in the sender's queue for a few days. (This -behaviour is not documented by Cloudflare; verified against Gmail.) +Note: `http2lmtp` itself never retries. The client is responsible for +it. diff --git a/mail-ingest.service b/http2lmtp.service index 0cbfeae..87e07e0 100644 --- a/mail-ingest.service +++ b/http2lmtp.service @@ -1,12 +1,12 @@ [Unit] -Description=Mail ingest (HTTP to LMTP) +Description=LMTP delivery daemon for HTTP-enveloped mail After=network.target dovecot.service Wants=dovecot.service [Service] Type=exec -ExecStart=/usr/local/bin/ingest -EnvironmentFile=/etc/ingest.env +ExecStart=/usr/local/bin/http2lmtp +EnvironmentFile=/etc/http2lmtp.env Restart=on-failure RestartSec=2 |
