Getting OpenStack Tenant Info by Floating IP Address

openstack_logoWhen running a public cloud you sometimes need to obtain user or tenant information quickly based on their public IP address.  Here is a simple shell tool to accomplish this rather than having to piece together information in several commands, looking in several places.

 

Download the Script
Download to your controller, or somewhere you have the keystonerc_admin file

curl https://raw.githubusercontent.com/sadsfae/misc-scripts/master/shell/openstack-track-fip.sh \
> openstack-track-fip.sh && chmod +x openstack-track-fip.sh

Query the IP Address
Run this from your controller node, or somewhere you have the keystonerc_admin file.

# ./openstack-track-fip.sh 128.136.179.81
########### OpenStack IP Sleuth 3000 ###########
# 
# 128.136.179.81 currently resolves to: 
# 
#-----------------------------------------------
# Tenant   = 78093fe92a5e4fb1a5697b3d875a6581 
# Username = randomperson01545449761301844689 
# Email    = randomperson01@example.com 
#-----------------------------------------------
# 
################################################
To disable the account run:
------------------------------------------------
source /root/keystonerc_admin
openstack user set randomperson545449761301844689 --disable

Code can be found on github here.

Note that this only resolves who currently has the IP address, if you wanted to search historically you’d need to record this information somewhere and query that.  We also have a facility for this but deserves a separate, future post.

Unknown's avatar

About Will Foster

hobo devop/sysadmin/SRE
This entry was posted in open source, sysadmin and tagged , , , , . Bookmark the permalink.

Have a Squat, Leave a Reply ..

This site uses Akismet to reduce spam. Learn how your comment data is processed.