collection.dockerfile/rocky/sshd/Dockerfile

18 lines
799 B
Docker
Raw Permalink Normal View History

2024-10-24 23:02:19 +08:00
FROM rockylinux/rockylinux
ENV container docker
RUN dnf -y install openssh-server openssh-clients
RUN echo root:kit+instigates+polynomials | chpasswd
RUN ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa
RUN ssh-keygen -f /etc/ssh/ssh_host_ecdsa_key -N '' -t ecdsa
RUN ssh-keygen -f /etc/ssh/ssh_host_ed25519_key -N '' -t ed25519
RUN sed -i -e '/UseDNS/a UseDNS no' /etc/ssh/sshd_config
RUN echo "TrustedUserCAKeys /etc/ssh/zoo_ssh_ca.pub" >> /etc/ssh/sshd_config
RUN echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINvRHDhxwI9MMzSFhFKs3UDFVV8Y6oVSXX6CY+rpiKRj" > /etc/ssh/zoo_ssh_ca.pub
RUN echo "GatewayPorts yes" >> /etc/ssh/sshd_config
RUN echo "AllowTcpForwarding yes" >> /etc/ssh/sshd_config
RUN echo PS1=\"[rocky] $ \" >> ~/.bashrc
RUN rm -f /run/nologin
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]