openssl s_client

नेटवर्क

इस्तेमाल

openssl s_client -connect <host>:443 -servername <host>

कच्चा TLS कनेक्शन खोलता है ताकि आप प्रमाणपत्र और handshake देख सकें; `-servername` छोड़ देने पर एक ही पते पर कई साइट रखने वाला सर्वर अपना डिफ़ॉल्ट प्रमाणपत्र देता है, और `< /dev/null` के बिना यह इनपुट की प्रतीक्षा में अटका रहता है।

आम विकल्प

विकल्पअर्थ
-connect host:443Where to open the TLS connection.
-servername <host>The SNI name. Without it a shared host serves its default certificate.
-showcertsPrint the whole chain the server sent, not just the leaf.
-tls1_2 / -tls1_3Force one protocol version, to test what the server still accepts.
-verify_return_errorFail instead of continuing when the chain does not validate.
< /dev/nullClose stdin, or the command sits and waits forever.

उदाहरण

openssl s_client -connect example.com:443 -servername example.com < /dev/null 2>/dev/null | openssl x509 -noout -dates

When the certificate expires.

openssl s_client -connect example.com:443 -showcerts < /dev/null

Inspect the full chain for a missing intermediate.

कनेक्शन न बने तो ये बताते हैं कि बात कहाँ तक पहुँची — नाम हल नहीं हुआ, रास्ता नहीं, या पोर्ट बंद है।

कैसे पढ़ें

  • बड़े कोष्ठक [ ] उस हिस्से को दिखाते हैं जिसे छोड़ा जा सकता है।
  • तीन बिंदु … का मतलब है एक से ज़्यादा दिए जा सकते हैं।
  • विकल्पों में बड़े-छोटे अक्षर मायने रखते हैं — कुछ कमांड में -r और -R अलग काम करते हैं।

आम सवाल

Q. openssl s_client क्या करता है?

कच्चा TLS कनेक्शन खोलता है ताकि आप प्रमाणपत्र और handshake देख सकें; `-servername` छोड़ देने पर एक ही पते पर कई साइट रखने वाला सर्वर अपना डिफ़ॉल्ट प्रमाणपत्र देता है, और `< /dev/null` के बिना यह इनपुट की प्रतीक्षा में अटका रहता है।

Q. इसे कैसे लिखें?

openssl s_client -connect <host>:443 -servername <host> — बड़े कोष्ठक वह हिस्सा दिखाते हैं जो छोड़ा जा सकता है।

Q. कितने विकल्प जानने लायक़ हैं?

यहाँ 6 दिए हैं; पूरी सूची man openssl में है। यह कमांड नेटवर्क में आती है।

मिलती-जुलती कमांड

man पेज: man openssl-s_client