2
0

openssl-s_client.pod.in 33 KB

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