/
최신 리눅스(Fedora33)에 rsa 키 인증이 안되는 문제

최신 리눅스(Fedora33)에 rsa 키 인증이 안되는 문제

PROBLEM DESCRIPTION or QUESTION



Fedora 33에 RSA 키로 접속 시 다음과 같은 메시지가 나오고 접속이 거부됩니다.



Connecting to 192.168.11.228:22...
Connection established.
To escape to local shell, press Ctrl+Alt+].
[14:47:16] Version exchange initiated...
[14:47:16] server: SSH-2.0-OpenSSH_8.4
[14:47:16] client: SSH-2.0-nsssh2_7.0.0006 NetSarang Computer, Inc.
[14:47:16] SSH2 is selected.
[14:47:16] Outgoing packet: 20 (0x14: SSH2_MSG_KEXINIT)
[14:47:16] Incoming packet: 20 (0x14: SSH2_MSG_KEXINIT)
[14:47:16] Algorithm negotiation initiated... (Dialog mode)
[14:47:16] key exchange: curve25519-sha256@libssh.org
[14:47:16] host key: rsa-sha2-256
[14:47:16] outgoing encryption: chacha20-poly1305@openssh.com
[14:47:16] incoming encryption: chacha20-poly1305@openssh.com
[14:47:16] outgoing mac: hmac-sha2-256-etm@openssh.com
[14:47:16] incoming mac: hmac-sha2-256-etm@openssh.com
[14:47:16] outgoing compression: none
[14:47:16] incoming compression: none
[14:47:16] Outgoing packet: 30 (0x1e: SSH2_MSG_KEXDH_INIT)
[14:47:16] Incoming packet: 31 (0x1f: SSH2_MSG_KEXDH_REPLY)
[14:47:16] Host authentication initiated...
[14:47:16] Hostkey fingerprint:
[14:47:16] rsa 3072 8a:c3:90:89:16:7a:43:ad:db:ca:d5:7d:91:c0:7e:c1
[14:47:16] Accepted. Verifying host key...
[14:47:16] Verified.
[14:47:16] Outgoing packet: 21 (0x15: SSH2_MSG_NEWKEYS)
[14:47:16] Incoming packet: 21 (0x15: SSH2_MSG_NEWKEYS)
[14:47:16] Outgoing packet: 5 (0x05: SSH2_MSG_SERVICE_REQUEST)
[14:47:16] Incoming packet: 6 (0x06: SSH2_MSG_SERVICE_ACCEPT)
[14:47:16] User authentication initiated... (Dialog mode)
[14:47:17] Sent user name 'test'.
[14:47:17] Outgoing packet: 50 (0x32: SSH2_MSG_USERAUTH_REQUEST)
[14:47:17] Incoming packet: 51 (0x33: SSH2_MSG_USERAUTH_FAILURE)
[14:47:23] Outgoing packet: 50 (0x32: SSH2_MSG_USERAUTH_REQUEST)
[14:47:23] Sent public key blob, type:ssh-rsa.
[14:47:23] Incoming packet: 51 (0x33: SSH2_MSG_USERAUTH_FAILURE)
[14:47:23] Server rejected the public blob.

RESOLUTION


 해당 SSH 서버가 Xshell이 지원하는 ssh-rsa 키 형식을 받아 들이지 않기 때문입니다. 2021년 01월 29일 이후 배포 중인 Xshell 7 Build 0056는 rsa-sha2-256 및 rsa-sha2-512 알고리즘을 지원하고 있어 해당 서버에 접속이 가능합니다.

OpenSSH는 8.3 배포 당시 향후 ssh-rsa 키 형식을 기본 값에서 배제할 것임을 밝혔습니다.

Fedora 33은 OpenSSH 8.4를 기본으로 제공하고 있고 이 서버에서는 OpenSSH의 예고처럼 ssh-rsa 형식이 기본 값에서 빠져 있습니다.

해결책

다음 중 어느 하나를 사용합니다.

  • Xshell 7 Build 0056(2021-01-29 배포) 이상의 패키지를 사용합니다.
  • Xshell에서 ED2519 또는 ECDSA 형식의 키를 사용합니다.
  • Fedora 33에서 암호 정책을 바꾼 후 SSH 서버를 다시 시작합니다.

    # update-crypto-policies --show; update-crypto-policies --set LEGACY; systemctl restart sshd
  • SSH 서버 설정 파일에 ssh-rsa 형식을 추가합니다.(보안상의 이유로 제외한 것이므로 권장하지 않습니다.)
    'PubkeyAcceptedKeyTypes +ssh-rsa'를 Include 항목 앞에 추가합니다.

    # vi /etc/ssh/sshd_config
    ...
    PubkeyAcceptedKeyTypes +ssh-rsa
    ...
    # To modify the system-wide sshd configuration, create a *.conf file under
    # /etc/ssh/sshd_config.d/ which will be automatically included below
    Include /etc/ssh/sshd_config.d/*.conf
    ...
    # systemctl restart sshd

Related content

Amazon Linux 2023 접속 문제 - RSA 키
Amazon Linux 2023 접속 문제 - RSA 키
Read with this
다른ssh 클라이언트는 접속이 되는데 xshell만 접속이 안됩니다. [1]
다른ssh 클라이언트는 접속이 되는데 xshell만 접속이 안됩니다. [1]
More like this
Why does my connection to an Amazon Linux 2023 instance fail when using an RSA key?
Why does my connection to an Amazon Linux 2023 instance fail when using an RSA key?
Read with this
ubuntu 12.04 연결시 접속은되는데 터미널이 안열립니다. [1]
ubuntu 12.04 연결시 접속은되는데 터미널이 안열립니다. [1]
More like this
수동으로 인증한 제품의 인증 반환 방법
수동으로 인증한 제품의 인증 반환 방법
Read with this
xterm이 안떠용~ [1]
xterm이 안떠용~ [1]
More like this