openssl-s_client.pod.in 29 KB

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