auto generate server key if not exists

This commit is contained in:
Boshi Lian 2017-07-30 02:42:29 +08:00
parent 4ca217ecf8
commit 928c2ffd2b
2 changed files with 13 additions and 1 deletions

View file

@ -5,9 +5,12 @@ RUN apt-get update && apt-get install -y libpam0g-dev libpam-google-authenticato
RUN ln -sf /usr/include/security/_pam_types.h /usr/include/security/pam_types.h
RUN go get -d -tags pam github.com/tg123/sshpiper/sshpiperd
ADD . /go/src/github.com/tg123/sshpiper/
RUN go install -ldflags "$(/go/src/github.com/tg123/sshpiper/sshpiperd/ldflags.sh)" -tags pam github.com/tg123/sshpiper/sshpiperd
EXPOSE 2222
ADD entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/go/bin/sshpiperd"]

9
entrypoint.sh Executable file
View file

@ -0,0 +1,9 @@
#!/bin/bash
set -euo pipefail
if [ ! -f /etc/ssh/ssh_host_rsa_key ];then
ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa
fi
exec "$@"