Включение SSH в службе приложений Azure для контейнеров сбрасывает мусор в поток журнала, я что-то не так делаю? - PullRequest
0 голосов
/ 17 мая 2019

Следуя документации, позволяющей консоли SSH работать на портале Azure с контейнером Linux, контейнер отбрасывает большое количество мусора в поток журнала, в конечном итоге перезапуская веб-приложение.

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

Просто ожидайте, что включите это и включите опцию SSH в портале Azure, не останавливая контейнер. Любые идеи для этой работы

Это пример того, что выбрасывается в поток журнала

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 голосов
/ 24 мая 2019

Закончилось открытие заявки с MS для этого, по-видимому, поток журнала делает это с включенным SSH.Они сказали, что именно так они записывают логи std / out для отображения на портале Azure.Мы прекратили попытки CentOS, Debian и Alpine, они все выбросили мусор в поток журналов.Мусор не фиксируется в журналах докеров, доступных через kudu / api, поэтому, по крайней мере, журналы хранятся в чистоте.

Я не смог воссоздать перезапуски с созданными нами контейнерами PoC, поэтому язакрыл тикет как не проблемный.

...