programing

일치하는 호스트 키 유형을 찾을 수 없습니다.그들의 제안: ssh-rsa.

mailnote 2023. 6. 30. 22:31
반응형

일치하는 호스트 키 유형을 찾을 수 없습니다.그들의 제안: ssh-rsa.

사할때다오발생니다합류가음용다▁▁when니를 사용하면 다음과 같은 오류가 합니다.git:

$ git pull
Unable to negotiate with 172.16.42.42 port 22: no matching host key type found. Their offer: ssh-rsa
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

이 오류를 해결하려면 어떻게 해야 합니까?

가지 키가 (SSH는 RSA 키입니다).ssh-rsa) 할 수 kind는 서명을 지원합니다. 유형은 다음과 같습니다.ssh-rsa함께 , 유형 SHA-1은 RSA입니다.rsa-sha2-256 및 RSA) » SHA-256 »rsa-sha2-512SHA-512를 사용하는 RSA입니다.

Azure DevOps의 경우 SHA-1을 사용하는 RSA 유형만 지원하며 SHA-1은 매우 취약한 것으로 간주됩니다.즉, SSH를 통해 보안으로 연결할 수 있는 방법이 없으므로 이 문제를 해결하기 전까지는 HTTPS 또는 다른 호스팅 서비스를 사용하는 것이 좋습니다.GitHub, GitLab 및 Bitbucket은 모두 안전한 인증 방법을 지원합니다.

에는 "Azure DevOps", "SSH"에 할 수 .~/.ssh/config를 해결하기 파일:

Host ssh.dev.azure.com
    User git
    PubkeyAcceptedAlgorithms +ssh-rsa
    HostkeyAlgorithms +ssh-rsa

그러나 이 문제는 해결 방법이며 안전하지 않은 것으로 알려져 있으므로 이 문제에 대해 Azure DevOps에 문의하여 문제가 발생할 때까지 HTTPS로 전환하거나 다른 곳으로 이동해야 합니다.

가 Open 를 합니다.SSH가 오류를 보고합니다.no matching host key type found. Their offer: ssh-rsa가 연결중서인증제경공우에서 인증을 ssh-rsa( RSA/SHA1).

Devops는 Azure Devops(TFS)를 통한 합니다.ssh-rsabk2204의 답변에서 언급한 바와 같이, 이 알고리즘은 암호학적으로 안전한 것으로 간주되지 않습니다.

취약한 것으로 간주되므로 OpenSSH는 다음을 사용하지 않는 것이 좋습니다.SHA-18.22020-02-14에서.

이제 [1] USD50K 미만으로 SHA-1 해시 알고리즘에 대해 선택 접두사 공격을 수행할 수 있습니다.이러한 이유로, 우리는 가까운 미래의 릴리스에서 기본적으로 SHA-1에 의존하는 "ssh-rsa" 공개 키 서명 알고리즘을 비활성화할 것입니다.

Azure Devops Services는 이후 다음을 허용하는 패치를 발표했습니다.SHA-2

2021년 5월 5일, Azure DevOps 문서는 다음을 언급하기 위해 업데이트되었습니다.RSA 3072.

Q: 이것이 사실입니까?

¯\_(ツ)_/¯

Q: 지원되는 알고리즘은 무엇입니까?

아무 데도 말하지 않습니다. 오직 아마오 직직.ssh-rsa.

Q: 암호화되지 않은 안전하지 않은 알고리즘을 사용하려면 어떻게 해야 합니까?

추가할 내용

  HostkeyAlgorithms +ssh-rsa
  PubkeyAcceptedAlgorithms +ssh-rsa

의 신게에에게.~/.ssh/config

Host your-azure-devops-domain
  IdentityFile ~/.ssh/id_rsa
  IdentitiesOnly yes
  HostkeyAlgorithms +ssh-rsa
  PubkeyAcceptedAlgorithms +ssh-rsa

Q: 마이크로소프트는 이것이 문제라는 것을 알고 있습니까?

