https - How to debug Django app that runs on top of TLS/SSL? -


What is the best way to debug a dynamic app running on TGL / SSL?

Background:

I have a Django web app that uses the X.509 client side certificate for authentication. While running under Apache, my app can only access HTTPS. Clients that join the app provide a client-side certificate that accepts Apache and then adds an app to an enabled variable. The app parses the certificate and provides access-controlled content.

So far, I have been debugging the app under regular HTTP as well as "./manage.py runerver". I've simulated an HTTPS connection using Custom View Handler Middleware, which is in Debug Mode. See Handler adds information to the request, similar to information that will be parsed with the actual client side certificate run under HTTPS.

This would be very easy for me to debug, if I can debug the actual client side certificates that provide clients when connecting via HTTPS.

We use nginx in front of the DNS client certificate check NGINX SSM termination, client authenticate verification , And checks against the revocation list. The customer certificate fields are passed in the header variables until the Django app.

Then our django app cert does not receive, it only looks at the header variable. I think the same mechanism applies to Apache

To reach customers to the development server (such as './manage.py' driver), we have a special case for the customer. Example of a Python client:

  if (protozo == "https"): conn = http.client.HTTPSConnection ("cert." + + Webhost + ":" + port, key_file = Certfile, Cert_file = certfile) header = {} other: fake clients for # local connections. As it will come # of nginx Conn = http.client.HTTPConnection, pass the certificate information in the header (webhost + ":" + port) "header = {'X_SSL_CLIENT_S_DN': '/ C = America / Scheduled = California / O = 'YYYY / CN = ZZZZ', 'X_SSL_CLIENT_I_DN': '/ C = America / Scheduled = California / O = xxxx / CN = wwww', 'X_SSL_CLIENT_SERIAL': hex (serialnum), 'USER_AGENT': "Testing customer user agent ",} For Unit Tests, we do the same thing using the Django Test client:  
 Django.test.client Import Client from  to self.client = Client () Response = self.client.get (URL, Data, ** {'HTTP_X_SSL_CLIENT_S_DN': '/ C = America / Scheduled Tribes = California / O = 'Test client user agent': 'HTTP_X_SSL_CLIENT_I_DN': '/ c = America / Scheduled = California / O = ,})    

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -