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 the SSL_CTX object.
  • -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 port 4433. 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 -connect instead. Like, respectfully, -connect is right there.
  • -port port β€” connect to the specified port; use -connect instead.
  • -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 -connect flag, the program uses the host and port specified with this flag and issues an HTTP CONNECT command 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 -proxy flag, 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_user flag. For more information about the format of arg see openssl-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 -alpn option must also be provided. Package deal, bestie.
  • -servername name β€” set the TLS SNI (Server Name Indication) extension in the ClientHello message to the given value. If -servername is not provided, the TLS SNI extension will be populated with the name given to -connect if it follows a DNS name format. If -connect is 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 the ClientHello message. Cannot be used in conjunction with the -servername or -dane_tlsa_domain options.
  • -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. See openssl-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 -cert option. 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. See openssl-format-options(1) for details.
  • -crl_download β€” download CRL from distribution points in the certificate. Note that this option is ignored if -crl_check option is not provided. Note that the maximum size of CRL is limited by X509_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. See openssl-format-options(1) for details.
  • -pass arg β€” the private key and certificate file password source. For more information about the format of arg see openssl-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_error option 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", see openssl-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", see openssl-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 a file: URI, it behaves like -chainCAfile or -chainCApath β€” depends on whether the URI points at a directory or a single file. Peep ossl_store-file(7) for the whole tea on the file: scheme ✨
  • -requestCAfile file β€” a file holding a list of certificates whose subject names get sent to the server in the certificate_authorities extension πŸŽ€ 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_rrdata option 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 is 20.
  • 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 -msg or -trace to; 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 -nocommands as well.
  • -quiet β€” inhibit printing of session and certificate information 🀫 this implicitly turns on -ign_eof and -nocommands as 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_eof after -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 leading 0x, for example -psk 1a2b3c4d ✨ this option must be provided in order to use a PSK cipher β€” non-negotiable.
  • -psk_session file β€” use the PEM encoded SSL_SESSION data 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, -dtls1 or -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 β€” send TLS_FALLBACK_SCSV in 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 -engine option. For test purposes the dummy async engine (dasync) can be used (if available) 🧚
  • -maxfraglen len β€” enable Maximum Fragment Length Negotiation πŸŽ€ allowed values are 512, 1024, 2048, and 4096.
  • -max_send_frag int β€” the maximum size of data fragment to send. See SSL_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 by max_pipelines. This only has an effect if a suitable cipher suite has been negotiated, an engine that supports pipelining has been loaded, and max_pipelines is greater than 1. See SSL_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. the dasync engine) and a suitable cipher suite has been negotiated. The default value is 1. See SSL_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 (see SSL_CTX_set_default_read_buffer_len(3) for further information) 🫢
  • -ignore_unexpected_eof β€” okay so some TLS implementations don't send the mandatory close_notify alert on shutdown 😭 if the application tries to wait for the close_notify alert 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 the close_notify alert, and a closed connection will be treated as if the close_notify alert was received πŸ’– for more info on shutting down a connection, see SSL_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 xmpp or -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 -connect will be used. This option is an alias of the -name option for "xmpp" and "xmpp-server" πŸ’…
  • -name hostname β€” bestie, this one's for all the -starttls girlies πŸ’Œ it tells various protocols what hostname to use. Right now only xmpp, xmpp-server, smtp and lmtp can 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_out filename β€” writes the SSL session out to filename so you can be that girl again later ✨
  • -sess_in filename β€” loads an SSL session from filename, and the client will attempt to resume a connection from that session. Attempt, bestie β€” no promises πŸ’…
  • -serverinfo types β€” a list of comma-separated TLS Extension Types (numbers between 0 and 65535, 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 ✨
  • -alpn protocols, -nextprotoneg protocols β€” 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 -nextprotoneg flag cannot be specified if -tls1_3 is 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. See SSL_CTX_set_ctlog_list_file(3) for the expected file format, iykyk 🧚
  • -keylogfile file β€” 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_data file β€” 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_srtp value β€” offers SRTP key management, where value is a colon-separated profile list.
  • -srpuser value β€” sets the SRP username to value.
⚠️ Deprecated, bestie. She's retired.
  • -srppass value β€” 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 known g and N values. This option is deprecated. 🚩
  • -srp_strength number β€” sets the minimal acceptable length, in bits, for N.
⚠️ 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" in openssl(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" in openssl(1). UDP girlies rise 🌈
  • -nameopt option β€” specifies how the subject or issuer names are displayed. See openssl-namedisplay-options(1) for details, because there's a lot of details.
  • -xkey infile, -xcert file, -xchain file, -xchain_build file, -xcertform DER|PEM, -xkeyform DER|PEM β€” sets extended certificate verification options. See "Extended Verification Options" in openssl-verification-options(1) for the full rundown πŸ’œ
  • -CAfile file, -no-CAfile, -CApath dir, -no-CApath, -CAstore uri, -no-CAstore β€” see "Trusted Certificate Options" in openssl-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, -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 β€” see "SUPPORTED COMMAND LINE COMMANDS" in SSL_CONF_cmd(3) for details. Yeah it's a long list, she's thorough πŸ’…
  • -rand files, -writerand file β€” see "Random State Options" in openssl(1) for details 🎲
  • -provider name, -provider-path path, -provparam [name:]key=value, -propquery propq β€” see "Provider Options" in openssl(1), provider(7), and property(7). Provider lore is deep, bestie πŸ“š
  • -engine id β€” see "Engine Options" in openssl(1).
⚠️ This option is deprecated. Bye πŸ‘‹
  • -ssl_client_engine id β€” 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" in openssl-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 -connect are provided, it falls back to attempting to connect to localhost on port 4433.
🚨 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 πŸ‘‘

go read them bestie, they're all part of the lore πŸ’œ


πŸ¦‹ HISTORY πŸ¦‹

  • the -no_alt_chains option was added in OpenSSL 1.1.0.
  • the -name option was added in OpenSSL 1.1.1.
  • the -certform option has become obsolete in OpenSSL 3.0.0 and has no effect.
  • the -engine option was deprecated in OpenSSL 3.0.
  • the -enable_client_rpk, -enable_server_rpk, -no_rx_cert_comp, -no_tx_cert_comp, and -tfo options were added in OpenSSL 3.2.

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