Move keygen so we can autossh and not care if the pod dies

Signed-off-by: Martyn Ranyard <m@rtyn.berlin>
This commit is contained in:
Martyn 2023-02-11 14:34:29 +01:00
parent a8bbb48877
commit 9af04b6208
3 changed files with 6 additions and 2 deletions

View File

@ -1,6 +1,7 @@
FROM library/alpine FROM library/alpine
RUN apk add --no-cache openssh && \ 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 RUN adduser -D -s /bin/ash beagle
ADD beagle.key /home/beagle/.ssh/authorized_keys ADD beagle.key /home/beagle/.ssh/authorized_keys
RUN passwd -u beagle && \ RUN passwd -u beagle && \

3
docker/ssh/buildandpush.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
docker build . -t imartyn/ssh
docker push imartyn/ssh

View File

@ -23,7 +23,7 @@ spec:
command: command:
- sh - sh
- -c - -c
- ssh-keygen -A; /usr/sbin/sshd -D -p 22 - /usr/sbin/sshd -D -p 22
ports: ports:
- containerPort: 22 - containerPort: 22
name: ssh name: ssh