Skip to content

Commit

Permalink
Run jupyterhub-ssh as non-root
Browse files Browse the repository at this point in the history
Ref #16
  • Loading branch information
yuvipanda committed Oct 27, 2020
1 parent a1911ac commit 089a85f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
12 changes: 12 additions & 0 deletions helm-chart/images/jupyterhub-ssh/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,21 @@ FROM python:3.8-slim

WORKDIR /srv/jupyterhub-ssh

ENV NB_UID=1000
ENV NB_USER jovyan

RUN adduser \
--disabled-password \
--shell "/sbin/nologin" \
--gecos "Default Jupyter user" \
--uid ${NB_UID} \
${NB_USER}

COPY . .
COPY helm-chart/images/jupyterhub-ssh/jupyterhub_ssh_config.py .

RUN pip3 install --no-cache-dir .

USER $NB_UID

ENTRYPOINT [ "python3", "-m", "jupyterhub_ssh" ]
3 changes: 3 additions & 0 deletions helm-chart/jupyterhub-ssh/templates/ssh/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ spec:
- name: server
image: "{{ .Values.ssh.image.repository }}:{{ .Values.ssh.image.tag }}"
imagePullPolicy: {{ .Values.ssh.image.pullPolicy }}
securityContext:
allowPrivilegeEscalation: false
runAsNonRoot: true
volumeMounts:
- name: secrets
mountPath: /etc/jupyterhub-ssh/secrets
Expand Down

0 comments on commit 089a85f

Please sign in to comment.