简体   繁体   English

ssh_exchange_identification:读取:对等方重置连接; Docker中的ubuntu

[英]ssh_exchange_identification: read: Connection reset by peer; ubuntu in Docker

I'm trying to setup some Ubuntu images in Docker, to be used as honeypots. 我正在尝试在Docker中设置一些Ubuntu映像,以用作蜜罐。

I've followed a guide from here: https://github.com/mrschyte/dockerpot 我从这里遵循了一个指南: https : //github.com/mrschyte/dockerpot

This is a copy of the Docker file i use: 这是我使用的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"]

Running docker ps I can see that the contrainers are created: 运行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

but when I try to connect to them from my machine, the connection is reset with the error: ssh_exchange_identification: read: Connection reset by peer 但是当我尝试从我的计算机连接到它们时,连接被重置,并显示以下错误: ssh_exchange_identification: read: Connection reset by peer

Removing /sbin/init from the init script, fixed the issue. 从init脚本中删除/sbin/init ,解决了该问题。

Something about this should not be used in docker as it may not initialize the services. 关于此事,不应在docker中使用,因为它可能无法初始化服务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM