From 9af04b6208754fb1e2db0a1c2adeb6e491e4745c Mon Sep 17 00:00:00 2001 From: Martyn Ranyard Date: Sat, 11 Feb 2023 14:34:29 +0100 Subject: [PATCH] Move keygen so we can autossh and not care if the pod dies Signed-off-by: Martyn Ranyard --- docker/ssh/Dockerfile | 3 ++- docker/ssh/buildandpush.sh | 3 +++ ssh/deploy.yaml | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) create mode 100755 docker/ssh/buildandpush.sh diff --git a/docker/ssh/Dockerfile b/docker/ssh/Dockerfile index 3e0ab71..a1d12f6 100644 --- a/docker/ssh/Dockerfile +++ b/docker/ssh/Dockerfile @@ -1,6 +1,7 @@ FROM library/alpine RUN apk add --no-cache openssh && \ - sed -i /etc/ssh/sshd_config -e s/'#Port.*'/'Port 2222'/ -e s/'AllowTcpForwarding.*'/'AllowTcpForwarding yes'/ + sed -i /etc/ssh/sshd_config -e s/'#Port.*'/'Port 2222'/ -e s/'AllowTcpForwarding.*'/'AllowTcpForwarding yes'/ && \ + ssh-keygen -A RUN adduser -D -s /bin/ash beagle ADD beagle.key /home/beagle/.ssh/authorized_keys RUN passwd -u beagle && \ diff --git a/docker/ssh/buildandpush.sh b/docker/ssh/buildandpush.sh new file mode 100755 index 0000000..5b3bda5 --- /dev/null +++ b/docker/ssh/buildandpush.sh @@ -0,0 +1,3 @@ +#!/bin/bash +docker build . -t imartyn/ssh +docker push imartyn/ssh diff --git a/ssh/deploy.yaml b/ssh/deploy.yaml index 3474763..78213f8 100644 --- a/ssh/deploy.yaml +++ b/ssh/deploy.yaml @@ -23,7 +23,7 @@ spec: command: - sh - -c - - ssh-keygen -A; /usr/sbin/sshd -D -p 22 + - /usr/sbin/sshd -D -p 22 ports: - containerPort: 22 name: ssh