diff --git a/Dockerfile b/Dockerfile index d188ee0..d3b6e1c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] diff --git a/README.md b/README.md index 34ecc38..4e1b2cf 100644 --- a/README.md +++ b/README.md @@ -73,11 +73,11 @@ $ docker run \ ssh-keygen -t rsa -b 4096 -f ~/mykeys/ssh_host_rsa_key # dsa -ssh-keygen -t dsa -f ~/mykeys/ssh_host_rsa_key +ssh-keygen -t dsa -f ~/mykeys/ssh_host_dsa_key # ecdsa -ssh-keygen -t ecdsa -f ~/mykeys/ssh_host_rsa_key +ssh-keygen -t ecdsa -f ~/mykeys/ssh_host_ecdsa_key # ed25519 -ssh-keygen -t ed25519 -f ~/mykeys/ssh_host_rsa_key +ssh-keygen -t ed25519 -f ~/mykeys/ssh_host_ed25519_key ``` \ No newline at end of file diff --git a/pod.yaml b/pod.yaml new file mode 100644 index 0000000..73c7779 --- /dev/null +++ b/pod.yaml @@ -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 \ No newline at end of file diff --git a/server b/server index 90fae49..6983bb2 100644 --- a/server +++ b/server @@ -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 diff --git a/sshd_config b/sshd_config index 41719f2..0863531 100644 --- a/sshd_config +++ b/sshd_config @@ -1,4 +1,5 @@ Protocol 2 +Port 22 UseDNS no PermitRootLogin no X11Forwarding no