Normal HTTPS में, सिर्फ server अपनी identity certificate के साथ prove करता है। Client (browser) anonymous होता है — server को नहीं पता कि कौन connect हो रहा है।
Mutual TLS (mTLS) एक extra step add करता है: client भी एक certificate present करता है। दोनों sides एक-दूसरे को authenticate करते हैं। Server client के certificate को एक trusted CA के against verify करता है, और client server के certificate को verify करता है — इसलिए “mutual” कहा जाता है।
Normal TLS vs Mutual TLS
| Normal TLS | Mutual TLS (mTLS) | |
|---|---|---|
| Server identity prove करता है | Yes Certificate + CA signature | Yes Same |
| Client identity prove करता है | No Anonymous | Yes Client certificate |
| Authentication | One-way (सिर्फ server) | Two-way (दोनों) |
| Use case | Public websites | Internal APIs, zero trust |
| Client को चाहिए | बस एक browser | Certificate + private key |
| Setup complexity | Standard | ज़्यादा — client certs manage करने होते हैं |
mTLS कब use करें
Service-to-service communication
Microservices network पर एक-दूसरे से communicate करती हैं। mTLS ensure करता है कि सिर्फ authorized services connect कर सकती हैं — न कि कोई भी जो URL जानता हो।
Service A ←──mTLS──→ Service B
दोनों verify करते हैं: "क्या आप वही हैं जो आप claim करते हैं?"
Zero Trust architecture
Zero trust में, कोई भी network connection default रूप से trusted नहीं है — corporate network के अंदर भी नहीं। mTLS network-level trust (firewalls, VPNs) को identity-level trust (certificates) से replace कर देता है।
API security
Sensitive APIs को सिर्फ API keys से beyond secure करें। एक stolen API key कोई भी use कर सकता है। एक client certificate एक specific private key से bound होता है — steal करना और use करना harder है।
IoT device authentication
Devices manufacturing के दौरान provisioned client certificates के साथ backend से connect होते हैं। Server जानता है कि वह एक genuine device से communicate कर रहा है, fake से नहीं।
mTLS कैसे काम करता है
- Client connect होता है और TLS handshake start करता है (normal TLS के same)
- Server अपना certificate भेजता है — client इसे verify करता है (normal TLS के same)
- Server client certificate request करता है — एक
CertificateRequestmessage भेजता है - Client अपना certificate भेजता है — server इसे trusted CA के against verify करता है
- दोनों sides session keys calculate करते हैं और encrypted communication start होता है
Steps 3-4 इसे “mutual” बनाते हैं।
Nginx mTLS configuration
server {
listen 443 ssl;
server_name api.example.com;
# Server certificate (normal HTTPS के same)
ssl_certificate /etc/ssl/server-fullchain.pem;
ssl_certificate_key /etc/ssl/server-privkey.pem;
# Client certificate verification
ssl_client_certificate /etc/ssl/client-ca.pem; # CA that signed client certs
ssl_verify_client on; # Require client cert
# Optional: pass client cert info to your app
proxy_set_header X-Client-DN $ssl_client_s_dn;
proxy_set_header X-Client-Verify $ssl_client_verify;
}
mTLS vs other authentication methods
| Method | Security level | Complexity | Best for |
|---|---|---|---|
| API key | Low (shareable) | Low | Public APIs, rate limiting |
| OAuth/JWT | Medium | Medium | User-facing APIs |
| mTLS | High (crypto-bound) | High | Service-to-service, zero trust |
| mTLS + JWT | Highest | High | Transport और application दोनों auth |
mTLS और GetHTTPS
GetHTTPS server certificates issue करता है — वे certificates जो आपका web server अपनी identity prove करने के लिए use करता है। ये हर HTTPS website द्वारा use किए जाने वाले standard SSL certificates हैं।
mTLS के लिए client certificates आमतौर पर एक private CA (आपके organization का internal CA) द्वारा issue किए जाते हैं, Let’s Encrypt जैसे public CA द्वारा नहीं। Let’s Encrypt client certificates issue नहीं करता — वे सिर्फ public domains के लिए server certificates issue करते हैं।
FAQ
क्या मैं mTLS के लिए Let’s Encrypt use कर सकता हूँ?
Server certificate के लिए: हाँ। Client certificates के लिए: नहीं। Client certs को आपके द्वारा controlled private CA से issue किया जाना चाहिए — ताकि आप decide कर सकें कि कौन से clients authorized हैं। openssl, cfssl, या step-ca जैसे tools आपके private CA के रूप में काम कर सकते हैं।
क्या mTLS “client certificate authentication” के same है?
हाँ। “Mutual TLS,” “mTLS,” “two-way TLS,” और “client certificate authentication” सभी same चीज़ refer करते हैं — TLS handshake के दौरान दोनों sides certificates present करते हैं।
क्या mTLS API keys replace करता है?
यह कर सकता है, लेकिन वे different purposes serve करते हैं। mTLS transport-level identity (कौन सी service connect हो रही है) prove करता है। API keys/JWTs application-level identity (कौन सा user/permission) prove करते हैं। कई systems defense in depth के लिए दोनों together use करती हैं।
mTLS commonly कहाँ use होता है?
Kubernetes (Istio/Linkerd के साथ service mesh), Cloudflare Access, AWS API Gateway (mutual TLS), Google Cloud का BeyondCorp, और ज़्यादातर enterprise zero-trust implementations में।