Skip to content

SSH metadata doesn't match the IMDS format #234

@arianvp

Description

@arianvp

Describe the bug

The mock server returns SSH keys in a different format than EC2 IMDS.

e.g.

http://169.254.169.254/latest/meta-data/public-keys/

returns

0=mykey

on EC2 whilst this project returns

0/

Which means that the ec2-metadata tool that ships with Amazon Linux 2 chokes on the output:

ec2-metadata --public-keys

garblles output:

$ ec2-metadata --public-keys
public-keys: 
keyname:0/
index:0/
format:public-keys/
key:(begins from next line)


Steps to reproduce

$ sudo ip addr add 169.254.169.254 dev enp0s1
$ sudo  ec2-metadata-mock  --hostname 169.254.169.254 --port 80
$ ec2-metadata --public-keys
public-keys: 
keyname:0/
index:0/
format:public-keys/
key:(begins from next line)

Expected outcome

$ ec2-metadata --public-keys
public-keys: 
keyname:framework
index:0
format:openssh-key
key:(begins from next line)
ssh-ed25519 XXXXXXXX framework

Application Logs
The log output when experiencing the issue.

Environment

  • AEMM Version: v1.12.0
  • OS/Arch: Amazon Linux 2
  • Installation method:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstalebot-ignoreTo NOT let stalebot update or close the Issue / PR

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions