Home > General, Security > Python code debug using rpdb (Keystone source code debugging)

Python code debug using rpdb (Keystone source code debugging)

Install rpdb first for debugging keystone python application
$sudo pip install –proxy=$http_proxy rpdb

Go to keystone source repository

# Go into python file where you want to place the rpdb debugging
 def check_policy_association_for_endpoint(self, context, policy_id, endpoint_id):
 import rpdb; rpdb.set_trace()
After adding rpdb in the source code now just build and install the code

 ~\keystone$ python setup.py build -v
 ~\keystone$ python setup.py install -v

Restart apache tomcat server
$ sudo service apache2 restart

Issue openstack cli or curl command (above debug starts for below curl operation)
 $ curl -s -H "Content-Type: application/json" -H "X-Auth-Token: 43c976f2941f4ca8a41444707ae6596c" http://localhost:35357/v3/policies/66cdadcc1cda4b768668b1013227e8a3/OS-ENDPOINT-POLICY/endpoints/2fbb8d23ccf74a1e86e491fd6151bcc5

Check the keystone log file you should see that pdb is initiated:
$ sudo tail -f /var/log/apache2/keystone.log

If pdb gets initiated then make sure to telnet on the debugger
$ telnet 4444

prompt shows up with python file name
(Pdb) Press enter or to exit ctrl+]
<telnet> quit

n, s and more options available

Categories: General, Security Tags: , ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: