Skip to content

Commit

Permalink
Merge pull request #521 from pjbgf/main
Browse files Browse the repository at this point in the history
security: Drop capabilities, set userid and enable seccomp
  • Loading branch information
stefanprodan authored Jan 20, 2022
2 parents 3ca05e1 + 9ba76a1 commit e84031a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
6 changes: 1 addition & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,6 @@ FROM debian:bookworm-slim as controller
# Link repo to the GitHub Container Registry image
LABEL org.opencontainers.image.source="https://github.com/fluxcd/source-controller"

# Configure user
RUN groupadd controller && \
useradd --gid controller --shell /bin/sh --create-home controller

ARG TARGETPLATFORM
RUN apt update && apt install -y ca-certificates

Expand All @@ -102,5 +98,5 @@ COPY --from=build /workspace/source-controller /usr/local/bin/
COPY --from=libgit2-bullseye /libgit2/built-on-glibc-version /
COPY ATTRIBUTIONS.md /

USER controller
USER 65534:65534
ENTRYPOINT [ "source-controller" ]
9 changes: 7 additions & 2 deletions config/manager/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ spec:
prometheus.io/port: "8080"
spec:
terminationGracePeriodSeconds: 10
# Required for AWS IAM Role bindings
# https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts-technical-overview.html
securityContext:
# Required for AWS IAM Role bindings
# https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts-technical-overview.html
fsGroup: 1337
containers:
- name: manager
Expand All @@ -31,6 +31,11 @@ spec:
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
runAsNonRoot: true
capabilities:
drop: [ "ALL" ]
seccompProfile:
type: RuntimeDefault
ports:
- containerPort: 9090
name: http
Expand Down

0 comments on commit e84031a

Please sign in to comment.