我想将ECDSA密钥导入AWS EC2。AWS EC2仅导入RSA密钥,而不导入ECDSA或ED25519密钥,这是真的吗?如果有导入ECDSA密钥的方法,该怎么做?
# Discover the apt package that provided ssh-keygen
$ apt-file search `which ssh-keygen`
openssh-client: /usr/bin/ssh-keygen
openssh-client-ssh1: /usr/bin/ssh-keygen1
# Discover the installed version of openssh-client
$ apt list openssh-client
Listing... Done
openssh-client/groovy,now 1:8.3p1-1 amd64 [installed,automatic]
# Make a new key pair
$ ssh-keygen -b 521 -f ~/.ssh/key2020-10-28 -P "" -t ecdsa
# Import the new key pair
$ aws ec2 import-key-pair --key-name key2020-10-28 \
--public-key-material fileb://~/.ssh/key2020-10-28.pub
#An error occurred (InvalidKey.Format) when calling the ImportKeyPair operation:
#Key is not in valid OpenSSH public key format
# Try again with a base64 encoded key:
$ base64 ~/.ssh/key2020-10-28.pub > ~/.ssh/key2020-10-28.pub.b64
$ aws ec2 import-key-pair --key-name key2020-10-28 \
--public-key-material fileb://~/.ssh/key2020-10-28.pub.b64
# An error occurred (InvalidKey.Format) when calling the ImportKeyPair operation:
# Key is not in valid OpenSSH public key format
接下来,我尝试了旧的RSA密钥算法,该算法有效:
ssh-keygen -b 4096 -f ~/.ssh/ec2 -P "" -N "" -t rsa
aws ec2 import-key-pair --key-name rsa2020-10-28 \
--public-key-material fileb://~/.ssh/rsa2020-10-28.pub
{
"KeyFingerprint": "c9:32:25:36:fd:b8:a0:83:09:1b:56:6f:86:a1:18:4e",
"KeyName": "rsa2020-10-28",
"KeyPairId": "key-04ebd4202d5988526"
}
接下来,我尝试了不安全的旧DSA密钥算法:
ssh-keygen -f ~/.ssh/dsa2020-10-28 -P "" -t dsa
aws ec2 import-key-pair --key-name dsa2020-10-28 \
--public-key-material fileb://~/.ssh/dsa2020-10-28.pub
An error occurred (InvalidKey.Format) when calling the ImportKeyPair operation:
Key is not in valid OpenSSH public key format
接下来,我尝试了ed25519密钥算法:
ssh-keygen -f ~/.ssh/ed25519-2020-10-28 -P "" -t ed25519
aws ec2 import-key-pair --key-name dsa2020-10-28 \
--public-key-material fileb://~/.ssh/ed25519-2020-10-28.pub
An error occurred (InvalidKey.Format) when calling the ImportKeyPair operation:
Key is not in valid OpenSSH public key format
就像@ dave_thompson_085正确说的那样,AWS文档说:描述:从您创建的RSA密钥对导入公钥。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句