Skip to content

feat(deploy): hive-mx mail receiver on hive-oke (namespace mail) - #25

Merged
clubanderson merged 2 commits into
mainfrom
deploy/hive-mx
Nov 16, 2026
Merged

clubanderson merged 2 commits into
mainfrom
deploy/hive-mx

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Deploys hive-mx, hive's receive-only mail receiver (hivecommons/hive#18395), on hive-oke in a new namespace mail. Nothing outside mail is changed by these manifests; install.sh --hub-secret additionally writes one key (mail-token) into hive-hub/hive-hub-secrets.

  • deploy/hive-oke/mail/namespace.yaml: namespace mail, Pod Security restricted (enforced).
  • deploy/hive-oke/mail/hive-mx.yaml: Deployment (2 replicas, spread by node, PDB minAvailable 1), image ghcr.io/hivecommons/hive-mx:aa286e8@sha256:bbed51d5f92fe208f566ca19b2dab54e14a5985481dcb6ae0c1893ef9d6c764f (amd64+arm64, distroless static), uid/gid 65532 with fsGroup for the token Secret, read-only root, no capabilities, RuntimeDefault seccomp, probes on /healthz and /readyz. Service type LoadBalancer port 25 (to 2525) as an OCI Network Load Balancer with externalTrafficPolicy: Local, so SPF and the per-IP limit see the sender's address.
  • deploy/hive-oke/mail/policy.yaml: SMTP in from anywhere; egress only to CoreDNS and the hub Service.
  • deploy/hive-oke/mail/install.sh: idempotent; generates the hub bearer token once and never prints it.
  • deploy/hive-oke/mail/README.md: what hive-mx does, the hub env change (operator, rolls the hub), the DNS records, STARTTLS notes.

Applied to hive-oke already: namespace, Secret, NetworkPolicy, Deployment, Service (external IP 129.80.182.206). Pods answer SMTP (checked through a port-forward) and report not ready until the hub serves /api/mail/hosts, which needs HIVE_HUB_MAIL_TOKEN on the hub and a hub build that includes hivecommons/hive#18429.

hive-mx (hivecommons/hive#18395) accepts mail only for hive@<hive host>
and posts calendar invites, mail-in files and proof codes to the hub. It
runs as 2 replicas in a new namespace mail (Pod Security restricted,
non-root 65532, read-only root, no capabilities), behind an OCI Network
Load Balancer on port 25 with externalTrafficPolicy Local so SPF sees the
sender's IP. NetworkPolicy: SMTP in from anywhere, egress only to CoreDNS
and the hub Service. install.sh generates the hub bearer token once,
never prints it, and with --hub-secret copies it into
hive-hub/hive-hub-secrets (mail-token); the README lists the hub env
change and the DNS records the operator adds.

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
@kubestellar-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@hivecommons-hive

hivecommons-hive Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor.

@clubanderson this PR is held at stage/071-needs-author and the hive will not merge it yet.

Failing checks:

  • check-failure

Next: the hive does not push to your branch. Push a new head (or reply here); CI and the review swarm re-run automatically and the PR returns to the normal path.

Review findings from reviewer-2 (folded here because this head already carries its hive review):

Routing to a human: deploy/infra manifests that expose port 25 publicly and write a credential into another namespace's Secret. I read all six files at head c8eecd7.

Verified

  • CI lint fails: prettier --check . flags deploy/hive-oke/mail/README.md (run 43904888690, "Code style issues found"). The "Versions" table row at mail/README.md is a very wide single line; prettier --write should fix it. Not a runtime issue, but it blocks the check.
  • mail/policy.yaml header comment says health (8080) is allowed "from inside the cluster", but the only ingress rule lists port 2525. Kubelet probes bypass NetworkPolicy so nothing breaks; the comment is just wrong.
  • mail/install.sh with --hub-secret patches hive-hub/hive-hub-secrets (a different namespace's Secret) with the token; the token is never echoed, good. The PR body says these manifests are already applied to hive-oke, so merging is after the fact.

Open question (not verified, could not read the hub manifests)

  • policy.yaml egress allows the hub only on port 80 with selector app: hive-hub. NetworkPolicy matches the pod's port after Service DNAT, so if the hub container listens on something other than 80 (or the pod label differs), hive-mx can't reach /api/mail/hosts and stays not-ready. Someone with the hub Deployment should confirm the pod port and label.

Trust surfaces for a human: public SMTP ingress via OCI NLB with externalTrafficPolicy: Local, a wildcard *.hive.hivecommons.dev MX, no STARTTLS yet (README, "STARTTLS"), a hardcoded subnet OCID in hive-mx.yaml, and the cross-namespace Secret write. The pod hardening itself (restricted PSA, non-root, read-only rootfs, drop ALL, no SA token, digest-pinned image) looks right to me.

Review findings from reviewer (folded here because this head already carries its hive review):

Routing to a human: this adds deploy/infra manifests that expose TCP 25 to the internet and credential plumbing, so I am not judging it on my own.

Verified from the diff:

  • hive-mx.yaml is a Deployment with Service type LoadBalancer (OCI NLB, port 25, externalTrafficPolicy: Local), pinned by tag and digest, restricted PSS, read-only root, no capabilities.
  • install.sh --hub-secret merge-patches one key (mail-token) into hive-hub/hive-hub-secrets, the only write outside mail. The token is generated once with openssl rand and not printed.
  • policy.yaml egress is limited to kube-dns and pods labelled app: hive-hub in hive-hub on port 80. I could not check that label against the live hub Deployment (open question: confirm it matches, or hive-mx cannot reach the hub).

One low finding: the policy.yaml header says health (8080) is allowed from inside the cluster, but the only ingress rule is port 2525 (deploy/hive-oke/mail/policy.yaml). Kubelet probes bypass NetworkPolicy so readiness works; the comment is just inaccurate.

The README discloses that STARTTLS is off for now (plain SMTP). I have not approved or changed anything.

@hivecommons-hive

Copy link
Copy Markdown
Contributor
c8eecd7

ℹ️ Sentinel notice — informational; author is trusted (owner), merge is not blocked

Hive flagged this PR (author @clubanderson, head c8eecd740d87) because it matches behaviors that can override security controls, escalate privileges or damage the codebase. This is a heuristic, not an accusation — a maintainer should confirm the change is intended before it merges.

  • sensitive_path — changes 6 sensitive path(s) (Touches a sensitive path (OWNERS, workflows, policies, hive config, security docs, …))
    • deploy/hive-oke/README.md
    • deploy/hive-oke/mail/README.md
    • deploy/hive-oke/mail/hive-mx.yaml
    • deploy/hive-oke/mail/install.sh
    • deploy/hive-oke/mail/namespace.yaml
    • deploy/hive-oke/mail/policy.yaml

Hive did not add the sentinel-alert label because this author is trusted. The finding remains recorded for audit and the dashboard Security tab; set sentinel.trusted_authors_block: true to require the blocking label for trusted authors too.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Review follow-ups (below review.backlog.min_severity: P2)

Non-blocking findings below the backlog filing line are listed here instead of as issues, one comment per PR, updated in place. Tick them off as they are fixed; set review.backlog.min_severity: P3 to file every finding.

  • P3 info intent-alignment — Egress policy port 80 is the hub Service port, not verified as the pod targetPort (deploy/hive-oke/mail/policy.yaml:45): NetworkPolicy matches post-DNAT pod ports; if hive-hub Service port 80 maps to a different containerPort, hive-mx egress would be blocked. The hub manifests are not in this repo so I could not verify…

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correctness review at c8eecd7 (manifests only; no tests apply). Advisory, not blocking:

  1. Hub egress rule matches the Service port, not the pod port (deploy/hive-oke/mail/policy.yaml:42-46). NetworkPolicy is evaluated after Service DNAT, so port: 80 only works if the hub pod listens on 80. HIVE_MX_HUB_URL (hive-mx.yaml:61) targets the Service on 80, but I could not read the hub Service's targetPort from this repo or hivecommons/hive. If it is e.g. 8080, every hub call from hive-mx is dropped. The pods would stay unready and the PR body does not claim an end-to-end check, only SMTP via port-forward. Please confirm kubectl -n hive-hub get svc hive-hub -o jsonpath='{.spec.ports}' and the pod label app: hive-hub. If the pod port differs, add it:
      ports:
        - port: 80
          protocol: TCP
        - port: 8080   # replace with the hub container's actual port
          protocol: TCP
  1. Comment says health (8080) is open from inside the cluster, but the ingress rule only allows 2525 (policy.yaml:3-5 vs :28-31). Kubelet probes are exempt, so probes work. Any other in-cluster caller is blocked. Fix the comment or add a rule.
  2. install.sh:36 patch secret hive-hub-secrets fails under set -e if that Secret is missing. This runs after the token Secret is created, so a rerun recovers.

— hive: agent=adjudicator backend=claude model=claude-sonnet-5-5 claude=2.1.325

@hivecommons-hive

Copy link
Copy Markdown
Contributor

scanner: CI triage — PR-local (main lint is green). npm run lint fails in the prettier step on deploy/hive-oke/mail/README.md ("Code style issues found"). Fix: run npx prettier --write deploy/hive-oke/mail/README.md and push. Not pushing to this branch as it is not hive-authored.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

— hive: agent=scanner backend=claude model=claude-sonnet-5-5 claude=2.1.325

@hivecommons-hive

Copy link
Copy Markdown
Contributor

hive/scanner: lint fails only on prettier --check: deploy/hive-oke/mail/README.md needs formatting. Run npx prettier --write deploy/hive-oke/mail/README.md and push. Not pushing to this branch (human-authored).


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

— hive: agent=scanner backend=claude model=claude-sonnet-5-5 claude=2.1.325

@hivecommons-hive

Copy link
Copy Markdown
Contributor

scanner: lint fails only on prettier --check: deploy/hive-oke/mail/README.md is not formatted (eslint passes). Running npx prettier --write deploy/hive-oke/mail/README.md and pushing should turn it green. Not pushing to this branch (human-authored).


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

— hive: agent=scanner backend=claude model=claude-sonnet-5-5 claude=2.1.325

@hivecommons-hive

Copy link
Copy Markdown
Contributor

hive/scanner triage: the baseline check says this is PR-local (FIX_DIFF); main lint is green. lint fails only on prettier --check, which flags deploy/hive-oke/mail/README.md. Running npx prettier --write deploy/hive-oke/mail/README.md and pushing should clear it. Not pushing, since this is a human-authored branch.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

— hive: agent=scanner backend=claude model=claude-sonnet-5-5 claude=2.1.325

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
@clubanderson
clubanderson merged commit 9c94923 into main Nov 16, 2026
7 of 8 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the deploy/hive-mx branch November 16, 2026 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant