Сбой публикации ключа c s sh в контейнере Debian для пользователя, не являющегося root - PullRequest
0 голосов
/ 07 апреля 2020

У меня есть контейнер Debian linux 10 (хост docker - oracle linux 7), который настроен для проверки подлинности ключа publi c. Я не могу понять, почему это не работает для не root пользователей (ie, ab c). Я получил это работает для root пользователя. Так расстраивает, поскольку я уже пробовал так много способов от поиска в Google.

Здесь указаны текущие настройки и журнал трассировки secureCRT. Опять же, пользователь ab c находится внутри контейнера. Я также получил проверку подлинности ключа publi c, работающую не для пользователя root 123 на самом хосте docker, наряду с root. Итак, не уверен, что является причиной проблемы. Почему-то файл /home/abc/.ssh/authorized_keys не читается правильно.

Я также получил правильные разрешения .s sh и .ssh / authorized_keys для chmod 700 (я тоже пробовал 744), также .s sh и .ssh / authorized_keys принадлежит ab c пользователь. Я также очень тщательно проверил ключи в файлах author_key, ключ publi c (открывался в блокноте, копировался, затем вставлялся в файл авторизованный контейнерный ключ). Вы можете помочь? У меня закончились идеи.

  • / etc / ssh / sshd_config
   PasswordAuthentication no 
   PubkeyAuthentication yes
   ChallengeResponseAuthentication no
   PermitRootLogin yes
   UsePAM no
   AuthorizedKeysFile  .ssh/authorized_keys /home/abc/.ssh/authorized_keys
  • журнал трассировки для пользователя ab c (не работает). Отображается только разница журнала (от трассы root)
      [LOCAL] : SENT : USERAUTH_REQUEST [publickey (ssh-rsa) - unsigned,fingerprint (SHA-2 hash): ...] 
    [LOCAL] : SENT : USERAUTH_REQUEST [publickey (ssh-rsa) - unsigned,fingerprint (SHA-1 hash): ...] 
    [LOCAL] : SENT : USERAUTH_REQUEST [publickey (ssh-rsa) - unsigned,fingerprint (MD5 hash): ...] 
    [LOCAL] : RECV : USERAUTH_FAILURE, continuations [publickey] 
    [LOCAL] : SENT : USERAUTH_REQUEST [publickey (ssh-rsa) - unsigned,agent,fingerprint (SHA-2 hash): ...] 
    [LOCAL] : SENT : USERAUTH_REQUEST [publickey (ssh-rsa) - unsigned,agent,fingerprint (SHA-1 hash): ...] 
    [LOCAL] : SENT : USERAUTH_REQUEST [publickey (ssh-rsa) - unsigned,agent,fingerprint (MD5 hash): ] 
    [LOCAL] : RECV : USERAUTH_FAILURE, continuations [publickey] 
    [LOCAL] : SEND: Disconnect packet: The user canceled authentication.  
    [LOCAL] : Changing state from STATE_CONNECTION to STATE_SEND_DISCONNECT 
    [LOCAL] : Changing state from STATE_SEND_DISCONNECT to STATE_CLOSED 
    [LOCAL] : Connected for 3 seconds, 2698 bytes sent, 2233 bytes received
  • журнал трассировки для пользователя root (работает). Только разница журнала (от трассировки пользователя ab c) отображается
    [LOCAL] : SENT : USERAUTH_REQUEST [publickey (ssh-rsa) - unsigned,fingerprint (SHA-2 hash): ...] 
    [LOCAL] : SENT : USERAUTH_REQUEST [publickey (ssh-rsa) - unsigned,fingerprint (SHA-1 hash): ...] 
    [LOCAL] : SENT : USERAUTH_REQUEST [publickey (ssh-rsa) - unsigned,fingerprint (MD5 hash): ...] 
    [LOCAL] : SENT : USERAUTH_REQUEST [publickey (ssh-rsa) - signed,May 2000 Standard] 
    [LOCAL] : RECV : AUTH_SUCCESS 
    [LOCAL] : SEND[0]: SSH_MSG_CHANNEL_OPEN('session')
    [FROM REMOTE] : /root/.ssh/authorized_keys:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding 
    [FROM REMOTE] : /root/.ssh/authorized_keys:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding 
    [LOCAL] : SEND[0]: Pty Request (rows: 68, cols: 189)
    [LOCAL] : RECV[0]: pty request succeeded
    [LOCAL] : SEND[0]: shell request
    [LOCAL] : RECV[0]: shell request succeeded
  • остальная часть журнала трассировки, которая одинакова для root и ab c пользователь. это первая часть журнала трассировки, за которой следует приведенная выше запись root / пользователя ab c.
    [LOCAL] : SSH2Core version 8.1.0.1362 
    [LOCAL] : Connecting to xyz:220 ... 
    [LOCAL] : Resolved hostname to x.x.x.x:220 
    SecureCRT - Version 8.1.2 (x64 build 1362)
    [LOCAL] : Changing state from STATE_NOT_CONNECTED to STATE_EXPECT_KEX_INIT 
    [LOCAL] : Using protocol SSH2 
    [LOCAL] : RECV : Remote Identifier = 'SSH-2.0-OpenSSH_7.9p1 Debian-10+deb10u2' 
    [LOCAL] : CAP  : Remote can re-key 
    [LOCAL] : CAP  : Remote sends language in password change requests 
    [LOCAL] : CAP  : Remote sends algorithm name in PK_OK packets 
    [LOCAL] : CAP  : Remote sends algorithm name in public key packets 
    [LOCAL] : CAP  : Remote sends algorithm name in signatures 
    [LOCAL] : CAP  : Remote sends error text in open failure packets 
    [LOCAL] : CAP  : Remote sends name in service accept packets 
    [LOCAL] : CAP  : Remote includes port number in x11 open packets 
    [LOCAL] : CAP  : Remote uses 160 bit keys for SHA1 MAC 
    [LOCAL] : CAP  : Remote supports new diffie-hellman group exchange messages 
    [LOCAL] : CAP  : Remote correctly handles unknown SFTP extensions 
    [LOCAL] : CAP  : Remote correctly encodes OID for gssapi 
    [LOCAL] : CAP  : Remote correctly uses connected addresses in forwarded-tcpip requests 
    [LOCAL] : CAP  : Remote can do SFTP version 4 
    [LOCAL] : CAP  : Remote uses SHA1 hash in RSA signatures for x.509v3 
    [LOCAL] : CAP  : Remote x.509v3 uses ASN.1 encoding for DSA signatures 
    [LOCAL] : CAP  : Remote correctly handles zlib@openssh.com 
    [LOCAL] : SSPI : Requesting full delegation 
    [LOCAL] : SSPI : [Kerberos] SPN : host@xyz 
    [LOCAL] : SSPI : [Kerberos] InitializeSecurityContext() failed. 
    [LOCAL] : SSPI : [Kerberos] The specified target is unknown or unreachable  
    [LOCAL] : SSPI : [Kerberos] Disabling gss mechanism 
    [LOCAL] : GSS  : Requesting full delegation 
    [LOCAL] : GSS  : [Kerberos] SPN : host@xyz 
    [LOCAL] : GSS  : [Kerberos] InitializeSecurityContext() failed. 
    [LOCAL] : GSS  : [Kerberos] Could not load library 'gssapi64.dll': The specified module could not be found.   
    [LOCAL] : GSS  : [Kerberos] Disabling gss mechanism 
    [LOCAL] : GSS  : [Kerberos] Disabling gss mechanism 
    [LOCAL] : The following key exchange method has been filtered from the key exchange method list because it is not supported: gss-group1-sha1-toWM5Slw5Ew8Mqkay+al2g==  
    [LOCAL] : SSPI : Requesting full delegation 
    [LOCAL] : SSPI : [Kerberos (Group Exchange)] SPN : host@xyz 
    [LOCAL] : SSPI : [Kerberos (Group Exchange)] InitializeSecurityContext() failed. 
    [LOCAL] : SSPI : [Kerberos (Group Exchange)] The specified target is unknown or unreachable  
    [LOCAL] : SSPI : [Kerberos (Group Exchange)] Disabling gss mechanism 
    [LOCAL] : GSS  : Requesting full delegation 
    [LOCAL] : GSS  : [Kerberos (Group Exchange)] SPN : host@xyz 
    [LOCAL] : GSS  : [Kerberos (Group Exchange)] InitializeSecurityContext() failed. 
    [LOCAL] : GSS  : [Kerberos (Group Exchange)] Could not load library 'gssapi64.dll': The specified module could not be found.   
    [LOCAL] : GSS  : [Kerberos (Group Exchange)] Disabling gss mechanism 
    [LOCAL] : GSS  : [Kerberos (Group Exchange)] Disabling gss mechanism 
    [LOCAL] : The following key exchange method has been filtered from the key exchange method list because it is not supported: gss-gex-sha1-toWM5Slw5Ew8Mqkay+al2g==  
    [LOCAL] : SEND : KEXINIT 
    [LOCAL] : RECV : Read kexinit 
    [LOCAL] : Available Remote Kex Methods = curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1 
    [LOCAL] : Selected Kex Method = ecdh-sha2-nistp521 
    [LOCAL] : Available Remote Host Key Algos = rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp256,ssh-ed25519 
    [LOCAL] : Selected Host Key Algo = ssh-rsa 
    [LOCAL] : Available Remote Send Ciphers = chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com 
    [LOCAL] : Selected Send Cipher = aes256-ctr 
    [LOCAL] : Available Remote Recv Ciphers = chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com 
    [LOCAL] : Selected Recv Cipher = aes256-ctr 
    [LOCAL] : Available Remote Send Macs = umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1 
    [LOCAL] : Selected Send Mac = hmac-sha2-512 
    [LOCAL] : Available Remote Recv Macs = umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1 
    [LOCAL] : Selected Recv Mac = hmac-sha2-512 
    [LOCAL] : Available Remote Compressors = none,zlib@openssh.com 
    [LOCAL] : Selected Compressor = none 
    [LOCAL] : Available Remote Decompressors = none,zlib@openssh.com 
    [LOCAL] : Selected Decompressor = none 
    [LOCAL] : Changing state from STATE_EXPECT_KEX_INIT to STATE_KEY_EXCHANGE 
    [LOCAL] : SEND : SSH_MSG_KEX_ECDH_INIT 
    [LOCAL] : RECV : SSH_MSG_KEX_ECDH_REPLY 
    [LOCAL] : Changing state from STATE_KEY_EXCHANGE to STATE_READY_FOR_NEW_KEYS 
    [LOCAL] : RECV: Remote Hostkey (SHA-2 hash): ... 
    [LOCAL] : RECV: Remote Hostkey (SHA-1 hash): ...
    [LOCAL] : RECV: Remote Hostkey (MD5 hash): ...
    [LOCAL] : SEND : NEWKEYS 
    [LOCAL] : Changing state from STATE_READY_FOR_NEW_KEYS to STATE_EXPECT_NEWKEYS 
    [LOCAL] : RECV : NEWKEYS 
    [LOCAL] : Changing state from STATE_EXPECT_NEWKEYS to STATE_CONNECTION 
    [LOCAL] : SEND: SERVICE_REQUEST[ssh-userauth] 
    [LOCAL] : RECV: SERVICE_ACCEPT[ssh-userauth] -- OK 
    [LOCAL] : SENT : USERAUTH_REQUEST [none] 
    [LOCAL] : RECV : USERAUTH_FAILURE, continuations [publickey] 
    [LOCAL] : SENT : USERAUTH_REQUEST [publickey (ssh-rsa) - unsigned,fingerprint (SHA-2 hash): ...] 
    [LOCAL] : SENT : USERAUTH_REQUEST [publickey (ssh-rsa) - unsigned,fingerprint (SHA-1 hash): ...] 
    [LOCAL] : SENT : USERAUTH_REQUEST [publickey (ssh-rsa) - unsigned,fingerprint (MD5 hash): ...] 
    [LOCAL] : RECV : USERAUTH_FAILURE, continuations [publickey] 
    [LOCAL] : SENT : USERAUTH_REQUEST [publickey (ssh-rsa) - unsigned,agent,fingerprint (SHA-2 hash): ...] 
    [LOCAL] : SENT : USERAUTH_REQUEST [publickey (ssh-rsa) - unsigned,agent,fingerprint (SHA-1 hash): ...] 
    [LOCAL] : SENT : USERAUTH_REQUEST [publickey (ssh-rsa) - unsigned,agent,fingerprint (MD5 hash): ...] 
    [LOCAL] : RECV : USERAUTH_FAILURE, continuations [publickey] 
    [LOCAL] : SEND: Disconnect packet: The user canceled authentication.  
    [LOCAL] : Changing state from STATE_CONNECTION to STATE_SEND_DISCONNECT 
    [LOCAL] : Changing state from STATE_SEND_DISCONNECT to STATE_CLOSED 
    [LOCAL] : Connected for 3 seconds, 2698 bytes sent, 2233 bytes received

    [LOCAL] : Stream has closed [CLOSE_TYPE_NO_AUTO_RECONNECT] : The user canceled authentication. 

1 Ответ

0 голосов
/ 08 апреля 2020

Угадай, что я починил случайно!

Так что я был в отчаянии, в значительной степени измотанный, пытаясь все варианты, но все еще не получил работу. Поэтому я отказался вчера вечером и вернулся к аутентификации по паролю для пользователя ab c, используя следующую настройку в sshd_config.

Match User ab c

PasswordAuthentication yes

PubkeyAuthentication no

Затем голос сказал мне попробовать отключить (раскомментировать) эти настройки, и это просто сработало! Самая странная и самая болезненная проблема, которая у меня когда-либо была, но теперь я так счастлив!

Как вы думаете, это ошибка Debian 10 или ошибка secureCRT 8.1.2?

...