Last active
August 29, 2015 13:58
-
-
Save zhanghui9700/9949646 to your computer and use it in GitHub Desktop.
direct access meta-data api in havana
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
expected_signature = hmac.new( | |
CONF.neutron_metadata_proxy_shared_secret, | |
instance_id, | |
hashlib.sha256).hexdigest() | |
# grep shared_secret /etc/nova/nova.conf | |
neutron_metadata_proxy_shared_secret=deadbeef2eb84d8d | |
Python 2.7.5 (default, Nov 12 2013, 16:18:42) | |
[GCC 4.8.2 20131017 (Red Hat 4.8.2-1)] on linux2 | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> import hmac | |
>>> import hashlib | |
>>> hmac.new('deadbeef2eb84d8d', | |
>>> '32d0524b-314d-4594-b3a3-607e3f2354f8', | |
>>> hashlib.sha256).hexdigest() | |
'6bcbe3885ae7efc49cef35b438efe29c95501f4a720a0c53ed000d8fcf04a605' | |
$ curl \ | |
-H 'x-instance-id: 32d0524b-314d-4594-b3a3-607e3f2354f8' \ | |
-H 'x-tenant-id: 28a490a0f8b28800181ce490a74df8d2' \ | |
-H 'x-instance-id-signature: 6bcbe3885ae7efc49cef35b438efe29c95501f4a720a0c53ed000d8fcf04a605' \ | |
http://localhost:8775/latest/meta-data | |
ami-id | |
ami-launch-index | |
ami-manifest-path | |
block-device-mapping/ | |
hostname | |
instance-action | |
instance-id | |
instance-type | |
kernel-id | |
local-hostname | |
local-ipv4 | |
placement/ | |
public-hostname | |
public-ipv4 | |
public-keys/ | |
ramdisk-id | |
reservation-id | |
references: | |
[1] http://blog.oddbit.com/2014/01/14/direct-access-to-nova-metadata/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment