OPENSSL-S_CLIENT(1ossl)
β¨ NAME β¨
openssl-s_client β the OpenSSL SSL/TLS client program, bestie. This is the OPENSSL-S_CLIENT(1ossl) page, and itβs literally the diagnostic bestie for SSL servers.
πΈ SYNOPSIS πΈ
okay so the whole command vibe is:
openssl s_client [-help] [-ssl_config section] [-connect host:port]
[-host hostname] [-port port] [-bind host:port] [-proxy host:port]
[-proxy_user userid] [-proxy_pass arg] [-unix path] [-4] [-6] [-quic]
[-servername name] [-noservername] [-verify depth]
[-verify_return_error] [-verify_quiet] [-verifyCAfile filename]
[-verifyCApath dir] [-verifyCAstore uri] [-cert filename] [-certform
DER|PEM|P12] [-cert_chain filename] [-build_chain] [-CRL filename]
[-CRLform DER|PEM] [-crl_download] [-key filename|uri] [-keyform
DER|PEM|P12|ENGINE] [-pass arg] [-chainCAfile filename] [-chainCApath
directory] [-chainCAstore uri] [-requestCAfile filename]
[-dane_tlsa_domain domain] [-dane_tlsa_rrdata rrdata]
[-dane_ee_no_namechecks] [-reconnect] [-showcerts] [-prexit]
[-no-interactive] [-debug] [-trace] [-nocommands] [-adv]
[-security_debug] [-security_debug_verbose] [-msg] [-timeout] [-mtu
size] [-no_ems] [-keymatexport label] [-keymatexportlen len] [-msgfile
filename] [-nbio_test] [-state] [-nbio] [-crlf] [-ign_eof] [-no_ign_eof]
[-psk_identity identity] [-psk key] [-psk_session file] [-quiet] [-sctp]
[-sctp_label_bug] [-fallback_scsv] [-async] [-maxfraglen len]
[-max_send_frag] [-split_send_frag] [-max_pipelines] [-read_buf]
[-ignore_unexpected_eof] [-no_tx_cert_comp] [-no_rx_cert_comp] [-brief]
[-starttls protocol] [-xmpphost hostname] [-name hostname]
[-tlsextdebug] [-sess_out filename] [-sess_in filename] [-serverinfo
types] [-status] [-alpn protocols] [-nextprotoneg protocols] [-ct]
[-noct] [-ctlogfile] [-keylogfile file] [-early_data file] [-enable_pha]
[-use_srtp value] [-srpuser value] [-srppass value] [-srp_lateuser]
[-srp_moregroups] [-srp_strength number] [-ktls] [-tfo] [-nameopt
option] [-no_ssl3] [-no_tls1] [-no_tls1_1] [-no_tls1_2] [-no_tls1_3]
[-ssl3] [-tls1] [-tls1_1] [-tls1_2] [-tls1_3] [-dtls] [-dtls1]
[-dtls1_2] [-xkey infile] [-xcert file] [-xchain file] [-xchain_build
file] [-xcertform DER|PEM]> [-xkeyform DER|PEM]> [-CAfile file]
[-no-CAfile] [-CApath dir] [-no-CApath] [-CAstore uri] [-no-CAstore]
[-bugs] [-no_comp] [-comp] [-no_ticket] [-serverpref]
[-client_renegotiation] [-legacy_renegotiation] [-no_renegotiation]
[-no_resumption_on_reneg] [-legacy_server_connect]
[-no_legacy_server_connect] [-no_etm] [-allow_no_dhe_kex]
[-prefer_no_dhe_kex] [-prioritize_chacha] [-strict] [-sigalgs algs]
[-client_sigalgs algs] [-groups groups] [-curves curves] [-named_curve
curve] [-cipher ciphers] [-ciphersuites 1.3ciphers] [-min_protocol
minprot] [-max_protocol maxprot] [-record_padding padding]
[-debug_broken_protocol] [-no_middlebox] [-rand files] [-writerand file]
[-provider name] [-provider-path path] [-provparam [name:]key=value]
[-propquery propq] [-engine id] [-ssl_client_engine id]
[-allow_proxy_certs] [-attime timestamp] [-no_check_time]
[-check_ss_sig] [-crl_check] [-crl_check_all] [-explicit_policy]
[-extended_crl] [-ignore_critical] [-inhibit_any] [-inhibit_map]
[-partial_chain] [-policy arg] [-policy_check] [-policy_print] [-purpose
purpose] [-suiteB_128] [-suiteB_128_only] [-suiteB_192] [-trusted_first]
[-no_alt_chains] [-use_deltas] [-auth_level num] [-verify_depth num]
[-verify_email email] [-verify_hostname hostname] [-verify_ip ip]
[-verify_name name] [-x509_strict] [-issuer_checks] [-enable_server_rpk]
[-enable_client_rpk] [host:port]
π DESCRIPTION π
Okay so this command implements a generic SSL/TLS client, and it connects to a remote host using SSL/TLS. It is a very useful diagnostic tool for SSL servers. No cap, itβs the βwhat is this server even doingβ bestie.
π OPTIONS π
Before we get into the list: in addition to the options below, this command also supports the common and client only options documented in the "Supported Command Line Commands" section of the SSL_CONF_cmd(3) manual page.
-helpβ print out a usage message. Short, sweet, iconic.-ssl_config sectionβ use the specified section of the configuration file to configure theSSL_CTXobject.-connect host:portβ this specifies the host and optional port to connect to. It is possible to select the host and port using the optional target positional argument instead. If neither this nor the target positional argument are specified then an attempt is made to connect to the local host on port4433. If the host string is an IPv6 address, it must be enclosed in[and]. Important little bracket moment.-host hostnameβ host to connect to; use-connectinstead. Like, respectfully,-connectis right there.-port portβ connect to the specified port; use-connectinstead.-bind host:portβ this specifies the host address and or port to bind as the source for the connection. For Unix-domain sockets the port is ignored and the host is used as the source socket address. If the host string is an IPv6 address, it must be enclosed in[and].-proxy host:portβ when used with the-connectflag, the program uses the host and port specified with this flag and issues an HTTPCONNECTcommand to connect to the desired server. If the host string is an IPv6 address, it must be enclosed in[and].-proxy_user useridβ when used with the-proxyflag, the program will attempt to authenticate with the specified proxy using basic (base64) authentication.
β οΈ NB: Basic authentication is insecure; the credentials are sent to the proxy in easily reversible base64 encoding before any TLS/SSL session is established. Therefore, these credentials are easily recovered by anyone able to sniff/trace the network. Use with caution.
-proxy_pass argβ the proxy password source, used with the-proxy_userflag. For more information about the format ofargseeopenssl-passphrase-options(1).-unix pathβ connect over the specified Unix-domain socket.-4β use IPv4 only.-6β use IPv6 only.-quicβ connect using the QUIC protocol. If specified then the-alpnoption must also be provided. Package deal, bestie.-servername nameβ set the TLS SNI (Server Name Indication) extension in theClientHellomessage to the given value. If-servernameis not provided, the TLS SNI extension will be populated with the name given to-connectif it follows a DNS name format. If-connectis not provided either, the SNI is set to"localhost". This is the default since OpenSSL 1.1.1.
Even though SNI should normally be a DNS name and not an IP address, if -servername is provided then that name will be sent, regardless of whether it is a DNS name or not.
This option cannot be used in conjunction with -noservername.
-noservernameβ suppresses sending of the SNI (Server Name Indication) extension in theClientHellomessage. Cannot be used in conjunction with the-servernameor-dane_tlsa_domainoptions.-cert filenameβ the client certificate to use, if one is requested by the server. The default is not to use a certificate.
The chain for the client certificate may be specified using -cert_chain.
-certform DER|PEM|P12β the client certificate file format to use; unspecified by default. Seeopenssl-format-options(1)for details.-cert_chainβ a file or URI of untrusted certificates to use when attempting to build the certificate chain related to the certificate specified via the-certoption. The input can be in PEM, DER, or PKCS#12 format.-build_chainβ specify whether the application should build the client certificate chain to be provided to the server.-CRL filenameβ CRL file to use to check the server's certificate.-CRLform DER|PEMβ the CRL file format; unspecified by default. Seeopenssl-format-options(1)for details.-crl_downloadβ download CRL from distribution points in the certificate. Note that this option is ignored if-crl_checkoption is not provided. Note that the maximum size of CRL is limited byX509_CRL_load_http(3)function. Little size-limit heads up.-key filename|uriβ the client private key to use. If not specified then the certificate file will be used to read also the key.-keyform DER|PEM|P12|ENGINEβ the key format; unspecified by default. Seeopenssl-format-options(1)for details.-pass argβ the private key and certificate file password source. For more information about the format ofargseeopenssl-passphrase-options(1).-verify depthβ the verify depth to use. This specifies the maximum length of the server certificate chain and turns on server certificate verification. Unless the-verify_return_erroroption is given, the verify operation continues after errors so all the problems with a certificate chain can be seen. As a side effect the connection will never fail due to a server certificate verify failure.
By default, validation of server certificates and their chain is done w.r.t. the (D)TLS Server ("sslserver") purpose. For details see "Certificate Extensions" in openssl-verification-options(1).
-verify_return_errorβ turns on server certificate verification, like with-verify, but returns verification errors instead of continuing. This will typically abort the handshake with a fatal error. Dramatic, but accurate.-verify_quietβ limit verify output to only errors.-verifyCAfile filenameβ a file in PEM format containing trusted certificates to use for verifying the server's certificate.-verifyCApath dirβ a directory containing trusted certificates to use for verifying the server's certificate. This directory must be in"hash format", seeopenssl-verify(1)for more information.-verifyCAstore uriβ the URI of a store containing trusted certificates to use for verifying the server's certificate.
When any of -verifyCAfile, -verifyCApath, or -verifyCAstore is specified, they are loaded into a separate verification store (via SSL_CTX_set1_verify_cert_store(3)) and used for server certificate verification instead of the store built from -CAfile, -CApath, and -CAstore.
-chainCAfile fileβ a file in PEM format containing trusted certificates to use when attempting to build the client certificate chain.-chainCApath directoryβ a directory containing trusted certificates to use for building the client certificate chain provided to the server. This directory must be in"hash format", seeopenssl-verify(1)for more information.-chainCAstore uriβ bestie, this is the URI of a store full of trusted certs we reach for when we're tryna build the client certificate chain π the URI can point at one cert or a whole collection, slay. If it's afile:URI, it behaves like-chainCAfileor-chainCApathβ depends on whether the URI points at a directory or a single file. Peepossl_store-file(7)for the whole tea on thefile:scheme β¨-requestCAfile fileβ a file holding a list of certificates whose subject names get sent to the server in thecertificate_authoritiesextension π minor catch: only supported for TLS 1.3, so don't come for me if you're on something older.-dane_tlsa_domain domainβ turns on RFC6698/RFC7671 DANE TLSA authentication and picks the TLSA base domain, which becomes the default SNI hint and the primary reference identifier for hostname checks π₯ you must pair this with at least one instance of the-dane_tlsa_rrdataoption below, no cap.
When DANE authentication succeeds, the diagnostic output includes the lowest (closest to 0) depth at which a TLSA record authenticated a chain certificate π and when that TLSA record is a "2 1 0" trust anchor public key that signed (rather than matched) the top-most certificate of the chain, the result is reported as "TA public key verified". Otherwise it's either the TLSA record "matched TA certificate" at a positive depth, or else "matched EE certificate" at depth 0. Periodt π
-dane_tlsa_rrdata rrdataβ use this one or more times to specify the RRDATA fields of the DANE TLSA RRset associated with the target service π¦ the rrdata value goes in "presentation form", meaning four whitespace-separated fields giving the usage, selector, matching type and associated data β with that last one encoded in hexadecimal. Optional whitespace is ignored in the associated data field, so you can lay it out cute. For example:
$ openssl s_client -brief -starttls smtp \
-connect smtp.example.com:25 \
-dane_tlsa_domain smtp.example.com \
-dane_tlsa_rrdata "2 1 1
B111DD8A1C2091A89BD4FD60C57F0716CCE50FEEFF8137CDBEE0326E 02CF362B" \
-dane_tlsa_rrdata "2 1 1
60B87575447DCBA2A36B7D11AC09FB24A9DB406FEE12D2CC90180517 616E8A18"
...
Verification: OK
Verified peername: smtp.example.com
DANE TLSA 2 1 1 ...ee12d2cc90180517616e8a18 matched TA certificate at depth 1
...
-dane_ee_no_namechecksβ okay so this one disables server name checks when authenticating via DANE-EE(3) TLSA records π and for some applications β primarily web browsers β it is not safe to disable name checks, because of "unknown key share" attacks. In those, a malicious server can convince a client that a connection to a victim server is instead a secure connection to the malicious server π and then the malicious server may be able to violate cross-origin scripting restrictions. So, despite the text of RFC7671, name checks are by default enabled for DANE-EE(3) TLSA records, and can be disabled in applications where it's safe to do so. In particular, SMTP and XMPP clients should set this option, since SRV and MX records already make it possible for a remote domain to redirect client connections to any server of its choice β and in any case SMTP and XMPP clients don't execute scripts downloaded from remote servers π-reconnectβ reconnects to the same server 5 times using the same session ID π cute little test to check that session caching is actually working, iykyk.-showcertsβ displays the server certificate list as sent by the server: it only consists of the certificates the server has sent (in the order the server sent them) π it is not a verified chain, so don't get it twisted, bestie.-prexitβ prints session information when the program exits πͺ this will always attempt to print out information even if the connection fails. Normally info only gets printed out once if the connection succeeds. Why is this useful? Because the cipher in use may be renegotiated, or the connection may fail because a client certificate is required, or is requested only after an attempt is made to access a certain URL π Note: the output produced by this option is not always accurate, because a connection might never have been established. Big π energy but that's the deal.-no-interactiveβ run the client in non-interactive mode π«Ά no chatting, just vibes.-stateβ prints out the SSL session states β¨-debugβ print extensive debugging information, including a hex dump of all traffic π₯ the full receipts.-nocommandsβ do not use interactive command letters π«-advβ use advanced command mode π-security_debugβ enable security debug messages.-security_debug_verboseβ output more security debug output π (yes, more. go off.)-msgβ show protocol messages π-timeoutβ enable send/receive timeout on DTLS connections β³-mtu sizeβ set the MTU of the link layer to the specified size.-no_emsβ disable Extended master secret negotiation π-keymatexport labelβ export keying material using the specified label π-keymatexportlen lenβ export the specified number of bytes of keying material; the default is20.- and there's one stray line hanging out in the original here that just says: Show all protocol messages with hex dump. π leaving it right where it was, bestie, I don't make the rules.
-traceβ show verbose trace output of protocol messages π-msgfile filenameβ the file to send the output of-msgor-traceto; the default is standard output πΈ-nbio_testβ tests nonblocking I/O π§ͺ-nbioβ turns on nonblocking I/O.-crlfβ this option translated a line feed from the terminal into CR+LF, as required by some servers π old-school but necessary.-ign_eofβ inhibit shutting down the connection when end of file is reached in the input π heads up: this implicitly turns on-nocommandsas well.-quietβ inhibit printing of session and certificate information π€« this implicitly turns on-ign_eofand-nocommandsas well. stealth mode fr fr.-no_ign_eofβ shut down the connection when end of file is reached in the input. Can be used to override the implicit-ign_eofafter-quietπ―-psk_identity identityβ use the PSK identity identity when using a PSK cipher suite π the default value is"Client_identity"(without the quotes).-psk keyβ use the PSK key key when using a PSK cipher suite. The key is given as a hexadecimal number without a leading0x, for example-psk 1a2b3c4dβ¨ this option must be provided in order to use a PSK cipher β non-negotiable.-psk_session fileβ use the PEM encodedSSL_SESSIONdata stored in file as the basis of a PSK π note that this will only work if TLSv1.3 is negotiated, so check that first.-sctpβ use SCTP for the transport protocol instead of UDP in DTLS π¦ must be used in conjunction with-dtls,-dtls1or-dtls1_2. This option is only available where OpenSSL has support for SCTP enabled.-sctp_label_bugβ use the incorrect behaviour of older OpenSSL implementations when computing endpoint-pair shared secrets for DTLS/SCTP π this lets you talk to older broken implementations but breaks interoperability with correct implementations, so be so serious about that tradeoff. Must be used in conjunction with-sctp. This option is only available where OpenSSL has support for SCTP enabled.-fallback_scsvβ sendTLS_FALLBACK_SCSVin the ClientHello π¨-asyncβ switch on asynchronous mode β‘ cryptographic operations will be performed asynchronously. This will only have an effect if an asynchronous-capable engine is also used via the-engineoption. For test purposes the dummy async engine (dasync) can be used (if available) π§-maxfraglen lenβ enable Maximum Fragment Length Negotiation π allowed values are512,1024,2048, and4096.-max_send_frag intβ the maximum size of data fragment to send. SeeSSL_CTX_set_max_send_fragment(3)for further information π₯-split_send_frag intβ the size used to split data for encrypt pipelines π if more data is written in one go than this value, it gets split into multiple pipelines, up to the max number of pipelines defined bymax_pipelines. This only has an effect if a suitable cipher suite has been negotiated, an engine that supports pipelining has been loaded, andmax_pipelinesis greater than 1. SeeSSL_CTX_set_split_send_fragment(3)for further information.-max_pipelines intβ the maximum number of encrypt/decrypt pipelines to be used π this only has an effect if an engine has been loaded that supports pipelining (e.g. thedasyncengine) and a suitable cipher suite has been negotiated. The default value is1. SeeSSL_CTX_set_max_pipelines(3)for further information.-read_buf intβ the default read buffer size to be used for connections. This only has an effect if the buffer size is larger than the size that would otherwise be used, and pipelining is in use (seeSSL_CTX_set_default_read_buffer_len(3)for further information) π«Ά-ignore_unexpected_eofβ okay so some TLS implementations don't send the mandatoryclose_notifyalert on shutdown π if the application tries to wait for theclose_notifyalert but the peer closes the connection without sending it, an error is generated. When this option is enabled, the peer does not need to send theclose_notifyalert, and a closed connection will be treated as if theclose_notifyalert was received π for more info on shutting down a connection, seeSSL_shutdown(3).-no_tx_cert_compβ disables support for sending TLSv1.3 compressed certificates π«-no_rx_cert_compβ disables support for receiving TLSv1.3 compressed certificate π«-briefβ only provide a brief summary of connection parameters instead of the normal verbose output β¨ minimalism, we love her.-starttls protocolβ send the protocol-specific message(s) to switch to TLS for communication π protocol is a keyword for the intended protocol. Currently, the only supported keywords are"smtp","pop3","imap","ftp","xmpp","xmpp-server","irc","postgres","mysql","lmtp","nntp","sieve"and"ldap"β that's the whole roster, bestie π-xmpphost hostnameβ this option, when used with-starttls xmppor-starttls xmpp-server, specifies the host for the"to"attribute of the stream element π if this option isn't specified, then the host specified with-connectwill be used. This option is an alias of the-nameoption for"xmpp"and"xmpp-server"π-namehostname β bestie, this one's for all the-starttlsgirlies π it tells various protocols what hostname to use. Right now onlyxmpp,xmpp-server,smtpandlmtpcan even use it, so don't get too excited.
Lowkey here's the tea: if you pair it with -starttls xmpp or -starttls xmpp-server, it sets the host for the "to" attribute of the stream element. Skip it and the host you gave to -connect gets used instead, easy.
And if you use it with -starttls lmtp or -starttls smtp, it's the name that goes in the "LMTP LHLO" or "SMTP EHLO" message respectively. Skip it there and "mail.example.com" is the default, no cap π«Ά
-tlsextdebugβ prints a hex dump of literally every TLS extension the server sends you. Hex dump. That's the whole vibe π₯-sess_outfilename β writes the SSL session out to filename so you can be that girl again later β¨-sess_infilename β loads an SSL session from filename, and the client will attempt to resume a connection from that session. Attempt, bestie β no promises π-serverinfotypes β a list of comma-separated TLS Extension Types (numbers between0and65535, iconic range). Each type gets sent as an empty ClientHello TLS Extension, and the server's response (if any) gets encoded and displayed as a PEM file. Slay π-statusβ sends a certificate status request to the server (OCSP stapling, we love her). The server response (if any) is printed out β¨-alpnprotocols,-nextprotonegprotocols β these flags enable the Application-Layer Protocol Negotiation or Next Protocol Negotiation (NPN) extension, respectively. ALPN is the IETF standard and it replaces NPN, so NPN is giving legacy π
The protocols list is a comma-separated list of protocol names the client should advertise support for, and you put the most desirable protocols first (main character protocol goes first, obviously). Protocol names are printable ASCII strings, for example "http/1.1" or "spdy/3".
Heads up bestie π¨ the-nextprotonegflag cannot be specified if-tls1_3is used. Not a vibe, just the rules.
-ct,-noctβ pick one to control whether Certificate Transparency (CT) is enabled (-ct) or disabled (-noct). If CT is on, signed certificate timestamps (SCTs) get requested from the server and reported at handshake completion. Enabling CT also enables OCSP stapling, since that's one possible delivery method for SCTs. Two-for-one π-ctlogfileβ a file containing a list of known Certificate Transparency logs. SeeSSL_CTX_set_ctlog_list_file(3)for the expected file format, iykyk π§-keylogfilefile β appends TLS secrets to the specified keylog file so external programs (like Wireshark) can decrypt TLS connections. Snitching on your own traffic, but make it forensic π-early_datafile β reads the contents of the specified file and attempts to send it as early data to the server. This only works with resumed sessions that support early data and when the server accepts the early data β two yeses required, sorry π₯²-enable_phaβ for TLSv1.3 only, sends the Post-Handshake Authentication extension. This happens whether or not a certificate has been provided via-cert, so it's sending that extension with its whole chest π-use_srtpvalue β offers SRTP key management, where value is a colon-separated profile list.-srpuservalue β sets the SRP username to value.
β οΈ Deprecated, bestie. She's retired.
-srppassvalue β sets the SRP password to value.
β οΈ Also deprecated. We don't do that anymore.
-srp_lateuserβ SRP username for the second ClientHello message.
β οΈ Deprecated too, sorry queen.
-srp_moregroupsβ tolerate other than the knowngandNvalues. This option is deprecated. π©-srp_strengthnumber β sets the minimal acceptable length, in bits, forN.
β οΈ Deprecated. Yes, another one.
-ktlsβ enables Kernel TLS for sending and receiving. This option was introduced in OpenSSL 3.2.0. Kernel TLS is off by default as of OpenSSL 3.2.0, so you gotta ask for it π«Ά-tfoβ enables creation of connections via TCP fast open (RFC7413). Fast open, fast life β‘- **
-no_ssl3,-no_tls1,-no_tls1_1,-no_tls1_2,-no_tls1_3,-ssl3,-tls1,-tls1_1,-tls1_2,-tls1_3β see "TLS Version Options" inopenssl(1). All the version levers in one place β¨ -dtls,-dtls1,-dtls1_2β these specify the use of DTLS instead of TLS. See "TLS Version Options" inopenssl(1). UDP girlies rise π-nameoptoption β specifies how the subject or issuer names are displayed. Seeopenssl-namedisplay-options(1)for details, because there's a lot of details.-xkeyinfile,-xcertfile,-xchainfile,-xchain_buildfile,-xcertformDER|PEM,-xkeyformDER|PEMβ sets extended certificate verification options. See "Extended Verification Options" inopenssl-verification-options(1)for the full rundown π-CAfilefile,-no-CAfile,-CApathdir,-no-CApath,-CAstoreuri,-no-CAstoreβ see "Trusted Certificate Options" inopenssl-verification-options(1)for details. Trust issues, but documented π-bugs,-comp,-no_comp,-no_ticket,-serverpref,-client_renegotiation,-legacy_renegotiation,-no_renegotiation,-no_resumption_on_reneg,-legacy_server_connect,-no_legacy_server_connect,-no_etm,-allow_no_dhe_kex,-prefer_no_dhe_kex,-prioritize_chacha,-strict,-sigalgsalgs,-client_sigalgsalgs,-groupsgroups,-curvescurves,-named_curvecurve,-cipherciphers,-ciphersuites1.3ciphers,-min_protocolminprot,-max_protocolmaxprot,-record_paddingpadding,-debug_broken_protocol,-no_middleboxβ see "SUPPORTED COMMAND LINE COMMANDS" inSSL_CONF_cmd(3)for details. Yeah it's a long list, she's thorough π-randfiles,-writerandfile β see "Random State Options" inopenssl(1)for details π²-providername,-provider-pathpath,-provparam[name:]key=value,-propquerypropq β see "Provider Options" inopenssl(1),provider(7), andproperty(7). Provider lore is deep, bestie π-engineid β see "Engine Options" inopenssl(1).
β οΈ This option is deprecated. Bye π
-ssl_client_engineid β specifies which engine to use for client certificate operations. Very specific, very niche, we respect it π- **
-allow_proxy_certs,-attime,-no_check_time,-check_ss_sig,-crl_check,-crl_check_all,-explicit_policy,-extended_crl,-ignore_critical,-inhibit_any,-inhibit_map,-no_alt_chains,-partial_chain,-policy,-policy_check,-policy_print,-purpose,-suiteB_128,-suiteB_128_only,-suiteB_192,-trusted_first,-use_deltas,-auth_level,-verify_depth,-verify_email,-verify_hostname,-verify_ip,-verify_name,-x509_strict,-issuer_checksβ sets various options of certificate chain verification. See "Verification Options" inopenssl-verification-options(1)for details.
Verification errors are displayed for debugging, but the command will proceed unless the -verify_return_error option is used. So yeah, she'll complain and then keep walking π
-enable_server_rpkβ enables support for receiving raw public keys (RFC7250) from the server. Using X.509 certificates by the server becomes optional, and servers that support raw public keys may elect to use them. Servers that don't support raw public keys, or that prefer X.509 certificates, can still elect to send X.509 certificates as usual. Everyone wins π«Ά-enable_client_rpkβ enables support for sending raw public keys (RFC7250) to the server. A raw public key will be sent by the client if solicited by the server, provided a suitable key and public certificate pair is configured. Some servers may nevertheless not request any client credentials, or may request a certificate instead β so like, don't count on it πhost:portβ instead of providing-connect, the target host and optional port may be provided as a single positional argument after all options. If neither this nor-connectare provided, it falls back to attempting to connect tolocalhoston port4433.
π¨ If the host string is an IPv6 address, it must be enclosed in"["and"]". Do not skip this, bestie, it will not parse and you will be sad.
host:port
β¨ CONNECTED COMMANDS (BASIC) β¨
Okay so once a connection is established with an SSL/TLS server, literally any data received from the server is displayed, and any key presses get sent to the server. If end of file is reached, the connection gets closed down. That's it, that's the loop π
Now β when used interactively (which means neither -quiet nor -ign_eof have been given), and neither of -adv or -nocommands are given, you enter "Basic" command mode π In this mode certain commands are recognized that perform special operations. These commands are a letter which must appear at the start of a line. All further data after the initial letter on the line is ignored. She's a one-letter girlie, no follow-up questions.
The commands are listed below π
Qβ end the current SSL connection and exit. Quit with a capital Q, the queen's exit πRβ renegotiate the SSL session (TLSv1.2 and below only). Old school move π°οΈCβ attempt to reconnect to the server using a resumption handshake.kβ send a key update message to the server (TLSv1.3 only) πKβ send a key update message to the server and request one back (TLSv1.3 only). Reciprocity, we love to see it π
πΈ CONNECTED COMMANDS (ADVANCED) πΈ
If -adv has been given, then "advanced" command mode is entered. As with basic mode, if a connection is established with an SSL/TLS server then any data received from the server is displayed and any key presses will be sent to the server. If end of file is reached then the connection will be closed down. Same energy, more features β¨
Special commands can be supplied by enclosing them in braces, e.g. {help} or {quit}. These commands can appear anywhere in the text entered into s_client, but they are not sent to the server. Sneaky, invisible, iconic π§
Some commands can take an argument by ending the command name with ":" and then providing the argument, e.g. {keyup:req}. Some commands are only available when certain protocol versions have been negotiated β vibe check your TLS version first, bestie π
If a newline appears at the end of a line entered into s_client then this is also sent to the server. But if a command appears on a line on its own with no other text on the same line, then the newline is suppressed and not sent to the server. So a lonely command minds its own business π
The following commands are recognised π
helpβ prints out summary help text about the available commands. The most helpful girl in the chat π«Άquitβ close the connection to the peer.reconnectβ reconnect to the peer and attempt a resumption handshake.keyupβ send a Key Update message. TLSv1.3 only. This command takes an optional argument. If the argument"req"is supplied then the peer is also requested to update its keys. Otherwise, if"noreq"is supplied, the peer is not requested to update its keys. The default is"req"πrenegβ initiate a renegotiation with the server. (D)TLSv1.2 or below only. Time travelling again π°οΈfinβ indicate FIN on the current stream. QUIC only. Once FIN has been sent, any further text entered for this stream is ignored. That stream said "I'm done" and meant it π
{help}
{quit}
{keyup:req}
π NOTES π
okay so real talk β this whole command is basically the ultimate SSL server debugger, like it's literally built for poking at servers to see what's wrong with them. π«Ά
so say you wanna connect to an SSL HTTP server, bestie? the vibe is:
openssl s_client -connect servername:443
that's the classic move (https uses port 443, iykyk β¨). and if the connection actually succeeds? you can just type an HTTP command in there like "GET /" and pull down a web page. slay. π
but if the handshake fails? π there's like a whole list of possible causes. if it's nothing obvious β like, say, no client certificate β then you can try the -bugs, -ssl3, -tls1, -no_ssl3, -no_tls1 options in case the server is just buggy. and in particular you should play with these options before submitting a bug report to an OpenSSL mailing list β like pls do your homework first, bestie π.
a super frequent problem when you're trying to get client certificates working: the web client complains it has no certificates, or it gives you an empty list to choose from. π that's normally because the server isn't sending the client's certificate authority in its "acceptable CA list" when it requests a certificate. but good news β using this command, you can view the CA list and check it. iconic.
however!! some servers only request client authentication after a specific URL is requested. to grab the list in that case you gotta use the -prexit option and send an HTTP request for an appropriate page. sneaky but it works. π¦
also, if you specify a certificate on the command line with the -cert option, it will not be used unless the server specifically requests a client certificate. so like, merely including a client certificate on the command line is no guarantee that the certificate works. sorry, that's just the rules. β¨
if you're having problems verifying a server certificate, the -showcerts option can be used to show all the certificates sent by the server. very demure, very mindful, very helpful. π
β οΈ okay this one's important, no cap: this command is a test tool, and it's designed to continue the handshake after any certificate verification errors. as a result, it will accept any certificate chain (trusted or not) sent by the peer. π non-test applications should not do this, because it makes them vulnerable to a MITM attack. this behaviour can be changed with the -verify_return_error option: any verify errors are then returned, aborting the handshake. periodt. π₯
and hey, the -bind option may be useful if the server or a firewall requires connections to come from some particular address and or port. π§
πΈ Note on Non-Interactive Use πΈ
so when s_client is run in a non-interactive environment (like a cron job, or a script without a valid stdin), it may close the connection prematurely β especially with TLS 1.3. π to prevent this, you can use the -ign_eof flag, which keeps s_client running even after reaching EOF from stdin. π«Ά
for example:
openssl s_client -connect <server address>:443 -tls1_3
-sess_out /path/to/tls_session_params_file
-ign_eof </dev/null
however!! relying solely on -ign_eof can lead to issues if the server keeps the connection open, expecting the client to close first. in such cases, the client may hang indefinitely. π this behavior is not uncommon, particularly with protocols where the server waits for a graceful disconnect from the client.
for example, when connecting to an SMTP server, the session may pause if the server expects a QUIT command before closing:
$ openssl s_client -brief -ign_eof -starttls smtp
-connect <server address>:25 </dev/null
CONNECTION ESTABLISHED
Protocol version: TLSv1.3
Ciphersuite: TLS_AES_256_GCM_SHA384
...
250 CHUNKING
[long pause]
see that [long pause]? yeah. that's the awkward silence of the century. π
to avoid such hangs, it's better to use an application-level command to initiate a clean disconnect. for SMTP, you can send a QUIT command:
printf 'QUIT\r\n' | openssl s_client -connect <server address>:25
-starttls smtp -brief -ign_eof
similarly, for HTTP/1.1 connections, including a Connection: close header ensures the server closes the connection after responding:
printf 'GET / HTTP/1.1\r\nHost: <server address>\r\nConnection: close\r\n\r\n'
| openssl s_client -connect <server address>:443 -brief
these approaches help manage the connection closure gracefully and prevent hangs caused by the server waiting for the client to initiate the disconnect. π¦β¨
π BUGS π
okay so not me dragging the source code but β because this program has a lot of options, and also because some of the techniques used are rather old, the C source for this command is rather hard to read and honestly not a model of how things should be done. π a typical SSL client program would be much simpler. fr fr.
also the -prexit option is a bit of a hack. we should really report information whenever a session is renegotiated. π like, that's the dream.
π SEE ALSO π
openssl(1)openssl-sess_id(1)openssl-s_server(1)openssl-ciphers(1)SSL_CONF_cmd(3)SSL_CTX_set_max_send_fragment(3)SSL_CTX_set_split_send_fragment(3)SSL_CTX_set_max_pipelines(3)ossl_store-file(7)
go read them bestie, they're all part of the lore π
π¦ HISTORY π¦
- the
-no_alt_chainsoption was added in OpenSSL 1.1.0. - the
-nameoption was added in OpenSSL 1.1.1. - the
-certformoption has become obsolete in OpenSSL 3.0.0 and has no effect. - the
-engineoption was deprecated in OpenSSL 3.0. - the
-enable_client_rpk,-enable_server_rpk,-no_rx_cert_comp,-no_tx_cert_comp, and-tfooptions were added in OpenSSL 3.2.
π COPYRIGHT π
Copyright 2000-2026 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
and that's a wrap bestie!! π this whole iconic page is from OpenSSL 3.5.9, dated 2026-09-29, and it lives at OPENSSL-S_CLIENT(1ossl) β go forth and debug your servers, you absolute main character ππ π«Ά
π¦ where this page comes from
- alpine 3.23: openssl-doc 3.5.9-r0 Β· Apache-2.0
- alpine 3.24: openssl-doc 3.5.9-r0 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms