Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions deploy/hive-oke/mail/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,16 @@ certificate (see "STARTTLS" below).
- Accepts `RCPT TO` only for `hive@<host>` where the host is a hive the hub knows (subdomain, vanity
or dashboard host). The list comes from `GET /api/mail/hosts` on the hub every 60 seconds; until
the first list loads, RCPT gets a temporary 451.
- At most 5 recipients and 2 MB per message, per-IP and per-sender-domain rate limits, at most 100
connections, no AUTH, no relay. It never sends mail.
- At most 5 recipients and 35 MiB per message (`SIZE 36700160`: a 25 MB attachment after base64),
per-IP and per-sender-domain rate limits, a daily byte budget per hive (512 MiB), at most 100
connections and 8 messages in processing, no AUTH, no relay. It never sends mail.
- Each message is spooled to the size-limited `emptyDir` at `/var/spool/hive-mx` (1 GiB) while it is
processed, never held in memory whole; limits are 512 MiB of memory and 1.5 GiB of ephemeral
storage per pod (hivecommons/hive#18564).
- After DATA it records SPF, DKIM and DMARC alignment, keeps only calendar invites (scheduling
fields and join details), Markdown/audio/image attachments, or a proof code, and posts the result
to `POST /api/mail/inbound` on the hub. The hub signs it with the target hive's relay key and
fields and join details), the text body as a Markdown note, Markdown/audio/video/image
attachments, or a proof code, and posts the result to `POST /api/mail/inbound` on the hub
(multipart for large deliveries, which the hub relays to the spoke in signed pieces). The hub signs it with the target hive's relay key and
forwards it; it stores nothing. A hub or spoke that cannot take the mail makes hive-mx answer a
temporary 451, so the sender's server retries.

Expand Down
23 changes: 20 additions & 3 deletions deploy/hive-oke/mail/hive-mx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ spec:
value: /var/run/secrets/hive-mx-tls/tls.crt
- name: HIVE_MX_TLS_KEY
value: /var/run/secrets/hive-mx-tls/tls.key
# Mail is spooled to disk while it is processed, never held in memory whole
# (hivecommons/hive#18564). SIZE is 35 MiB (36700160) by default. At most 8 messages are
# processed at once, each needing about the message plus its decoded attachments
# (about 65 MB), so the spool stays under 600 MB; the emptyDir below caps it at 1 GiB.
- name: HIVE_MX_SPOOL_DIR
value: /var/spool/hive-mx
- name: HIVE_MX_MAX_CONCURRENT_DATA
value: "8"
ports:
- name: smtp
containerPort: 2525
Expand All @@ -92,10 +100,12 @@ spec:
resources:
requests:
cpu: 50m
memory: 64Mi
memory: 128Mi
ephemeral-storage: 256Mi
limits:
cpu: 500m
memory: 256Mi
cpu: "1"
memory: 512Mi
ephemeral-storage: 1536Mi
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
Expand All @@ -108,6 +118,9 @@ spec:
- name: tls
mountPath: /var/run/secrets/hive-mx-tls
readOnly: true
# The root filesystem is read-only; the spool is the only writable path.
- name: spool
mountPath: /var/spool/hive-mx
volumes:
- name: hub-token
secret:
Expand All @@ -118,6 +131,10 @@ spec:
secret:
secretName: hive-mx-tls
defaultMode: 0440
# Size-limited spool for messages in flight; the kubelet evicts the pod past it.
- name: spool
emptyDir:
sizeLimit: 1Gi
---
apiVersion: policy/v1
kind: PodDisruptionBudget
Expand Down
Loading