1
0
mirror of /repos/baseimage-docker.git synced 2025-12-30 08:01:31 +01:00

Do not save SSH host key in baseimage-docker. Instead, generate it automatically during boot.

This commit is contained in:
Hongli Lai (Phusion) 2014-01-31 16:02:01 +01:00
parent d2b28d25a6
commit abf75875a9
No known key found for this signature in database
GPG Key ID: 06A131094B6F4332
3 changed files with 12 additions and 3 deletions

View File

@ -69,14 +69,19 @@ By default, it allows SSH access for the key in `image/insecure_key`. This makes
# Set correct environment variables.
ENV HOME /root
# Remove authentication rights for insecure_key.
RUN rm -f /root/.ssh/authorized_keys /home/*/.ssh/authorized_keys
# Use baseimage-docker's init process.
# Regenerate SSH host keys. baseimage-docker does not contain any, so you
# have to do that yourself. You may also comment out this instruction; the
# init system will auto-generate one during boot.
RUN /etc/my_init.d/00_regen_ssh_host_keys.sh
# Use baseimage-docker's init system.
CMD ["/sbin/my_init"]
# ...put other build instructions here...
# ...put your own build instructions here...
# Clean up APT when done.
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

View File

@ -6,3 +6,5 @@ set -x
apt-get clean
rm -rf /build
rm -rf /tmp/* /var/tmp/*
rm -f /etc/ssh/ssh_host_*

View File

@ -5,6 +5,7 @@ set -x
## Install init process.
cp /build/my_init /sbin/
mkdir -p /etc/my_init.d
## Install runit.
$minimal_apt_get_install runit
@ -20,6 +21,7 @@ mkdir /var/run/sshd
mkdir /etc/service/sshd
cp /build/runit/sshd /etc/service/sshd/run
cp /build/config/sshd_config /etc/ssh/sshd_config
cp /build/00_regen_ssh_host_keys.sh /etc/my_init.d/
## Install default SSH key for root and app.
mkdir -p /root/.ssh