AES-256-CBC를 사용하여 SSH 쌍 생성

AES-256-CBC를 사용하여 SSH 쌍 생성

좋습니다. SSH 쌍을 생성하는 것은 쉽습니다 . 그런데 AES-256-CBC를 사용할 수 있는 SSH 쌍을 ssh-keygen생성하려면 어떻게 해야 합니까 ?ssh-keygen

기본 매개변수는 항상 AES-128-CBC입니다. 다른 매개변수를 시도했지만 다음과 같이 작동하지 않습니다.

ssh-keygen -b 4096 -t rsa -Z aes-256-cbc

하지만 그들은 직업이 없습니다. 무엇을 해야할지 알고 있나요?

답변1

당신은 그렇습니다아니요aes사용할 때 사용할 키를 생성합니다 ssh-keygen. 왜냐하면 aes그것은대칭 암호, 그 키는아니요쌍으로 나타납니다. 통신의 양쪽 끝은 동일한 키를 사용합니다.

ssh-keygen으로 생성된 키 사용공개 키 암호화인증에 사용됩니다. ssh-keygen매뉴얼 에서 :

 ssh-keygen generates, manages and converts authentication keys for
 ssh(1).  ssh-keygen can create RSA keys for use by SSH protocol version 1
 and DSA, ECDSA, Ed25519 or RSA keys for use by SSH protocol version 2.

ssh매뉴얼 에서 :

 Public key authentication works as follows: The scheme is based on
 public-key cryptography, using cryptosystems where encryption and
 decryption are done using separate keys, and it is unfeasible to derive
 the decryption key from the encryption key.  The idea is that each user
 creates a public/private key pair for authentication purposes.  The
 server knows the public key, and only the user knows the private key.
 ssh implements public key authentication protocol automatically, using
 one of the DSA, ECDSA, Ed25519 or RSA algorithms.

공개 키 암호화의 문제점은 속도가 매우 느리다는 것입니다. 대칭 키 암호화는 더 빠르며 ssh실제 데이터 전송에 사용됩니다. 대칭 암호화에 사용되는 키는 연결이 설정된 후 동적으로 생성됩니다(설명서 인용 sshd).

 For protocol 2, forward security is provided through a Diffie-Hellman key
 agreement.  This key agreement results in a shared session key.  The rest
 of the session is encrypted using a symmetric cipher, currently 128-bit
 AES, Blowfish, 3DES, CAST128, Arcfour, 192-bit AES, or 256-bit AES.  The
 client selects the encryption algorithm to use from those offered by the
 server.  Additionally, session integrity is provided through a
 cryptographic message authentication code (hmac-md5, hmac-sha1, umac-64,
 umac-128, hmac-ripemd160, hmac-sha2-256 or hmac-sha2-512).

이를 사용하려면 aes256-cbc-c 옵션을 사용하여 명령줄에서 지정해야 합니다. 가장 기본적인 형식은 다음과 같습니다.

$ ssh -c aes256-cbc user@host

ssh_config쉼표로 구분된 목록을 사용하여 원하는 비밀번호를 지정할 수도 있습니다. 그러나 기본값을 수정하는 것은 전문가에게 맡기는 것이 가장 좋으므로 권장하지 않습니다. OpenSSH 개발자는 기본값을 선택할 때 다양한 요소와 수년간의 경험을 고려합니다.

답변2

SSH 연결을 위한 개인/공개 키를 생성하는 데 사용되는 비밀번호를 변경하려면 다음을 수행할 수 있습니다.

openssl genrsa -aes256 -out private.key 4096
ssh-keygen -y -f private.key > public.key.pub

SSH 연결에 사용할 수 있는 비밀번호를 확인하세요.

ssh -Q cipher

데몬(sshd - 연결하려는 원격 호스트)도 연결하려는 암호 유형을 지원해야 합니다. sshd에서 사용하는 비밀번호는 원격 호스트에 설치된 ssh와 동일한 것 같아요. 따라서 ssh -Q cipher원격 호스트에서 이 작업을 수행하면 sshd가 어떤 암호를 지원하는지 확인할 수 있습니다.

추신: 공개 키를 생성하기 위해 openssl을 사용하려고 하면 형식이 다를 뿐만 아니라 인코딩도 다르기 때문에 ssh 연결에서는 작동하지 않습니다. 가지다이 게시물둘 사이를 변환하는 방법을 보여줍니다.

관련 정보