mirror of
https://github.com/ipxe/ipxe
synced 2026-10-07 15:05:42 +03:00
[cloud] Add support for AWS IMDSv2
Use an HTTP PUT request to fetch a session token, and pass this token value as a header when fetching the user-data script. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -19,6 +19,22 @@ exit
|
||||
|
||||
:dhcp_ok
|
||||
route ||
|
||||
chain -ar http://169.254.169.254/latest/user-data ||
|
||||
|
||||
# Fetch session token
|
||||
params --method PUT
|
||||
param --header X-Aws-Ec2-Metadata-Token-Ttl-Seconds 600
|
||||
imgset authtoken http://169.254.169.254/latest/api/token##params ||
|
||||
|
||||
# Fetch user-data
|
||||
params
|
||||
isset ${authtoken} && param --header X-Aws-Ec2-Metadata-Token ${authtoken} ||
|
||||
kernel http://169.254.169.254/latest/user-data##params ||
|
||||
imgstat ||
|
||||
|
||||
# Boot from user-data
|
||||
boot -ar ||
|
||||
|
||||
# Show diagnostic information on failure
|
||||
imgstat ||
|
||||
ifstat ||
|
||||
exit
|
||||
|
||||
Reference in New Issue
Block a user