openssl-s_client.pod.in 29 KB

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