Initial release
This commit is contained in:
commit
7312c8fe07
27
Dockerfile
Normal file
27
Dockerfile
Normal file
@ -0,0 +1,27 @@
|
||||
# NAME leenooks/ssh
|
||||
# VERSION latest
|
||||
|
||||
FROM alpine
|
||||
|
||||
# Change to http respositories, so they we can cache the install packages
|
||||
RUN if [ -n ${HTTP_PROXY} ] ; then sed -i -e s'/https/http/' /etc/apk/repositories; fi
|
||||
|
||||
ENV SSH_KEY_PATH=/etc/ssh/keys
|
||||
|
||||
# Base
|
||||
RUN apk add --no-cache bash git unzip openssh
|
||||
RUN sed -i -e "s:#HostKey\ /etc/ssh:HostKey ${SSH_KEY_PATH}:" /etc/ssh/sshd_config
|
||||
|
||||
RUN adduser -g "Hosting Admin User" -u 1000 -G www-data -h /var/www/html -HD lamp
|
||||
|
||||
# DB Clients
|
||||
RUN apk add --no-cache mariadb-client postgresql-client
|
||||
|
||||
COPY init /sbin/
|
||||
|
||||
|
||||
VOLUME [ "/etc/ssh/keys" ]
|
||||
EXPOSE 22
|
||||
|
||||
# Starting
|
||||
ENTRYPOINT [ "/sbin/init" ]
|
32
init
Executable file
32
init
Executable file
@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
|
||||
#set -e
|
||||
|
||||
generate_host_key_type() {
|
||||
local bit_size key_type
|
||||
|
||||
key_type=$1
|
||||
if [ ! -f /etc/ssh/ssh_host_"${key_type}"_key ]; then
|
||||
case $key_type in
|
||||
ecdsa) bit_size="$ecdsa_bit_size";;
|
||||
rsa) bit_size="$rsa_bit_size";;
|
||||
esac
|
||||
ssh-keygen \
|
||||
-q \
|
||||
-f ${SSH_KEY_PATH}/ssh_host_"$key_type"_key \
|
||||
-N '' \
|
||||
-t "$key_type" \
|
||||
${bit_size:+ -b ${bit_size}} || return 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
for type in ${key_types_to_generate:-dsa ecdsa ed25519 rsa}; do
|
||||
generate_host_key_type "$type" || return 1
|
||||
done
|
||||
|
||||
/usr/sbin/sshd -e
|
||||
|
||||
# Sleep,enabling our SIGTERM to shut us down gracefully
|
||||
(while true; do sleep 3600; done) &
|
||||
wait
|
Loading…
Reference in New Issue
Block a user