Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run containers using Non Privileged user #168

Merged
merged 1 commit into from
Sep 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ RUN apk add --no-cache ca-certificates bash git \
# Production image
FROM alpine:3.10

# Create Non Privilaged user
RUN groupadd -g 101 botkube && \
useradd -r -u 101 -g botkube botkube

# Run as Non Privilaged user
USER botkube

COPY --from=BUILD-ENV /go/bin/botkube /go/bin/botkube
COPY --from=BUILD-ENV /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=BUILD-ENV /usr/local/bin/kubectl /usr/local/bin/kubectl
Expand Down
4 changes: 4 additions & 0 deletions deploy-all-in-one-tls.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -319,3 +319,7 @@ spec:
- name: certs
secret:
secretName: botkube-secret
# run as non privilaged user
securityContext:
runAsUser: 101
runAsGroup: 101
4 changes: 4 additions & 0 deletions deploy-all-in-one.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -305,3 +305,7 @@ spec:
- name: config-volume
configMap:
name: botkube-configmap
# run as non privilaged user
securityContext:
runAsUser: 101
runAsGroup: 101
6 changes: 6 additions & 0 deletions helm/botkube/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,9 @@ spec:
secret:
secretName: {{ include "botkube.fullname" . }}-secret
{{ end }}
{{- if .Values.securityContext }}
securityContext:
runAsUser: {{ .Values.securityContext.runAsUser }}
runAsGroup: {{ .Values.securityContext.runAsGroup }}
{{ end }}

6 changes: 6 additions & 0 deletions helm/botkube/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ image:
nameOverride: ""
fullnameOverride: ""

# Configure securityContext to manage user Privileges in pods
# set to run as a Non-Privileged user by default
securityContext:
runAsUser: 101
runAsGroup: 101

# set one of the log levels- info, warn, debug, error, fatal, panic
logLevel: info

Expand Down