OpenSSH의 SSH 클라이언트는 IdentityFile 설정 순서를 따르지 않습니다.

OpenSSH의 SSH 클라이언트는 IdentityFile 설정 순서를 따르지 않습니다.

OpenSSH의 SSH 클라이언트(OpenSSH_7.5p1, OpenSSL 1.0.2k 2017년 1월 26일, Git for Windows v2.11.1)가 SSH 호환 데몬(예: Apache Mina SSHD(Gerrit)에 공개/개인 키 쌍을 제공하는 순서를 지정하는 방법 )) 코드 검토 서비스). 내 의도는 RSA로 돌아가기 전에 Ed25519 공개/개인 키 쌍을 사용하여 인증을 시도하는 것입니다.

사용자의 홈 디렉터리에 다음과 같은 표준 Ed25519 및 RSA 공개/개인 키 쌍이 있다고 가정합니다.

  • ~/.ssh/id_ed25519{,.pub}
  • ~/.ssh/id_rsa{,.pub}

사용자의 SSH 구성 파일(~/.ssh/config)에 있는 다음 호스트 섹션:

Host foobar foobar.example.com
  Hostname foobar.example.com
  IdentityFile ~/.ssh/id_ed25519

Host *
  IdentityFile ~/.ssh/id_ed25519
  IdentityFile ~/.ssh/id_rsa

디버그 모드에서 SSH 연결을 테스트하는 경우:

$ ssh -Tv bob@foobar
debug1: Reading configuration data ~/.ssh/config
debug1: ~/.ssh/config line 49: Applying options for foobar
debug1: ~/.ssh/config line 63: Applying options for *
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: ~/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Offering ED25519 public key: ~/.ssh/id_ed25519
debug1: Server accepts key: pkalg ssh-ed25519 blen 51
debug1: Authentication succeeded (publickey).

OpenSSH의 SSH 클라이언트가 먼저 RSA 공개/개인 키 쌍을 제공하는 것을 볼 수 있습니다. 그런데 왜 Ed25519를 먼저 사용하지 않는 걸까요?

답변1

옵션을 추가하세요 IdentitiesOnly. 이 옵션이 없으면 SSH는 먼저 사용 가능한 기본 SSH 키( id_rsa, id_dsa, ) 를 시도합니다 id_ecdsa. 이 동작을 변경하려면 구성을 다음으로 바꾸십시오.

Host foobar foobar.example.com
  Hostname foobar.example.com
  IdentityFile ~/.ssh/id_ed25519
  IdentitiesOnly yes

Host *
  IdentityFile ~/.ssh/id_ed25519
  IdentityFile ~/.ssh/id_rsa
  IdentitiesOnly yes

관련 정보