Custom Search

Friday, December 6, 2019

How to debug OpenStack Metadata Service - neutron metadata proxy

1)
# grep shared_secret /etc/nova/nova.conf
neutron_metadata_proxy_shared_secret=xxxxxxxxxxxxxx  #default to ""

2)
import hmac
import hashlib

secret = ""
instance_id = "34361309-1873-476b-9258-b8fe2184a4d8"

hmac.new(secret, instance_id, hashlib.sha256).hexdigest()

0175b5cbd28c2d0512d3f1d3a7b5bacf6d6b6a8a4bdaebf56568a454f94bd5a6

3)
curl \
  -H 'x-instance-id: 34361309-1873-476b-9258-b8fe2184a4d8' \
  -H 'x-tenant-id: 66cbc35f0b99430987357c2526945f8b' \
  -H 'x-instance-id-signature: 0175b5cbd28c2d0512d3f1d3a7b5bacf6d6b6a8a4bdaebf56568a454f94bd5a6' \
  http://172.16.12.5:8775/latest/meta-data

ami-id
ami-launch-index
ami-manifest-path
block-device-mapping/
hostname
instance-action
instance-id
instance-type
local-hostname
local-ipv4
placement/
public-hostname
public-ipv4
reservation-id

4)
curl \
  -H 'x-instance-id: 34361309-1873-476b-9258-b8fe2184a4d8' \
  -H 'x-tenant-id: 66cbc35f0b99430987357c2526945f8b' \
  -H 'x-instance-id-signature: 0175b5cbd28c2d0512d3f1d3a7b5bacf6d6b6a8a4bdaebf56568a454f94bd5a6' \
  http://172.16.12.5:8775/latest/meta-data/local-ipv4

10.10.1.253

No comments:

Post a Comment