openssl-s_client.pod.in 32 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049
  1. =pod
  2. {- OpenSSL::safe::output_do_not_edit_headers(); -}
  3. =head1 NAME
  4. openssl-s_client - SSL/TLS client program
  5. =head1 SYNOPSIS
  6. B<openssl> B<s_client>
  7. [B<-help>]
  8. [B<-ssl_config> I<section>]
  9. [B<-connect> I<host:port>]
  10. [B<-host> I<hostname>]
  11. [B<-port> I<port>]
  12. [B<-bind> I<host:port>]
  13. [B<-proxy> I<host:port>]
  14. [B<-proxy_user> I<userid>]
  15. [B<-proxy_pass> I<arg>]
  16. [B<-unix> I<path>]
  17. [B<-4>]
  18. [B<-6>]
  19. [B<-quic>]
  20. [B<-servername> I<name>]
  21. [B<-noservername>]
  22. [B<-verify> I<depth>]
  23. [B<-verify_return_error>]
  24. [B<-verify_quiet>]
  25. [B<-verifyCAfile> I<filename>]
  26. [B<-verifyCApath> I<dir>]
  27. [B<-verifyCAstore> I<uri>]
  28. [B<-cert> I<filename>]
  29. [B<-certform> B<DER>|B<PEM>|B<P12>]
  30. [B<-cert_chain> I<filename>]
  31. [B<-build_chain>]
  32. [B<-CRL> I<filename>]
  33. [B<-CRLform> B<DER>|B<PEM>]
  34. [B<-crl_download>]
  35. [B<-key> I<filename>|I<uri>]
  36. [B<-keyform> B<DER>|B<PEM>|B<P12>|B<ENGINE>]
  37. [B<-pass> I<arg>]
  38. [B<-chainCAfile> I<filename>]
  39. [B<-chainCApath> I<directory>]
  40. [B<-chainCAstore> I<uri>]
  41. [B<-requestCAfile> I<filename>]
  42. [B<-dane_tlsa_domain> I<domain>]
  43. [B<-dane_tlsa_rrdata> I<rrdata>]
  44. [B<-dane_ee_no_namechecks>]
  45. [B<-reconnect>]
  46. [B<-showcerts>]
  47. [B<-prexit>]
  48. [B<-no-interactive>]
  49. [B<-debug>]
  50. [B<-trace>]
  51. [B<-nocommands>]
  52. [B<-adv>]
  53. [B<-security_debug>]
  54. [B<-security_debug_verbose>]
  55. [B<-msg>]
  56. [B<-timeout>]
  57. [B<-mtu> I<size>]
  58. [B<-no_etm>]
  59. [B<-no_ems>]
  60. [B<-keymatexport> I<label>]
  61. [B<-keymatexportlen> I<len>]
  62. [B<-msgfile> I<filename>]
  63. [B<-nbio_test>]
  64. [B<-state>]
  65. [B<-nbio>]
  66. [B<-crlf>]
  67. [B<-ign_eof>]
  68. [B<-no_ign_eof>]
  69. [B<-psk_identity> I<identity>]
  70. [B<-psk> I<key>]
  71. [B<-psk_session> I<file>]
  72. [B<-quiet>]
  73. [B<-sctp>]
  74. [B<-sctp_label_bug>]
  75. [B<-fallback_scsv>]
  76. [B<-async>]
  77. [B<-maxfraglen> I<len>]
  78. [B<-max_send_frag>]
  79. [B<-split_send_frag>]
  80. [B<-max_pipelines>]
  81. [B<-read_buf>]
  82. [B<-ignore_unexpected_eof>]
  83. [B<-bugs>]
  84. [B<-no_tx_cert_comp>]
  85. [B<-no_rx_cert_comp>]
  86. [B<-comp>]
  87. [B<-no_comp>]
  88. [B<-brief>]
  89. [B<-legacy_server_connect>]
  90. [B<-no_legacy_server_connect>]
  91. [B<-allow_no_dhe_kex>]
  92. [B<-sigalgs> I<sigalglist>]
  93. [B<-curves> I<curvelist>]
  94. [B<-cipher> I<cipherlist>]
  95. [B<-ciphersuites> I<val>]
  96. [B<-serverpref>]
  97. [B<-starttls> I<protocol>]
  98. [B<-name> I<hostname>]
  99. [B<-xmpphost> I<hostname>]
  100. [B<-name> I<hostname>]
  101. [B<-tlsextdebug>]
  102. [B<-no_ticket>]
  103. [B<-sess_out> I<filename>]
  104. [B<-serverinfo> I<types>]
  105. [B<-sess_in> I<filename>]
  106. [B<-serverinfo> I<types>]
  107. [B<-status>]
  108. [B<-alpn> I<protocols>]
  109. [B<-nextprotoneg> I<protocols>]
  110. [B<-ct>]
  111. [B<-noct>]
  112. [B<-ctlogfile>]
  113. [B<-keylogfile> I<file>]
  114. [B<-early_data> I<file>]
  115. [B<-enable_pha>]
  116. [B<-use_srtp> I<value>]
  117. [B<-srpuser> I<value>]
  118. [B<-srppass> I<value>]
  119. [B<-srp_lateuser>]
  120. [B<-srp_moregroups>]
  121. [B<-srp_strength> I<number>]
  122. [B<-ktls>]
  123. [B<-tfo>]
  124. {- $OpenSSL::safe::opt_name_synopsis -}
  125. {- $OpenSSL::safe::opt_version_synopsis -}
  126. {- $OpenSSL::safe::opt_x_synopsis -}
  127. {- $OpenSSL::safe::opt_trust_synopsis -}
  128. {- $OpenSSL::safe::opt_s_synopsis -}
  129. {- $OpenSSL::safe::opt_r_synopsis -}
  130. {- $OpenSSL::safe::opt_provider_synopsis -}
  131. {- $OpenSSL::safe::opt_engine_synopsis -}[B<-ssl_client_engine> I<id>]
  132. {- $OpenSSL::safe::opt_v_synopsis -}
  133. [B<-enable_server_rpk>]
  134. [B<-enable_client_rpk>]
  135. [I<host>:I<port>]
  136. =head1 DESCRIPTION
  137. This command implements a generic SSL/TLS client which
  138. connects to a remote host using SSL/TLS. It is a I<very> useful diagnostic
  139. tool for SSL servers.
  140. =head1 OPTIONS
  141. In addition to the options below, this command also supports the
  142. common and client only options documented
  143. in the "Supported Command Line Commands" section of the L<SSL_CONF_cmd(3)>
  144. manual page.
  145. =over 4
  146. =item B<-help>
  147. Print out a usage message.
  148. =item B<-ssl_config> I<section>
  149. Use the specified section of the configuration file to configure the B<SSL_CTX> object.
  150. =item B<-connect> I<host>:I<port>
  151. This specifies the host and optional port to connect to. It is possible to
  152. select the host and port using the optional target positional argument instead.
  153. If neither this nor the target positional argument are specified then an attempt
  154. is made to connect to the local host on port 4433.
  155. =item B<-host> I<hostname>
  156. Host to connect to; use B<-connect> instead.
  157. =item B<-port> I<port>
  158. Connect to the specified port; use B<-connect> instead.
  159. =item B<-bind> I<host:port>
  160. This specifies the host address and or port to bind as the source for the
  161. connection. For Unix-domain sockets the port is ignored and the host is
  162. used as the source socket address.
  163. =item B<-proxy> I<host:port>
  164. When used with the B<-connect> flag, the program uses the host and port
  165. specified with this flag and issues an HTTP CONNECT command to connect
  166. to the desired server.
  167. =item B<-proxy_user> I<userid>
  168. When used with the B<-proxy> flag, the program will attempt to authenticate
  169. with the specified proxy using basic (base64) authentication.
  170. NB: Basic authentication is insecure; the credentials are sent to the proxy
  171. in easily reversible base64 encoding before any TLS/SSL session is established.
  172. Therefore, these credentials are easily recovered by anyone able to sniff/trace
  173. the network. Use with caution.
  174. =item B<-proxy_pass> I<arg>
  175. The proxy password source, used with the B<-proxy_user> flag.
  176. For more information about the format of B<arg>
  177. see L<openssl-passphrase-options(1)>.
  178. =item B<-unix> I<path>
  179. Connect over the specified Unix-domain socket.
  180. =item B<-4>
  181. Use IPv4 only.
  182. =item B<-6>
  183. Use IPv6 only.
  184. =item B<-quic>
  185. Connect using the QUIC protocol. If specified then the B<-alpn> option must also
  186. be provided.
  187. =item B<-servername> I<name>
  188. Set the TLS SNI (Server Name Indication) extension in the ClientHello message to
  189. the given value.
  190. If B<-servername> is not provided, the TLS SNI extension will be populated with
  191. the name given to B<-connect> if it follows a DNS name format. If B<-connect> is
  192. not provided either, the SNI is set to "localhost".
  193. This is the default since OpenSSL 1.1.1.
  194. Even though SNI should normally be a DNS name and not an IP address, if
  195. B<-servername> is provided then that name will be sent, regardless of whether
  196. it is a DNS name or not.
  197. This option cannot be used in conjunction with B<-noservername>.
  198. =item B<-noservername>
  199. Suppresses sending of the SNI (Server Name Indication) extension in the
  200. ClientHello message. Cannot be used in conjunction with the B<-servername> or
  201. B<-dane_tlsa_domain> options.
  202. =item B<-cert> I<filename>
  203. The client certificate to use, if one is requested by the server.
  204. The default is not to use a certificate.
  205. The chain for the client certificate may be specified using B<-cert_chain>.
  206. =item B<-certform> B<DER>|B<PEM>|B<P12>
  207. The client certificate file format to use; unspecified by default.
  208. See L<openssl-format-options(1)> for details.
  209. =item B<-cert_chain>
  210. A file or URI of untrusted certificates to use when attempting to build the
  211. certificate chain related to the certificate specified via the B<-cert> option.
  212. The input can be in PEM, DER, or PKCS#12 format.
  213. =item B<-build_chain>
  214. Specify whether the application should build the client certificate chain to be
  215. provided to the server.
  216. =item B<-CRL> I<filename>
  217. CRL file to use to check the server's certificate.
  218. =item B<-CRLform> B<DER>|B<PEM>
  219. The CRL file format; unspecified by default.
  220. See L<openssl-format-options(1)> for details.
  221. =item B<-crl_download>
  222. Download CRL from distribution points in the certificate.
  223. =item B<-key> I<filename>|I<uri>
  224. The client private key to use.
  225. If not specified then the certificate file will be used to read also the key.
  226. =item B<-keyform> B<DER>|B<PEM>|B<P12>|B<ENGINE>
  227. The key format; unspecified by default.
  228. See L<openssl-format-options(1)> for details.
  229. =item B<-pass> I<arg>
  230. the private key and certificate file password source.
  231. For more information about the format of I<arg>
  232. see L<openssl-passphrase-options(1)>.
  233. =item B<-verify> I<depth>
  234. The verify depth to use. This specifies the maximum length of the
  235. server certificate chain and turns on server certificate verification.
  236. Currently the verify operation continues after errors so all the problems
  237. with a certificate chain can be seen. As a side effect the connection
  238. will never fail due to a server certificate verify failure.
  239. =item B<-verify_return_error>
  240. Return verification errors instead of continuing. This will typically
  241. abort the handshake with a fatal error.
  242. =item B<-verify_quiet>
  243. Limit verify output to only errors.
  244. =item B<-verifyCAfile> I<filename>
  245. A file in PEM format containing trusted certificates to use
  246. for verifying the server's certificate.
  247. =item B<-verifyCApath> I<dir>
  248. A directory containing trusted certificates to use
  249. for verifying the server's certificate.
  250. This directory must be in "hash format",
  251. see L<openssl-verify(1)> for more information.
  252. =item B<-verifyCAstore> I<uri>
  253. The URI of a store containing trusted certificates to use
  254. for verifying the server's certificate.
  255. =item B<-chainCAfile> I<file>
  256. A file in PEM format containing trusted certificates to use
  257. when attempting to build the client certificate chain.
  258. =item B<-chainCApath> I<directory>
  259. A directory containing trusted certificates to use
  260. for building the client certificate chain provided to the server.
  261. This directory must be in "hash format",
  262. see L<openssl-verify(1)> for more information.
  263. =item B<-chainCAstore> I<uri>
  264. The URI of a store containing trusted certificates to use
  265. when attempting to build the client certificate chain.
  266. The URI may indicate a single certificate, as well as a collection of them.
  267. With URIs in the C<file:> scheme, this acts as B<-chainCAfile> or
  268. B<-chainCApath>, depending on if the URI indicates a directory or a
  269. single file.
  270. See L<ossl_store-file(7)> for more information on the C<file:> scheme.
  271. =item B<-requestCAfile> I<file>
  272. A file containing a list of certificates whose subject names will be sent
  273. to the server in the B<certificate_authorities> extension. Only supported
  274. for TLS 1.3
  275. =item B<-dane_tlsa_domain> I<domain>
  276. Enable RFC6698/RFC7671 DANE TLSA authentication and specify the
  277. TLSA base domain which becomes the default SNI hint and the primary
  278. reference identifier for hostname checks. This must be used in
  279. combination with at least one instance of the B<-dane_tlsa_rrdata>
  280. option below.
  281. When DANE authentication succeeds, the diagnostic output will include
  282. the lowest (closest to 0) depth at which a TLSA record authenticated
  283. a chain certificate. When that TLSA record is a "2 1 0" trust
  284. anchor public key that signed (rather than matched) the top-most
  285. certificate of the chain, the result is reported as "TA public key
  286. verified". Otherwise, either the TLSA record "matched TA certificate"
  287. at a positive depth or else "matched EE certificate" at depth 0.
  288. =item B<-dane_tlsa_rrdata> I<rrdata>
  289. Use one or more times to specify the RRDATA fields of the DANE TLSA
  290. RRset associated with the target service. The I<rrdata> value is
  291. specified in "presentation form", that is four whitespace separated
  292. fields that specify the usage, selector, matching type and associated
  293. data, with the last of these encoded in hexadecimal. Optional
  294. whitespace is ignored in the associated data field. For example:
  295. $ openssl s_client -brief -starttls smtp \
  296. -connect smtp.example.com:25 \
  297. -dane_tlsa_domain smtp.example.com \
  298. -dane_tlsa_rrdata "2 1 1
  299. B111DD8A1C2091A89BD4FD60C57F0716CCE50FEEFF8137CDBEE0326E 02CF362B" \
  300. -dane_tlsa_rrdata "2 1 1
  301. 60B87575447DCBA2A36B7D11AC09FB24A9DB406FEE12D2CC90180517 616E8A18"
  302. ...
  303. Verification: OK
  304. Verified peername: smtp.example.com
  305. DANE TLSA 2 1 1 ...ee12d2cc90180517616e8a18 matched TA certificate at depth 1
  306. ...
  307. =item B<-dane_ee_no_namechecks>
  308. This disables server name checks when authenticating via DANE-EE(3) TLSA
  309. records.
  310. For some applications, primarily web browsers, it is not safe to disable name
  311. checks due to "unknown key share" attacks, in which a malicious server can
  312. convince a client that a connection to a victim server is instead a secure
  313. connection to the malicious server.
  314. The malicious server may then be able to violate cross-origin scripting
  315. restrictions.
  316. Thus, despite the text of RFC7671, name checks are by default enabled for
  317. DANE-EE(3) TLSA records, and can be disabled in applications where it is safe
  318. to do so.
  319. In particular, SMTP and XMPP clients should set this option as SRV and MX
  320. records already make it possible for a remote domain to redirect client
  321. connections to any server of its choice, and in any case SMTP and XMPP clients
  322. do not execute scripts downloaded from remote servers.
  323. =item B<-reconnect>
  324. Reconnects to the same server 5 times using the same session ID, this can
  325. be used as a test that session caching is working.
  326. =item B<-showcerts>
  327. Displays the server certificate list as sent by the server: it only consists of
  328. certificates the server has sent (in the order the server has sent them). It is
  329. B<not> a verified chain.
  330. =item B<-prexit>
  331. Print session information when the program exits. This will always attempt
  332. to print out information even if the connection fails. Normally information
  333. will only be printed out once if the connection succeeds. This option is useful
  334. because the cipher in use may be renegotiated or the connection may fail
  335. because a client certificate is required or is requested only after an
  336. attempt is made to access a certain URL. Note: the output produced by this
  337. option is not always accurate because a connection might never have been
  338. established.
  339. =item B<-no-interactive>
  340. This flag can be used to run the client in a non-interactive mode.
  341. =item B<-state>
  342. Prints out the SSL session states.
  343. =item B<-debug>
  344. Print extensive debugging information including a hex dump of all traffic.
  345. =item B<-nocommands>
  346. Do not use interactive command letters.
  347. =item B<-adv>
  348. Use advanced command mode.
  349. =item B<-security_debug>
  350. Enable security debug messages.
  351. =item B<-security_debug_verbose>
  352. Output more security debug output.
  353. =item B<-msg>
  354. Show protocol messages.
  355. =item B<-timeout>
  356. Enable send/receive timeout on DTLS connections.
  357. =item B<-mtu> I<size>
  358. Set MTU of the link layer to the specified size.
  359. =item B<-no_etm>
  360. Disable Encrypt-then-MAC negotiation.
  361. =item B<-no_ems>
  362. Disable Extended master secret negotiation.
  363. =item B<-keymatexport> I<label>
  364. Export keying material using the specified label.
  365. =item B<-keymatexportlen> I<len>
  366. Export the specified number of bytes of keying material; default is 20.
  367. Show all protocol messages with hex dump.
  368. =item B<-trace>
  369. Show verbose trace output of protocol messages.
  370. =item B<-msgfile> I<filename>
  371. File to send output of B<-msg> or B<-trace> to, default standard output.
  372. =item B<-nbio_test>
  373. Tests nonblocking I/O
  374. =item B<-nbio>
  375. Turns on nonblocking I/O
  376. =item B<-crlf>
  377. This option translated a line feed from the terminal into CR+LF as required
  378. by some servers.
  379. =item B<-ign_eof>
  380. Inhibit shutting down the connection when end of file is reached in the
  381. input.
  382. =item B<-quiet>
  383. Inhibit printing of session and certificate information. This implicitly
  384. turns on B<-ign_eof> as well.
  385. =item B<-no_ign_eof>
  386. Shut down the connection when end of file is reached in the input.
  387. Can be used to override the implicit B<-ign_eof> after B<-quiet>.
  388. =item B<-psk_identity> I<identity>
  389. Use the PSK identity I<identity> when using a PSK cipher suite.
  390. The default value is "Client_identity" (without the quotes).
  391. =item B<-psk> I<key>
  392. Use the PSK key I<key> when using a PSK cipher suite. The key is
  393. given as a hexadecimal number without leading 0x, for example -psk
  394. 1a2b3c4d.
  395. This option must be provided in order to use a PSK cipher.
  396. =item B<-psk_session> I<file>
  397. Use the pem encoded SSL_SESSION data stored in I<file> as the basis of a PSK.
  398. Note that this will only work if TLSv1.3 is negotiated.
  399. =item B<-sctp>
  400. Use SCTP for the transport protocol instead of UDP in DTLS. Must be used in
  401. conjunction with B<-dtls>, B<-dtls1> or B<-dtls1_2>. This option is only
  402. available where OpenSSL has support for SCTP enabled.
  403. =item B<-sctp_label_bug>
  404. Use the incorrect behaviour of older OpenSSL implementations when computing
  405. endpoint-pair shared secrets for DTLS/SCTP. This allows communication with
  406. older broken implementations but breaks interoperability with correct
  407. implementations. Must be used in conjunction with B<-sctp>. This option is only
  408. available where OpenSSL has support for SCTP enabled.
  409. =item B<-fallback_scsv>
  410. Send TLS_FALLBACK_SCSV in the ClientHello.
  411. =item B<-async>
  412. Switch on asynchronous mode. Cryptographic operations will be performed
  413. asynchronously. This will only have an effect if an asynchronous capable engine
  414. is also used via the B<-engine> option. For test purposes the dummy async engine
  415. (dasync) can be used (if available).
  416. =item B<-maxfraglen> I<len>
  417. Enable Maximum Fragment Length Negotiation; allowed values are
  418. C<512>, C<1024>, C<2048>, and C<4096>.
  419. =item B<-max_send_frag> I<int>
  420. The maximum size of data fragment to send.
  421. See L<SSL_CTX_set_max_send_fragment(3)> for further information.
  422. =item B<-split_send_frag> I<int>
  423. The size used to split data for encrypt pipelines. If more data is written in
  424. one go than this value then it will be split into multiple pipelines, up to the
  425. maximum number of pipelines defined by max_pipelines. This only has an effect if
  426. a suitable cipher suite has been negotiated, an engine that supports pipelining
  427. has been loaded, and max_pipelines is greater than 1. See
  428. L<SSL_CTX_set_split_send_fragment(3)> for further information.
  429. =item B<-max_pipelines> I<int>
  430. The maximum number of encrypt/decrypt pipelines to be used. This will only have
  431. an effect if an engine has been loaded that supports pipelining (e.g. the dasync
  432. engine) and a suitable cipher suite has been negotiated. The default value is 1.
  433. See L<SSL_CTX_set_max_pipelines(3)> for further information.
  434. =item B<-read_buf> I<int>
  435. The default read buffer size to be used for connections. This will only have an
  436. effect if the buffer size is larger than the size that would otherwise be used
  437. and pipelining is in use (see L<SSL_CTX_set_default_read_buffer_len(3)> for
  438. further information).
  439. =item B<-ignore_unexpected_eof>
  440. Some TLS implementations do not send the mandatory close_notify alert on
  441. shutdown. If the application tries to wait for the close_notify alert but the
  442. peer closes the connection without sending it, an error is generated. When this
  443. option is enabled the peer does not need to send the close_notify alert and a
  444. closed connection will be treated as if the close_notify alert was received.
  445. For more information on shutting down a connection, see L<SSL_shutdown(3)>.
  446. =item B<-bugs>
  447. There are several known bugs in SSL and TLS implementations. Adding this
  448. option enables various workarounds.
  449. =item B<-no_tx_cert_comp>
  450. Disables support for sending TLSv1.3 compressed certificates.
  451. =item B<-no_rx_cert_comp>
  452. Disables support for receiving TLSv1.3 compressed certificate.
  453. =item B<-comp>
  454. Enables support for SSL/TLS compression.
  455. This option was introduced in OpenSSL 1.1.0.
  456. TLS compression is not recommended and is off by default as of
  457. OpenSSL 1.1.0.
  458. =item B<-no_comp>
  459. Disables support for SSL/TLS compression.
  460. TLS compression is not recommended and is off by default as of
  461. OpenSSL 1.1.0.
  462. =item B<-brief>
  463. Only provide a brief summary of connection parameters instead of the
  464. normal verbose output.
  465. =item B<-sigalgs> I<sigalglist>
  466. Specifies the list of signature algorithms that are sent by the client.
  467. The server selects one entry in the list based on its preferences.
  468. For example strings, see L<SSL_CTX_set1_sigalgs(3)>
  469. =item B<-curves> I<curvelist>
  470. Specifies the list of supported curves to be sent by the client. The curve is
  471. ultimately selected by the server. For a list of all curves, use:
  472. $ openssl ecparam -list_curves
  473. =item B<-cipher> I<cipherlist>
  474. This allows the TLSv1.2 and below cipher list sent by the client to be modified.
  475. This list will be combined with any TLSv1.3 ciphersuites that have been
  476. configured. Although the server determines which ciphersuite is used it should
  477. take the first supported cipher in the list sent by the client. See
  478. L<openssl-ciphers(1)> for more information.
  479. =item B<-ciphersuites> I<val>
  480. This allows the TLSv1.3 ciphersuites sent by the client to be modified. This
  481. list will be combined with any TLSv1.2 and below ciphersuites that have been
  482. configured. Although the server determines which cipher suite is used it should
  483. take the first supported cipher in the list sent by the client. See
  484. L<openssl-ciphers(1)> for more information. The format for this list is a simple
  485. colon (":") separated list of TLSv1.3 ciphersuite names.
  486. =item B<-starttls> I<protocol>
  487. Send the protocol-specific message(s) to switch to TLS for communication.
  488. I<protocol> is a keyword for the intended protocol. Currently, the only
  489. supported keywords are "smtp", "pop3", "imap", "ftp", "xmpp", "xmpp-server",
  490. "irc", "postgres", "mysql", "lmtp", "nntp", "sieve" and "ldap".
  491. =item B<-xmpphost> I<hostname>
  492. This option, when used with "-starttls xmpp" or "-starttls xmpp-server",
  493. specifies the host for the "to" attribute of the stream element.
  494. If this option is not specified, then the host specified with "-connect"
  495. will be used.
  496. This option is an alias of the B<-name> option for "xmpp" and "xmpp-server".
  497. =item B<-name> I<hostname>
  498. This option is used to specify hostname information for various protocols
  499. used with B<-starttls> option. Currently only "xmpp", "xmpp-server",
  500. "smtp" and "lmtp" can utilize this B<-name> option.
  501. If this option is used with "-starttls xmpp" or "-starttls xmpp-server",
  502. if specifies the host for the "to" attribute of the stream element. If this
  503. option is not specified, then the host specified with "-connect" will be used.
  504. If this option is used with "-starttls lmtp" or "-starttls smtp", it specifies
  505. the name to use in the "LMTP LHLO" or "SMTP EHLO" message, respectively. If
  506. this option is not specified, then "mail.example.com" will be used.
  507. =item B<-tlsextdebug>
  508. Print out a hex dump of any TLS extensions received from the server.
  509. =item B<-no_ticket>
  510. Disable RFC4507bis session ticket support.
  511. =item B<-sess_out> I<filename>
  512. Output SSL session to I<filename>.
  513. =item B<-sess_in> I<filename>
  514. Load SSL session from I<filename>. The client will attempt to resume a
  515. connection from this session.
  516. =item B<-serverinfo> I<types>
  517. A list of comma-separated TLS Extension Types (numbers between 0 and
  518. 65535). Each type will be sent as an empty ClientHello TLS Extension.
  519. The server's response (if any) will be encoded and displayed as a PEM
  520. file.
  521. =item B<-status>
  522. Sends a certificate status request to the server (OCSP stapling). The server
  523. response (if any) is printed out.
  524. =item B<-alpn> I<protocols>, B<-nextprotoneg> I<protocols>
  525. These flags enable the Enable the Application-Layer Protocol Negotiation
  526. or Next Protocol Negotiation (NPN) extension, respectively. ALPN is the
  527. IETF standard and replaces NPN.
  528. The I<protocols> list is a comma-separated list of protocol names that
  529. the client should advertise support for. The list should contain the most
  530. desirable protocols first. Protocol names are printable ASCII strings,
  531. for example "http/1.1" or "spdy/3".
  532. An empty list of protocols is treated specially and will cause the
  533. client to advertise support for the TLS extension but disconnect just
  534. after receiving ServerHello with a list of server supported protocols.
  535. The flag B<-nextprotoneg> cannot be specified if B<-tls1_3> is used.
  536. =item B<-ct>, B<-noct>
  537. Use one of these two options to control whether Certificate Transparency (CT)
  538. is enabled (B<-ct>) or disabled (B<-noct>).
  539. If CT is enabled, signed certificate timestamps (SCTs) will be requested from
  540. the server and reported at handshake completion.
  541. Enabling CT also enables OCSP stapling, as this is one possible delivery method
  542. for SCTs.
  543. =item B<-ctlogfile>
  544. A file containing a list of known Certificate Transparency logs. See
  545. L<SSL_CTX_set_ctlog_list_file(3)> for the expected file format.
  546. =item B<-keylogfile> I<file>
  547. Appends TLS secrets to the specified keylog file such that external programs
  548. (like Wireshark) can decrypt TLS connections.
  549. =item B<-early_data> I<file>
  550. Reads the contents of the specified file and attempts to send it as early data
  551. to the server. This will only work with resumed sessions that support early
  552. data and when the server accepts the early data.
  553. =item B<-enable_pha>
  554. For TLSv1.3 only, send the Post-Handshake Authentication extension. This will
  555. happen whether or not a certificate has been provided via B<-cert>.
  556. =item B<-use_srtp> I<value>
  557. Offer SRTP key management, where B<value> is a colon-separated profile list.
  558. =item B<-srpuser> I<value>
  559. Set the SRP username to the specified value. This option is deprecated.
  560. =item B<-srppass> I<value>
  561. Set the SRP password to the specified value. This option is deprecated.
  562. =item B<-srp_lateuser>
  563. SRP username for the second ClientHello message. This option is deprecated.
  564. =item B<-srp_moregroups> This option is deprecated.
  565. Tolerate other than the known B<g> and B<N> values.
  566. =item B<-srp_strength> I<number>
  567. Set the minimal acceptable length, in bits, for B<N>. This option is
  568. deprecated.
  569. =item B<-ktls>
  570. Enable Kernel TLS for sending and receiving.
  571. This option was introduced in OpenSSL 3.2.0.
  572. Kernel TLS is off by default as of OpenSSL 3.2.0.
  573. =item B<-tfo>
  574. Enable creation of connections via TCP fast open (RFC7413).
  575. {- $OpenSSL::safe::opt_version_item -}
  576. {- $OpenSSL::safe::opt_name_item -}
  577. {- $OpenSSL::safe::opt_x_item -}
  578. {- $OpenSSL::safe::opt_trust_item -}
  579. {- $OpenSSL::safe::opt_s_item -}
  580. {- $OpenSSL::safe::opt_r_item -}
  581. {- $OpenSSL::safe::opt_provider_item -}
  582. {- $OpenSSL::safe::opt_engine_item -}
  583. {- output_off() if $disabled{"deprecated-3.0"}; "" -}
  584. =item B<-ssl_client_engine> I<id>
  585. Specify engine to be used for client certificate operations.
  586. {- output_on() if $disabled{"deprecated-3.0"}; "" -}
  587. {- $OpenSSL::safe::opt_v_item -}
  588. Verification errors are displayed, for debugging, but the command will
  589. proceed unless the B<-verify_return_error> option is used.
  590. =item B<-enable_server_rpk>
  591. Enable support for receiving raw public keys (RFC7250) from the server.
  592. Use of X.509 certificates by the server becomes optional, and servers that
  593. support raw public keys may elect to use them.
  594. Servers that don't support raw public keys or prefer to use X.509
  595. certificates can still elect to send X.509 certificates as usual.
  596. =item B<-enable_client_rpk>
  597. Enable support for sending raw public keys (RFC7250) to the server.
  598. A raw public key will be sent by the client, if solicited by the server,
  599. provided a suitable key and public certificate pair is configured.
  600. Some servers may nevertheless not request any client credentials,
  601. or may request a certificate.
  602. =item I<host>:I<port>
  603. Rather than providing B<-connect>, the target hostname and optional port may
  604. be provided as a single positional argument after all options. If neither this
  605. nor B<-connect> are provided, falls back to attempting to connect to
  606. I<localhost> on port I<4433>.
  607. =back
  608. =head1 CONNECTED COMMANDS (BASIC)
  609. If a connection is established with an SSL/TLS server then any data received
  610. from the server is displayed and any key presses will be sent to the
  611. server. If end of file is reached then the connection will be closed down.
  612. When used interactively (which means neither B<-quiet> nor B<-ign_eof> have been
  613. given), and neither of B<-adv> or B<-nocommands> are given then "Basic" command
  614. mode is entered. In this mode certain commands are recognized which perform
  615. special operations. These commands are a letter which must appear at the start
  616. of a line. All further data after the initial letter on the line is ignored.
  617. The commands are listed below.
  618. =over 4
  619. =item B<Q>
  620. End the current SSL connection and exit.
  621. =item B<R>
  622. Renegotiate the SSL session (TLSv1.2 and below only).
  623. =item B<C>
  624. Attempt to reconnect to the server using a resumption handshake.
  625. =item B<k>
  626. Send a key update message to the server (TLSv1.3 only)
  627. =item B<K>
  628. Send a key update message to the server and request one back (TLSv1.3 only)
  629. =back
  630. =head1 CONNECTED COMMANDS (ADVANCED)
  631. If B<-adv> has been given then "advanced" command mode is entered. As with basic
  632. mode, if a connection is established with an SSL/TLS server then any data
  633. received from the server is displayed and any key presses will be sent to the
  634. server. If end of file is reached then the connection will be closed down.
  635. Special commands can be supplied by enclosing them in braces, e.g. "{help}" or
  636. "{quit}". These commands can appear anywhere in the text entered into s_client,
  637. but they are not sent to the server. Some commands can take an argument by
  638. ending the command name with ":" and then providing the argument, e.g.
  639. "{keyup:req}". Some commands are only available when certain protocol versions
  640. have been negotiated.
  641. If a newline appears at the end of a line entered into s_client then this is
  642. also sent to the server. If a command appears on a line on its own with no other
  643. text on the same line, then the newline is suppressed and not sent to the
  644. server.
  645. The following commands are recognised.
  646. =over 4
  647. =item B<help>
  648. Prints out summary help text about the available commands.
  649. =item B<quit>
  650. Close the connection to the peer
  651. =item B<reconnect>
  652. Reconnect to the peer and attempt a resumption handshake
  653. =item B<keyup>
  654. Send a Key Update message. TLSv1.3 only. This command takes an optional
  655. argument. If the argument "req" is supplied then the peer is also requested to
  656. update its keys. Otherwise if "noreq" is supplied the the peer is not requested
  657. to update its keys. The default is "req".
  658. =item B<reneg>
  659. Initiate a renegotiation with the server. (D)TLSv1.2 or below only.
  660. =item B<fin>
  661. Indicate FIN on the current stream. QUIC only. Once FIN has been sent any
  662. further text entered for this stream is ignored.
  663. =back
  664. =head1 NOTES
  665. This command can be used to debug SSL servers. To connect to an SSL HTTP
  666. server the command:
  667. openssl s_client -connect servername:443
  668. would typically be used (https uses port 443). If the connection succeeds
  669. then an HTTP command can be given such as "GET /" to retrieve a web page.
  670. If the handshake fails then there are several possible causes, if it is
  671. nothing obvious like no client certificate then the B<-bugs>,
  672. B<-ssl3>, B<-tls1>, B<-no_ssl3>, B<-no_tls1> options can be tried
  673. in case it is a buggy server. In particular you should play with these
  674. options B<before> submitting a bug report to an OpenSSL mailing list.
  675. A frequent problem when attempting to get client certificates working
  676. is that a web client complains it has no certificates or gives an empty
  677. list to choose from. This is normally because the server is not sending
  678. the clients certificate authority in its "acceptable CA list" when it
  679. requests a certificate. By using this command, the CA list can be viewed
  680. and checked. However, some servers only request client authentication
  681. after a specific URL is requested. To obtain the list in this case it
  682. is necessary to use the B<-prexit> option and send an HTTP request
  683. for an appropriate page.
  684. If a certificate is specified on the command line using the B<-cert>
  685. option it will not be used unless the server specifically requests
  686. a client certificate. Therefore, merely including a client certificate
  687. on the command line is no guarantee that the certificate works.
  688. If there are problems verifying a server certificate then the
  689. B<-showcerts> option can be used to show all the certificates sent by the
  690. server.
  691. This command is a test tool and is designed to continue the
  692. handshake after any certificate verification errors. As a result it will
  693. accept any certificate chain (trusted or not) sent by the peer. Non-test
  694. applications should B<not> do this as it makes them vulnerable to a MITM
  695. attack. This behaviour can be changed by with the B<-verify_return_error>
  696. option: any verify errors are then returned aborting the handshake.
  697. The B<-bind> option may be useful if the server or a firewall requires
  698. connections to come from some particular address and or port.
  699. =head1 BUGS
  700. Because this program has a lot of options and also because some of the
  701. techniques used are rather old, the C source for this command is rather
  702. hard to read and not a model of how things should be done.
  703. A typical SSL client program would be much simpler.
  704. The B<-prexit> option is a bit of a hack. We should really report
  705. information whenever a session is renegotiated.
  706. =head1 SEE ALSO
  707. L<openssl(1)>,
  708. L<openssl-sess_id(1)>,
  709. L<openssl-s_server(1)>,
  710. L<openssl-ciphers(1)>,
  711. L<SSL_CONF_cmd(3)>,
  712. L<SSL_CTX_set_max_send_fragment(3)>,
  713. L<SSL_CTX_set_split_send_fragment(3)>,
  714. L<SSL_CTX_set_max_pipelines(3)>,
  715. L<ossl_store-file(7)>
  716. =head1 HISTORY
  717. The B<-no_alt_chains> option was added in OpenSSL 1.1.0.
  718. The B<-name> option was added in OpenSSL 1.1.1.
  719. The B<-certform> option has become obsolete in OpenSSL 3.0.0 and has no effect.
  720. The B<-engine> option was deprecated in OpenSSL 3.0.
  721. The
  722. B<-enable_client_rpk>,
  723. B<-enable_server_rpk>,
  724. B<-no_rx_cert_comp>,
  725. B<-no_tx_cert_comp>,
  726. and B<-tfo>
  727. options were added in OpenSSL 3.2.
  728. =head1 COPYRIGHT
  729. Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.
  730. Licensed under the Apache License 2.0 (the "License"). You may not use
  731. this file except in compliance with the License. You can obtain a copy
  732. in the file LICENSE in the source distribution or at
  733. L<https://www.openssl.org/source/license.html>.
  734. =cut