commit 9d7ac34f6413007be320fde1cc30fe54ca54a91c Author: Hermsi1337 Date: Fri Apr 28 19:51:24 2017 +0200 First release diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1c521d8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM alpine:latest + +LABEL maintainer "https://github.com/hermsi1337" + +ENV ROOT_PASSWORD root + +RUN apk --update add openssh \ + && sed -i s/#PermitRootLogin.*/PermitRootLogin\ yes/ /etc/ssh/sshd_config \ + && echo "root:${ROOT_PASSWORD}" | chpasswd \ + && rm -rf /var/cache/apk/* /tmp/* + +COPY entrypoint.sh /usr/local/bin/ + +EXPOSE 22 + +ENTRYPOINT ["entrypoint.sh"] diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..69711ce --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +# generate host keys if not present +ssh-keygen -A + +# check wether a random root-password is provided +if [ ! -z ${ROOT_PASSWORD} ] && [ "${ROOT_PASSWORD}" != "root" ]; then + echo "root:${ROOT_PASSWORD}" | chpasswd +fi + +# do not detach (-D), log to stderr (-e), passthrough other arguments +exec /usr/sbin/sshd -D -e "$@"