मैंने पहले से ही एक समान सेटअप कॉन्फ़िगर किया है।
सबसे पहले, मैंने उपयोगकर्ता को प्रमाणीकृत करने के लिए अपाचे 2 का उपयोग किया।
आप mod_ssl सक्षम करें, और परिभाषित करने के लिए (विश्व स्तर पर) की आवश्यकता है:
- SSLCertificateFile: अपने PEM एन्कोड सर्वर प्रमाणपत्र को अंक;
- SSLCertificateKeyFile: आपके पीईएम एन्कोडेड सर्वर कुंजी को इंगित करता है;
- SSLCertificateChainFile: सीए प्रमाणपत्रों की आपकी पीईएम सूची को इंगित करता है;
- SSLCACertificatePath: आपके सभी पीईएम सीए प्रमाण पत्र वाले फ़ोल्डर को इंगित करता है;
- SSLCACertificateFile: आपके सीए प्रमाणपत्र को इंगित करें (SSLCertificateChainFile के समान मूल्य होना चाहिए);
- SSLCARevocationPath: आपके सभी सीआरएल वाले फ़ोल्डर को इंगित करता है;
- SSLCARevocationFile: निरस्त प्रमाणपत्रों (आपकी सीए-बंडल.crl)
- SSLCARevocation चेक श्रृंखला की सूची को इंगित करता है।
अब आपका सर्वर क्लाइंट X.509 प्रमाणपत्र सत्यापित करने के लिए तैयार है।
यदि आप अपाचे 2 सर्वर के रूप में apache2 का उपयोग नहीं करना चाहते हैं, तो आप इसे mod_proxy सक्षम करके एक रिवर्स प्रॉक्सी के रूप में कॉन्फ़िगर कर सकते हैं।,
<VirtualHost *:443>
ServerName test.example.com:443
ServerAdmin [email protected]
RequestHeader set Front-End-Https "On"
# Here I define two headers, Auth-User and Remote-User
# They will contain the key SSL_CLIENT_S_DN_CN which is the name of the
# client certificate's owner.
<If "-n %{SSL_CLIENT_S_DN_CN}">
# If the key doesn't exist, it means that the certificate wasn't sent or
# it was revoked.
RequestHeader set Auth-User "%{SSL_CLIENT_S_DN_CN}s"
RequestHeader set Remote-User "%{SSL_CLIENT_S_DN_CN}s"
</If>
# Now enable SSL, and SSL via the proxy
SSLEngine on
SSLProxyEngine on
## Require a client certificate
# SSLVerifyClient require
## NB: I prefer set it to optional, in order to allow the user
## to connect to my application with a degraded mode (login+password)
## It's easy to detect if the user was authenticated by apache by looking
## at HTTP_AUTH_USER or HTTP_REMOTE_USER
SSLVerifyClient optional
# Maximum depth of CA Certificates in Client Certificate verification
SSLVerifyDepth 4
# Now, I pass all of this to my application, which is runned in nginx for example :
<Location />
ProxyPass http://<applciation host>
ProxyPassReverse http://<applciation host>
ProxyPreserveHost on
# Send all informations about the client/server certificates to the application
SSLOptions +StdEnvVars +ExportCertData
</Location>
</VirtualHost>
और अब Django के साथ, तुम बस के रूप में वर्णित here रिमोट प्रमाणीकरण बैकएंड सक्षम करने के लिए:
आप सिर्फ इस तरह एक वर्चुअलहोस्ट परिभाषित करने की जरूरत।
क्लाइंट प्रमाण पत्र से निकाली गई सभी सूचनाएं एप्लिकेशन को भेजी जाती हैं, इसलिए अनुरोध ऑब्जेक्ट (और/या मध्यवर्ती के साथ) का उपयोग करके आप उनका उपयोग कर सकते हैं।
मुझे आशा है कि इससे आपकी मदद मिलेगी।
बस इसे लागू करने के लिए http://github.com/novapost/django-x509 शुरू किया। – Natim