ssh_exchange_identification:读:连接被对等方重置; ubuntu 在 Docker
ssh_exchange_identification: read: Connection reset by peer; ubuntu in Docker
我正在尝试在 Docker 中设置一些 Ubuntu 图像以用作蜜罐。
我遵循了这里的指南:
https://github.com/mrschyte/dockerpot
这是我使用的 Docker 文件的副本:
FROM ubuntu:16.04
RUN apt-get update && apt-get install -y openssh-server
RUN mkdir /var/run/sshd
RUN echo 'root:screencast' | chpasswd
RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
# SSH login fix. Otherwise user is kicked off after login
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
ENV NOTVISIBLE "in users profile"
RUN echo "export VISIBLE=now" >> /etc/profile
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]
运行 docker ps
我可以看到创建了容器:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b7c1962cfc27 def9be976ec5 "/sbin/init" 45 minutes ago Up 19 minutes 22/tcp honeypot-192.168.122.1
但是当我尝试从我的机器连接到它们时,连接被重置并出现错误:ssh_exchange_identification: read: Connection reset by peer
从初始化脚本中删除 /sbin/init
,问题已解决。
不应在 docker 中使用与此相关的内容,因为它可能不会初始化服务。
我正在尝试在 Docker 中设置一些 Ubuntu 图像以用作蜜罐。
我遵循了这里的指南: https://github.com/mrschyte/dockerpot
这是我使用的 Docker 文件的副本:
FROM ubuntu:16.04
RUN apt-get update && apt-get install -y openssh-server
RUN mkdir /var/run/sshd
RUN echo 'root:screencast' | chpasswd
RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
# SSH login fix. Otherwise user is kicked off after login
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
ENV NOTVISIBLE "in users profile"
RUN echo "export VISIBLE=now" >> /etc/profile
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]
运行 docker ps
我可以看到创建了容器:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b7c1962cfc27 def9be976ec5 "/sbin/init" 45 minutes ago Up 19 minutes 22/tcp honeypot-192.168.122.1
但是当我尝试从我的机器连接到它们时,连接被重置并出现错误:ssh_exchange_identification: read: Connection reset by peer
从初始化脚本中删除 /sbin/init
,问题已解决。
不应在 docker 中使用与此相关的内容,因为它可能不会初始化服务。