[Bug 1904741] Re: Verify that domain returned from IMDS is an AWS domain
Ćukasz Zemczak
1904741 at bugs.launchpad.net
Thu Nov 19 10:25:01 UTC 2020
At first I was a bit puzzled by the true/false values used in this
patch, made the test case look a bit weird in my mind. But I see it's
just what they use - the opposite of what I'd normally use but oh well.
** Changed in: ec2-instance-connect (Ubuntu Groovy)
Status: New => Fix Committed
** Tags added: verification-needed verification-needed-groovy
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to ec2-instance-connect in Ubuntu.
https://bugs.launchpad.net/bugs/1904741
Title:
Verify that domain returned from IMDS is an AWS domain
Status in ec2-instance-connect package in Ubuntu:
Fix Released
Status in ec2-instance-connect source package in Xenial:
Fix Committed
Status in ec2-instance-connect source package in Bionic:
Fix Committed
Status in ec2-instance-connect source package in Focal:
Fix Committed
Status in ec2-instance-connect source package in Groovy:
Fix Committed
Bug description:
[Impact]
The domain returned from IMDS is not verified if it was and AWS
domain.
[Test Cases]
0) Deploy an Amazon AWS instance with Instance Connect feature enabled
1) Connect to the instance using Instance Connect, for example by pressing the "Connect" button on the web UI.
2. Within a few ten seconds of connecting run (assuming using the ubuntu username):
bash -x /usr/share/ec2-instance-connect/eic_curl_authorized_keys
ubuntu
3) The debug output should show successful validation:
...
++ /usr/bin/curl -s -f -m 1 -H 'X-aws-ec2-metadata-token: ...XXX...==' http://169.254.169.254/latest/meta-data/services/domain/
+ domain=amazonaws.com
+ domain_exit=0
+ '[' 0 -ne 0 ']'
+ is_domain_valid=1
+ for valid_domain in amazonaws.com amazonaws.com.cn c2s.ic.gov sc2s.sgov.gov
+ '[' amazonaws.com = amazonaws.com ']'
+ is_domain_valid=0
+ break
+ '[' 0 -eq 1 ']'
++ /usr/bin/printf managed-ssh-signer.%s.%s us-east-2 amazonaws.com
...
[Regression Potential]
The validation code can fail preventing connection to the VM. Considering that this is a very small amount of code an looks OK this is unlikely.
The validation could also falsely pass, but that would not be a regression since the validation was not there before.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ec2-instance-connect/+bug/1904741/+subscriptions
More information about the foundations-bugs
mailing list