, 그렇습니다.

Q: 그들은 신경을 쓰나요?

아니요. 그것은 특징

게시물에 따르면 다음을 추가할 수 있습니다.ssh.dev.azure.com을 사용자의 호스트에 합니다.~/.ssh/config파일 이름:

~/.ssh/config제게 효과가 있었습니다.

Host ssh.dev.azure.com
    HostName ssh.dev.azure.com
    User git
    IdentityFile ~/.ssh/id_rsa
    IdentitiesOnly yes
    PubkeyAcceptedAlgorithms +ssh-rsa
    HostkeyAlgorithms +ssh-rsa

scp 또는 ssh는 이것을 사용할 수 있습니다.

ssh -p 22 -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedKeyTypes=+ssh-rsa  user@myhost
# or scp
scp -P 22 -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedKeyTypes=+ssh-rsa  user@myhost

Azure DevOps를 사용하는 사용자의 경우 다음 ~/.ssh/config를 사용해야 합니다. Azure에는 복제 저장소에서 반환하는 URL이 다르기 때문입니다.

Host ssh.dev.azure.com
  PubkeyAcceptedAlgorithms +ssh-rsa
  HostkeyAlgorithms +ssh-rsa

Host vs-ssh.visualstudio.com
  PubkeyAcceptedAlgorithms +ssh-rsa
  HostkeyAlgorithms +ssh-rsa

의 신의에서.~/.ssh/config파일, 이 행을 추가합니다.

Host *.drush.in
    HostkeyAlgorithms +ssh-rsa
    PubkeyAcceptedAlgorithms +ssh-rsa

저도 이런 문제가 있었습니다. 이것은 저에게 효과가 있었습니다.

cd ~/.ssh/
vim config

Host [Hostname]
User [User]
PubkeyAcceptedAlgorithms +ssh-rsa
HostkeyAlgorithms +ssh-rsa

몇 개의 호스트 이름에 대해 이 문제가 발생하여 현재 SSH 구성 파일에 이러한 구성 중 몇 개가 있습니다.

NixOS 21.11을 연 상태에서SSH가 8.8p1로 업데이트되었습니다(Changelog 참조). OpenSSH는 몇 개의 다른 안전하지 않은 암호와 함께 ssh-rsa를 더 이상 사용하지 않습니다.

내가 정확히 이해했다면, 당신은 NixOS가 아닌 패키지 매니저로만 Nix를 사용하고 있습니다. 수 : edit 이편답지따수다있를니습을침변집의머지나(편집)).~/.ssh/config).

"NixOS"를 다시 활성화할 수 .ssh-rsa SSH 에 configuration.nix:

programs.ssh.extraConfig = ''
  PubkeyAcceptedAlgorithms +ssh-rsa
  HostkeyAlgorithms +ssh-rsa
''

에 대해 하지 않은 암호를 할 때) 을 opensh에 .configuration.nix:

services.openssh.extraConfig = ''
  PubkeyAcceptedAlgorithms +ssh-rsa
  HostkeyAlgorithms +ssh-rsa
'';

게시된 답변에 대한 수정입니다.저도 같은 문제가 있었고 위에 있는 다음 스니펫으로 작은 문제를 해결했습니다.

Host YOUR-DOMAIN
Hostname YOUR-DOMAIN
IdentityFile ~/.ssh/id_rsa
IdentitiesOnly yes
HostKeyAlgorithms=+ssh-rsa
PubkeyAcceptedAlgorithms=+ssh-rsa

교체하는 것을 잊지 마십시오.YOUR-DOMAINAzureDevOps에서 사용 중인 도메인을 사용합니다.

Windows 10 및 Git 버전 2.32.0의 경우 해결 방법 형식이 작동하지 않았습니다.이 토막글은 저에게 효과가 있었습니다.

호스트 = Hostname.com
아이덴티티파일 = ~/.vmdk/id_mdk
아이덴티티=만 있음
호스트 키알고리즘 = +http-messages
PubkeyAccepted Algorithms = +sys-message

나는 이 실수에 대해 많은 구글을 검색했습니다.Ubuntu 22.04와 모든 구성이 여기에 있습니다.
누군가에게 도움이 되길 바랍니다.

linux@linux:~$ cat /home/username/.ssh/config

Host *

KexAlgorithms +diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512
Ciphers aes128-cbc,3des-cbc,aes192-cbc,aes256-cbc,aes128-ctr,aes192-ctr,aes256-ctr

User username # it depends on your login; this one only for understanding

PubkeyAcceptedAlgorithms +ssh-rsa
HostkeyAlgorithms +ssh-rsa

그리고:

/etc/ssh/sshd_config

# Ciphers and keying

Ciphers             aes128-cbc,3des-cbc
KexAlgorithms +diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512

HostkeyAlgorithms ssh-dss,ssh-rsa
KexAlgorithms diffie-hellman-group1-sha1

또한 비트 버킷의 SSH 키를 설정하는 동안 Windows 시스템에서 이 문제가 발생했습니다.

처음에 ssh-keygen 명령을 사용하여 공용 및 개인 키 파일을 생성할 때 구성 파일이 생성되지 않았기 때문에 GitBash를 사용하여 구성 파일을 생성하고 아래 내용을 작성했습니다.

파일을 작성하려면 다음과 같이 하십시오.

touch config

생성된 파일을 열고 업데이트하려면 다음과 같이 하십시오.

nano config

구성 파일에 추가된 내용

Host [Hostname]
   HostName [Hostname]
   IdentityFile ~/.ssh/id_rsa
   IdentitiesOnly yes
   PubkeyAcceptedAlgorithms +ssh-rsa
   HostkeyAlgorithms +ssh-rsa

참고: 조직의 비트 버킷 계정을 사용하는 경우 호스트 이름이 다르거나 기본적으로 bitbucket.org 이 됩니다.

이 방법으로, 그것은 효과가 있었습니다.

  • 터미널 열기: cd ~/.ssh/
  • 구성 파일 생성: vim config
  • 다음 단계에서는 VIM을 사용하여 구성 파일을 입력하거나 내 방식을 사용할 수 있습니다.
  • 파인더 열기/ 폴더로 이동/ 유형: ~/.ssh
  • TextEdit 또는 Sublime으로 구성 파일 열기본문
  • 다음 코드를 붙여넣습니다.

호스트 replaceMeByYourGitDomain 호스트 이름 replaceMeByYourGitDomain 사용자 gitID파일 ~/.ssh/id_rsa 여기에 코드를 입력합니다. ID예 PubkeyAcceptedAlgorithms +ssh-rsa Hostkey만 해당알고리즘 +ssh-rsa

두 단계가 있습니다.

  1. 확장자 없이 구성 파일을 에 추가합니다.~/.ssh/디렉토리입니다.

  2. 구성 파일에 다음 내용을 추가합니다.

    HostkeyAlgorithms +ssh-rsa    
    PubkeyAcceptedAlgorithms +ssh-rsa
    

이 문제가 있었는데 컴퓨터가 잘못된 ssh.exe 파일을 참조하고 있었기 때문인 것으로 밝혀졌습니다.

다음 명령을 실행합니다.

which ssh.exe

이렇게 해도 OpenSSH/ssh.exe가 반환되지 않으면 문제일 수 있습니다.

반환 값을 가져와서 ssh.exe 파일의 이름을 ssh.exe.org 으로 변경합니다.

달려.

which ssh.exe

이제 OpenSSH/ssh.exe 파일이 표시됩니다.

이에 대한 간결한 해결책:ssh -oHostKeyAlgorithms=+ssh-rsa user@remote.server.com

언급URL : https://stackoverflow.com/questions/69875520/git-error-no-matching-host-key-type-found-their-offer-ssh-rsa

반응형