diff options
Diffstat (limited to 'docker/etc/s6/openssh')
-rwxr-xr-x | docker/etc/s6/openssh/finish | 2 | ||||
-rwxr-xr-x | docker/etc/s6/openssh/run | 6 | ||||
-rwxr-xr-x | docker/etc/s6/openssh/setup | 29 |
3 files changed, 37 insertions, 0 deletions
diff --git a/docker/etc/s6/openssh/finish b/docker/etc/s6/openssh/finish new file mode 100755 index 0000000000..06bd986563 --- /dev/null +++ b/docker/etc/s6/openssh/finish @@ -0,0 +1,2 @@ +#!/bin/bash +exit 0 diff --git a/docker/etc/s6/openssh/run b/docker/etc/s6/openssh/run new file mode 100755 index 0000000000..46f422cce6 --- /dev/null +++ b/docker/etc/s6/openssh/run @@ -0,0 +1,6 @@ +#!/bin/bash +[[ -f ./setup ]] && source ./setup + +pushd /root > /dev/null + exec su-exec root /usr/sbin/sshd -E /var/log/sshd.log -D +popd diff --git a/docker/etc/s6/openssh/setup b/docker/etc/s6/openssh/setup new file mode 100755 index 0000000000..b529431a15 --- /dev/null +++ b/docker/etc/s6/openssh/setup @@ -0,0 +1,29 @@ +#!/bin/bash + +if [ ! -d /data/ssh ]; then + mkdir -p /data/ssh +fi + +if [ ! -f /data/ssh/ssh_host_ed25519_key ]; then + echo "Generating /data/ssh/ssh_host_ed25519_key..." + ssh-keygen -t ed25519 -b 4096 -f /data/ssh/ssh_host_ed25519_key -N "" > /dev/null +fi + +if [ ! -f /data/ssh/ssh_host_rsa_key ]; then + echo "Generating /data/ssh/ssh_host_rsa_key..." + ssh-keygen -t rsa -b 2048 -f /data/ssh/ssh_host_rsa_key -N "" > /dev/null +fi + +if [ ! -f /data/ssh/ssh_host_dsa_key ]; then + echo "Generating /data/ssh/ssh_host_dsa_key..." + ssh-keygen -t dsa -f /data/ssh/ssh_host_dsa_key -N "" > /dev/null +fi + +if [ ! -f /data/ssh/ssh_host_ecdsa_key ]; then + echo "Generating /data/ssh/ssh_host_ecdsa_key..." + ssh-keygen -t ecdsa -b 256 -f /data/ssh/ssh_host_ecdsa_key -N "" > /dev/null +fi + +chown root:root /data/ssh/* +chmod 0700 /data/ssh +chmod 0600 /data/ssh/* |