Skip to content

Commit

Permalink
change docker-image to run as numeric userid and update k8s examples
Browse files Browse the repository at this point in the history
  • Loading branch information
sseide committed Apr 21, 2020
1 parent f406fa7 commit 3899423
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,10 @@
# Redis-Commander CHANGELOG

## Next Version
#### Enhancements
* set user in Dockerfile as numeric value to allow Kubernetes to enforce non-root user
* update Kubernetes examples with security settings for Redis Commander

## Version 0.7.0
#### Bugfixes
* fix error on Windows on getting package installation path, #388
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Expand Up @@ -22,7 +22,7 @@ RUN apk update \
&& apk add --no-cache --virtual .patch-dep patch \
&& update-ca-certificates \
&& echo -e "\n---- Create runtime user and fix file access rights ----------" \
&& adduser ${SERVICE_USER} -h ${HOME} -G root -S \
&& adduser ${SERVICE_USER} -h ${HOME} -G root -S -u 1000 \
&& chown -R root.root ${HOME} \
&& chown -R ${SERVICE_USER} ${HOME}/config \
&& chmod g+w ${HOME}/config \
Expand All @@ -37,7 +37,7 @@ RUN apk update \
&& ${HOME}/docker/harden.sh \
&& rm -rf /tmp/* /root/.??* /root/cache /var/cache/apk/*

USER ${SERVICE_USER}
USER 1000

HEALTHCHECK --interval=1m --timeout=2s CMD ["/redis-commander/bin/healthcheck.js"]

Expand Down
11 changes: 11 additions & 0 deletions k8s/redis-commander/deployment-password-protected-redis.yaml
Expand Up @@ -26,3 +26,14 @@ spec:
ports:
- name: redis-commander
containerPort: 8081
#resources:
# limits:
# cpu: "500m"
# memory: "512M"
securityContext:
runAsNonRoot: true
readOnlyRootFilesystem: false
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
12 changes: 12 additions & 0 deletions k8s/redis-commander/deployment.yaml
Expand Up @@ -24,3 +24,15 @@ spec:
ports:
- name: redis-commander
containerPort: 8081
#resources:
# limits:
# cpu: "500m"
# memory: "512M"
securityContext:
runAsNonRoot: true
readOnlyRootFilesystem: false
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL

23 changes: 23 additions & 0 deletions k8s/redis-commander/ingress.yml
@@ -0,0 +1,23 @@
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: redis-commander-ingress
labels:
app: redis-commander
annotations:
# ssl + hsts config
#ingress.kubernetes.io/ssl-proxy-headers: "X-Forwarded-Proto:https"
#ingress.kubernetes.io/ssl-redirect: "true"
#ingress.kubernetes.io/force-hsts: "true"
#ingress.kubernetes.io/hsts-max-age: "315360000"
#ingress.kubernetes.io/hsts-preload: "true"
#ingress.kubernetes.io/hsts-include-subdomains: true
spec:
rules:
- host: redis.local
http:
paths:
- path: "/"
backend:
serviceName: redis-commander
servicePort: 8081

0 comments on commit 3899423

Please sign in to comment.