2
0

openssl-s_client.pod.in 29 KB

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