Repository navigation
feat(k8s): require Redis AUTH and restrict ingress with NetworkPolicy - #610
Open
SceptredHead wants to merge 1 commit into
Open
SceptredHead wants to merge 1 commit into
SceptredHead wants to merge 1 commit into
Conversation
Redis runs unauthenticated by default, allowing any pod in the namespace to connect. This commit closes that gap with two changes. Redis AUTH: - Added REDIS_PASSWORD to the prism-secrets Secret (empty placeholder; must be set to a strong random value before deploying to production). - Updated redis-statefulset.yaml to pass --requirepass via the REDIS_PASSWORD env var so Redis rejects unauthenticated connections. - Updated the readiness probe to pass -a "$REDIS_PASSWORD" to redis-cli. - Updated server-deployment.yaml to inject REDIS_PASSWORD from the Secret. - Extended config.ts with buildRedisUrl() which embeds the password into the REDIS_URL when REDIS_PASSWORD is present, so all ioredis/BullMQ clients authenticate without further changes. NetworkPolicy: - Added deploy/k8s/base/redis-network-policy.yaml with an Ingress policy that limits port-6379 access to pods labeled app.kubernetes.io/component: server. All other pods in the namespace (and outside) are denied. - Registered the new manifest in the base kustomization.yaml. Closes DevNiola#411
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Redis was deployed without authentication and without network isolation, so any pod in the
prismnamespace could reach it unauthenticated. This PR closes both gaps.What was implemented
Redis AUTH
deploy/k8s/base/secret.yaml— addedREDIS_PASSWORDkey (empty placeholder; must be set to a strong random value in production via a sealed secret or external secrets operator).deploy/k8s/base/redis-statefulset.yaml— passes--requirepass $(REDIS_PASSWORD)toredis-server, reads the value from the Secret via an env var. Updated the readiness probe to pass-a "$REDIS_PASSWORD"so it still works after AUTH is enabled.deploy/k8s/base/server-deployment.yaml— injectsREDIS_PASSWORDfrom the Secret into the server pod.apps/server/src/config.ts— addedbuildRedisUrl()which embeds the password into theREDIS_URLwhenREDIS_PASSWORDis set, so all ioredis and BullMQ clients authenticate automatically with no additional changes.NetworkPolicy
deploy/k8s/base/redis-network-policy.yaml— newNetworkPolicytargeting pods labeledcomponent: redisthat restricts port-6379 ingress to pods labeledcomponent: serveronly. All other pods (including the web frontend and any future workloads) are denied at the network layer.deploy/k8s/base/kustomization.yaml— registered the new manifest.Closes #411