Security defaults: NetworkPolicies, and the restricted map #21

Merged
jcoffey-dev merged 1 commits from feat/security-defaults into main 2026-11-19 01:19:16 +00:00
Owner

K-C4 (#4).

Most of K-C4 was already in place: non-root, drop ALL, a read-only root, RuntimeDefault seccomp, no service-account tokens except the upgrade Job's, and secrets mounted as files. This adds what was missing:

  • networkPolicy, on by default. Every pod of the release starts from deny-all, in and out:
    • server: its mail listeners and https from anywhere, http from networkPolicy.httpFrom and the webmail (anywhere when httpFrom is empty); egress anywhere, or DNS plus networkPolicy.serverEgress.
    • seed and upgrade Jobs: nothing in, egress as the server.
    • webmail: 8080 from httpFrom; DNS, the server's http port, and TCP 80/443 for remote images and calendars (networkPolicy.webmailInternet).
    • console: 8080 from httpFrom, and nothing out.
  • README: the security defaults and the NetworkPolicy map. The map is also in the template's header.
  • Tests: 7 new unit tests (61 in total), and ci/everything-values.yaml renders the narrowed branches. tools/check.sh passes.

Why the server's egress is open by default: a mail server delivers to, and looks up, anywhere, and the data store's address is the operator's. serverEgress is there to narrow it.

Tested on kind (kindnet enforces NetworkPolicy), with the inbuxa namespace enforcing restricted:

  • A server-side dry run of every object, Jobs included, in a namespace with warn and enforce set to restricted gives no warnings.
  • Every Deployment restarted under enforcement. A helm upgrade ran the upgrade Job under enforcement and the policies.
  • Webmail sign-in across replicas, console sign-in, and mail in through the load balancer to IMAPS all pass.
  • Webmail to the server's 8080 is open; to its port 25 and to Postgres it's blocked. The console is blocked to everything.
  • From another namespace, the server's listeners are open and a non-listener port is blocked. With httpFrom set to one namespace, another namespace's access to 8080 is blocked and the webmail's still works.

Until #19 merges (server rc.32), one secret is still an environment variable: the webmail's client secret on the server's side. The README says so, and #19 will drop that sentence.

K-C4 (#4). Most of K-C4 was already in place: non-root, drop ALL, a read-only root, RuntimeDefault seccomp, no service-account tokens except the upgrade Job's, and secrets mounted as files. This adds what was missing: - **`networkPolicy`, on by default.** Every pod of the release starts from deny-all, in and out: - **server:** its mail listeners and `https` from anywhere, `http` from `networkPolicy.httpFrom` and the webmail (anywhere when `httpFrom` is empty); egress anywhere, or DNS plus `networkPolicy.serverEgress`. - **seed and upgrade Jobs:** nothing in, egress as the server. - **webmail:** 8080 from `httpFrom`; DNS, the server's `http` port, and TCP 80/443 for remote images and calendars (`networkPolicy.webmailInternet`). - **console:** 8080 from `httpFrom`, and nothing out. - **README:** the security defaults and the NetworkPolicy map. The map is also in the template's header. - **Tests:** 7 new unit tests (61 in total), and `ci/everything-values.yaml` renders the narrowed branches. `tools/check.sh` passes. Why the server's egress is open by default: a mail server delivers to, and looks up, anywhere, and the data store's address is the operator's. `serverEgress` is there to narrow it. **Tested on kind (kindnet enforces NetworkPolicy), with the `inbuxa` namespace enforcing restricted:** - A server-side dry run of every object, Jobs included, in a namespace with warn and enforce set to restricted gives no warnings. - Every Deployment restarted under enforcement. A `helm upgrade` ran the upgrade Job under enforcement and the policies. - Webmail sign-in across replicas, console sign-in, and mail in through the load balancer to IMAPS all pass. - Webmail to the server's 8080 is open; to its port 25 and to Postgres it's blocked. The console is blocked to everything. - From another namespace, the server's listeners are open and a non-listener port is blocked. With `httpFrom` set to one namespace, another namespace's access to 8080 is blocked and the webmail's still works. Until #19 merges (server rc.32), one secret is still an environment variable: the webmail's client secret on the server's side. The README says so, and #19 will drop that sentence.
jcoffey-dev added 1 commit 2026-11-19 01:03:50 +00:00
networkPolicy, on by default: every pod of the release starts from deny
all, in and out. The server takes mail on its listeners from anywhere and
connects anywhere; httpFrom narrows who reaches the HTTP ports, and
serverEgress narrows the server's and the Jobs' egress to DNS plus those
rules. The webmail reaches DNS, the server's http port and, for remote
images and calendars, TCP 80 and 443. The console reaches nothing.

README: the security defaults and the NetworkPolicy map.
jcoffey-dev merged commit c7e48e89b2 into main 2026-11-19 01:19:16 +00:00
jcoffey-dev deleted branch feat/security-defaults 2026-11-19 01:19:16 +00:00
Sign in to join this conversation.