Skip to content

feat: add NetworkPolicy, ServiceAccount & harden .gitignore#194

Closed
saitama3292-onepunch wants to merge 1 commit intoopenabdev:mainfrom
saitama3292-onepunch:feat/k8s-hardening
Closed

feat: add NetworkPolicy, ServiceAccount & harden .gitignore#194
saitama3292-onepunch wants to merge 1 commit intoopenabdev:mainfrom
saitama3292-onepunch:feat/k8s-hardening

Conversation

@saitama3292-onepunch
Copy link
Copy Markdown

What

Add Kubernetes security hardening to the Helm chart:

NetworkPolicy

  • Block all ingress — OpenAB is outbound-only (Discord WebSocket), no pod or external traffic should reach it
  • Restrict egress to only 443/TCP (Discord Gateway/API) and 53/TCP+UDP (DNS)

ServiceAccount

  • Dedicated SA per agent with automountServiceAccountToken: false
  • Prevents attackers from using K8s API tokens if they gain shell access

.gitignore

  • Add patterns for .env, *.pem, *.key, secrets/, kubeconfig to prevent accidental credential commits

Changes

  • charts/openab/templates/networkpolicy.yaml — new
  • charts/openab/templates/serviceaccount.yaml — new
  • charts/openab/templates/deployment.yaml — add serviceAccountName
  • charts/openab/values.yaml — add networkPolicy.enabled and serviceAccount.create toggles (default: true)
  • .gitignore — add security-related patterns

Toggles

Both features are enabled by default and can be disabled:

networkPolicy:
  enabled: false
serviceAccount:
  create: false

- NetworkPolicy: block all ingress, egress allow only 443/TCP + 53/UDP+TCP
- ServiceAccount: dedicated SA per agent with automountServiceAccountToken: false
- Deployment: reference new ServiceAccount when enabled
- values.yaml: add networkPolicy.enabled and serviceAccount.create toggles (default true)
- .gitignore: add .env, *.pem, *.key, secrets/, kubeconfig patterns
@thepagent
Copy link
Copy Markdown
Collaborator

Closing in favor of #197 which covers NetworkPolicy, ServiceAccount, seccomp, readOnlyRootFilesystem, and HEALTHCHECK fix in a more comprehensive approach. Thanks! 🙏

@thepagent thepagent closed this Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants