在容器的Azure App Service上启用SSH会将垃圾转储到日志流中,我在做错什么吗?

时间:2019-05-17 18:21:26

标签: azure docker ssh containers azure-web-sites

遵循文档以使SSH控制台能够在具有Linux容器的Azure门户中运行,导致该容器向日志流中转储大量垃圾,最终重新启动Web应用。

https://docs.microsoft.com/en-us/azure/app-service/containers/configure-custom-container#enable-ssh

我尝试了几个不同的sshd_config选项,但似乎没有任何帮助。该文档说要使用此配置文件

Port            2222
ListenAddress       0.0.0.0
LoginGraceTime      180
X11Forwarding       yes
Ciphers aes128-cbc,3des-cbc,aes256-cbc,aes128-ctr,aes192-ctr,aes256-ctr
MACs hmac-sha1,hmac-sha1-96
StrictModes         yes
SyslogFacility      DAEMON
PasswordAuthentication  yes
PermitEmptyPasswords    no
PermitRootLogin     yes
Subsystem sftp internal-sftp

我正在使用

生成密钥
ssh-keygen -A 

dockerfile

FROM centos

# Timezone 
ENV TZ America/New_York

# openssh-server, nginx and supervisor
RUN yum -y update && \
    yum -y install epel-release \
    http://rpms.remirepo.net/enterprise/remi-release-7.rpm \
    openssh-server && \
    yum-config-manager --enable remi-php72 && \
    yum install -y nginx \
    supervisor && \
    echo "root:Docker!" | chpasswd  && \
    ssh-keygen -A 

# ssh configuration
COPY sshd_config /etc/ssh/

# Setup Supervisor 
COPY nginx.ini ssh.ini /etc/supervisord.d/

EXPOSE 2222 80

ENTRYPOINT ["supervisord", "-n", "-c", "/etc/supervisord.conf"]

nginx.ini

[program:nginx]
command=/usr/sbin/nginx -g 'daemon off;'
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

ssh.ini

[program:sshd]
command=/usr/sbin/sshd -D
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

只需期望启用此功能并在Azure门户网站中使用SSH选项,而不必关闭容器。进行这项工作的任何想法

这是日志流中引发的示例

2019-05-17T15:34:21  Welcome, you are now connected to log-streaming service.DEBUG: Outgoing: Writing CHANNEL_DATA (0)DEBUG: Parser: IN_PACKETDEBUG: Parser: DecryptingDEBUG: Parser: pktLen:28,padLen:17,remainLen:16DEBUG: Parser: IN_PACKETDATADEBUG: Parser: DecryptingDEBUG: Parser: HMAC size:20DEBUG: Parser: IN_PACKETDATAVERIFYDEBUG: Parser: Verifying MACDEBUG: Parser: IN_PACKETDATAVERIFY (Valid HMAC)DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_DATA (0)DEBUG: Parser: IN_PACKETBEFORE (expecting 16)DEBUG: Outgoing: Writing CHANNEL_DATA (0)DEBUG: Outgoing: Writing CHANNEL_DATA (0)DEBUG: Parser: IN_PACKETDEBUG: Parser: DecryptingDEBUG: Parser: pktLen:28,padLen:17,remainLen:16DEBUG: Parser: IN_PACKETDATADEBUG: Parser: DecryptingDEBUG: Parser: HMAC size:20DEBUG: Parser: IN_PACKETDATAVERIFYDEBUG: Parser: Verifying MACDEBUG: Parser: IN_PACKETDATAVERIFY (Valid HMAC)DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_DATA (0)DEBUG: Parser: IN_PACKETBEFORE (expecting 16)DEBUG: Parser: IN_PACKETDEBUG: Parser: DecryptingDEBUG: Parser: pktLen:28,padLen:16,remainLen:16DEBUG: Parser: IN_PACKETDATADEBUG: Parser: DecryptingDEBUG: Parser: HMAC size:20DEBUG: Parser: IN_PACKETDATAVERIFYDEBUG: Parser: Verifying MACDEBUG: Parser: IN_PACKETDATAVERIFY (Valid HMAC)DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_DATA (0)DEBUG: Parser: IN_PACKETBEFORE (expecting 16)DEBUG: Parser: IN_PACKETDEBUG: Parser: DecryptingDEBUG: Parser: pktLen:60,padLen:10,remainLen:48DEBUG: Parser: IN_PACKETDATADEBUG: Parser: DecryptingDEBUG: Parser: HMAC size:20DEBUG: Parser: IN_PACKETDATAVERIFYDEBUG: Parser: Verifying MACDEBUG: Parser: IN_PACKETDATAVERIFY (Valid HMAC)DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_DATA (0)DEBUG: Parser: IN_PACKETBEFORE (expecting 16)DEBUG: Outgoing: Writing CHANNEL_DATA (0)DEBUG: Parser: IN_PACKETDEBUG: Parser: DecryptingDEBUG: Parser: pktLen:28,padLen:17,remainLen:16DEBUG: Parser: IN_PACKETDATADEBUG: Parser: DecryptingDEBUG: Parser: HMAC size:20DEBUG: Parser: IN_PACKETDATAVERIFYDEBUG: Parser: Verifying MACDEBUG: Parser: IN_PACKETDATAVERIFY (Valid HMAC)DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_DATA (0)DEBUG: Parser: IN_PACKETBEFORE (expecting 16)DEBUG: Outgoing: Writing CHANNEL_DATA (0)DEBUG: Parser: IN_PACKETDEBUG: Parser: DecryptingDEBUG: Parser: pktLen:28,padLen:17,remainLen:16DEBUG: Parser: IN_PACKETDATADEBUG: Parser: DecryptingDEBUG: Parser: HMAC size:20DEBUG: Parser: IN_PACKETDATAVERIFYDEBUG: Parser: Verifying MACDEBUG: Parser: IN_PACKETDATAVERIFY (Valid HMAC)DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_DATA (0)DEBUG: Parser: IN_PACKETBEFORE (expecting 16)DEBUG: Outgoing: Writing CHANNEL_DATA (0)DEBUG: Parser: IN_PACKETDEBUG: Parser: DecryptingDEBUG: Parser: pktLen:28,padLen:17,remainLen:16DEBUG: Parser: IN_PACKETDATADEBUG: Parser: DecryptingDEBUG: Parser: HMAC size:20DEBUG: Parser: IN_PACKETDATAVERIFYDEBUG: Parser: Verifying MACDEBUG: Parser: IN_PACKETDATAVERIFY (Valid HMAC)DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_DATA (0)DEBUG: Parser: IN_PACKETBEFORE (expecting 16)DEBUG: Outgoing: Writing CHANNEL_DATA (0)DEBUG: Parser: IN_PACKETDEBUG: Parser: DecryptingDEBUG: Parser: pktLen:28,padLen:17,remainLen:16DEBUG: Parser: IN_PACKETDATADEBUG: Parser: DecryptingDEBUG: Parser: HMAC size:20DEBUG: Parser: IN_PACKETDATAVERIFYDEBUG: Parser: Verifying MACDEBUG: Parser: IN_PACKETDATAVERIFY (Valid HMAC)DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_DATA (0)DEBUG: Parser: IN_PACKETBEFORE (expecting 16)DEBUG: Outgoing: Writing CHANNEL_DATA (0)DEBUG: Parser: IN_PACKETDEBUG: Parser: DecryptingDEBUG: Parser: pktLen:28,padLen:17,remainLen:16DEBUG: Parser: IN_PACKETDATADEBUG: Parser: DecryptingDEBUG: Parser: HMAC size:20DEBUG: Parser: IN_PACKETDATAVERIFYDEBUG: Parser: Verifying MACDEBUG: Parser: IN_PACKETDATAVERIFY (Valid HMAC)DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_DATA (0)DEBUG: Parser: IN_PACKETBEFORE (expecting 16)DEBUG: Outgoing: Writing CHANNEL_DATA (0)DEBUG: Parser: IN_PACKETDEBUG: Parser: DecryptingDEBUG: Parser: pktLen:28,padLen:17,remainLen:16DEBUG: Parser: IN_PACKETDATADEBUG: Parser: DecryptingDEBUG: Parser: HMAC size:20DEBUG: Parser: IN_PACKETDATAVERIFYDEBUG: Parser: Verifying MACDEBUG: Parser: IN_PACKETDATAVERIFY (Valid HMAC)DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_DATA (0)DEBUG: Parser: IN_PACKETBEFORE (expecting 16)DEBUG: Outgoing: Writing CHANNEL_DATA (0)DEBUG: Parser: IN_PACKETDEBUG: Parser: DecryptingDEBUG: Parser: pktLen:28,padLen:17,remainLen:16DEBUG: Parser: IN_PACKETDATADEBUG: Parser: DecryptingDEBUG: Parser: HMAC size:20DEBUG: Parser: IN_PACKETDATAVERIFYDEBUG: Parser: Verifying MACDEBUG: Parser: IN_PACKETDATAVERIFY (Valid HMAC)DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_DATA (0)DEBUG: Parser: IN_PACKETBEFORE (expecting 16)DEBUG: Outgoing: Writing CHANNEL_DATA (0)DEBUG: Parser: IN_PACKETDEBUG: Parser: DecryptingDEBUG: Parser: pktLen:44,padLen:7,remainLen:32DEBUG: Parser: IN_PACKETDATADEBUG: Parser: DecryptingDEBUG: Parser: HMAC size:20DEBUG: Parser: IN_PACKETDATAVERIFYDEBUG: Parser: Verifying MACDEBUG: Parser: IN_PACKETDATAVERIFY (Valid HMAC)DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_DATA (0)DEBUG: Parser: IN_PACKETBEFORE (expecting 16)DEBUG: Outgoing: Writing CHANNEL_DATA (0)DEBUG: Parser: IN_PACKETDEBUG: Parser: DecryptingDEBUG: Parser: pktLen:28,padLen:17,remainLen:16DEBUG: Parser: IN_PACKETDATADEBUG: Parser: DecryptingDEBUG: Parser: HMAC size:20DEBUG: Parser: IN_PACKETDATAVERIFYDEBUG: Parser: Verifying MACDEBUG: Parser: IN_PACKETDATAVERIFY (Valid HMAC)DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_DATA (0)DEBUG: Parser: IN_PACKETBEFORE (expecting 16)DEBUG: Outgoing: Writing CHANNEL_DATA (0)DEBUG: Parser: IN_PACKETDEBUG: Parser: DecryptingDEBUG: Parser: pktLen:28,padLen:17,remainLen:16DEBUG: Parser: IN_PACKETDATADEBUG: Parser: DecryptingDEBUG: Parser: HMAC size:20DEBUG: Parser: IN_PACKETDATAVERIFYDEBUG: Parser: Verifying MACDEBUG: Parser: IN_PACKETDATAVERIFY (Valid HMAC)DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_DATA (0)DEBUG: Parser: IN_PACKETBEFORE (expecting 16)DEBUG: Outgoing: Writing CHANNEL_DATA (0)DEBUG: Parser: IN_PACKETDEBUG: Parser: DecryptingDEBUG: Parser: pktLen:28,padLen:16,remainLen:16DEBUG: Parser: IN_PACKETDATADEBUG: Parser: DecryptingDEBUG: Parser: HMAC size:20DEBUG: Parser: IN_PACKETDATAVERIFYDEBUG: Parser: Verifying MACDEBUG: Parser: IN_PACKETDATAVERIFY (Valid HMAC)DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_DATA (0)DEBUG: Parser: IN_PACKETBEFORE (expecting 16)DEBUG: Parser: IN_PACKETDEBUG: Parser: DecryptingDEBUG: Parser: pktLen:2972,padLen:11,remainLen:2960DEBUG: Parser: IN_PACKETDATADEBUG: Parser: DecryptingDEBUG: Parser: HMAC size:20DEBUG: Parser: IN_PACKETDATAVERIFYDEBUG: Parser: Verifying MACDEBUG: Parser: IN_PACKETDATAVERIFY (Valid HMAC)DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_DATA (0)DEBUG: Parser: IN_PACKETBEFORE (expecting 16)

1 个答案:

答案 0 :(得分:0)

为此最终用MS打开了一个票证,显然日志流在启用SSH的情况下做到了。他们说,这是捕获标准/输出日志以在Azure门户中显示它们的方式。我们结束了对CentOS,Debian和Alpine的尝试,它们都将垃圾转储到日志流中。可通过kudu / api获取的docker-logs中没有捕获垃圾,因此至少日志保持清洁。

我最终无法使用我们制作的PoC容器重新创建重新启动,因此我以无问题的方式关闭了票证。