1
0
Fork 0

Update docker conf

This commit is contained in:
Florian RICHER 2023-05-02 14:35:12 +02:00
parent c0d9f69ee7
commit a4b92895b2
No known key found for this signature in database
GPG key ID: 6BF27BF8A1E71623
2 changed files with 9 additions and 1 deletions

View file

@ -3,5 +3,13 @@ FROM fedora:38
RUN dnf install openssh-server -y
RUN ssh-keygen -A -v
RUN sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config
RUN sed -i 's/#PermitEmptyPasswords no/PermitEmptyPasswords no/' /etc/ssh/sshd_config
RUN sed -i 's/#PubkeyAuthentication yes/PubkeyAuthentication yes/' /etc/ssh/sshd_config
RUN sed -i 's/#PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN sed -i 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' /etc/pam.d/sshd
RUN echo 'root:root' | chpasswd
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D", "-o", "ListenAddress=0.0.0.0"]

View file

@ -1,3 +1,3 @@
#!/bin/sh
docker build -t ansible_test:latest docker/
docker run --rm -d --name ansible_test --privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:rw --volume="$HOME/.ssh/id_rsa.pub:/root/.ssh/authorized_keys" -p 1022:22 --cgroupns=host ansible_test:latest
docker run --rm -d --name ansible_test --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:rw -v $HOME/.ssh/id_rsa.pub:/root/.ssh/authorized_keys:ro -p 1022:22 --cgroupns=host ansible_test:latest