1
0

openssl-s_client.pod.in 29 KB

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