Skip to content

Commit

Permalink
SSH_PORT env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Amir Mofasser committed Aug 9, 2018
1 parent abac15e commit ff4b040
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 81 deletions.
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
FROM alpine:3.6
FROM alpine:3.7

LABEL maintainer="Amir Mofasser (@amimof)"

COPY sshd_config /etc/ssh/sshd_config
COPY server /

RUN apk add --no-cache --update openssh bash \
RUN set -x \
&& apk add --no-cache --update openssh bash \
&& mkdir -p /var/run/sshd \
&& chmod +x /server

EXPOSE 22

CMD ["/server"]
77 changes: 0 additions & 77 deletions kubeconfig.yaml

This file was deleted.

16 changes: 16 additions & 0 deletions pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
apiVersion: v1
kind: Pod
metadata:
name: sftp
spec:
containers:
- name: sftp
image: amimof/sftp
env:
- name: SSH_USERNAME
value: "beyonce"
- name: SSH_PASSWORD
value: "knowles"
ports:
- containerPort: 22
6 changes: 6 additions & 0 deletions server
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ else
sed -i "s/PasswordAuthentication\s[^ ]*/PasswordAuthentication yes/g" /etc/ssh/sshd_config
fi

# Set Port to listen on
if [ ! -z "$SSH_PORT" ]; then
echo "INFO: Setting Port to ${SSH_PORT}"
sed -i "s/Port\s[^ ]*/Port ${SSH_PORT}/g" /etc/ssh/sshd_config
fi

# Change ownership and permissions of users home root dir
echo "INFO: Change ownership and permissions of home directory"
chown root:root /home/$SSH_USERNAME
Expand Down
1 change: 1 addition & 0 deletions sshd_config
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Protocol 2
Port 22
UseDNS no
PermitRootLogin no
X11Forwarding no
Expand Down

0 comments on commit ff4b040

Please sign in to comment.