openssl-s_client.pod.in 27 KB

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