yuezonghe | 824eb0c | 2024-06-27 02:32:26 -0700 | [diff] [blame] | 1 | =pod |
| 2 | |
| 3 | =head1 NAME |
| 4 | |
| 5 | openssl-s_time, |
| 6 | s_time - SSL/TLS performance timing program |
| 7 | |
| 8 | =head1 SYNOPSIS |
| 9 | |
| 10 | B<openssl> B<s_time> |
| 11 | [B<-help>] |
| 12 | [B<-connect host:port>] |
| 13 | [B<-www page>] |
| 14 | [B<-cert filename>] |
| 15 | [B<-key filename>] |
| 16 | [B<-CApath directory>] |
| 17 | [B<-CAfile filename>] |
| 18 | [B<-no-CAfile>] |
| 19 | [B<-no-CApath>] |
| 20 | [B<-reuse>] |
| 21 | [B<-new>] |
| 22 | [B<-verify depth>] |
| 23 | [B<-nameopt option>] |
| 24 | [B<-time seconds>] |
| 25 | [B<-ssl3>] |
| 26 | [B<-bugs>] |
| 27 | [B<-cipher cipherlist>] |
| 28 | [B<-ciphersuites val>] |
| 29 | |
| 30 | =head1 DESCRIPTION |
| 31 | |
| 32 | The B<s_time> command implements a generic SSL/TLS client which connects to a |
| 33 | remote host using SSL/TLS. It can request a page from the server and includes |
| 34 | the time to transfer the payload data in its timing measurements. It measures |
| 35 | the number of connections within a given timeframe, the amount of data |
| 36 | transferred (if any), and calculates the average time spent for one connection. |
| 37 | |
| 38 | =head1 OPTIONS |
| 39 | |
| 40 | =over 4 |
| 41 | |
| 42 | =item B<-help> |
| 43 | |
| 44 | Print out a usage message. |
| 45 | |
| 46 | =item B<-connect host:port> |
| 47 | |
| 48 | This specifies the host and optional port to connect to. |
| 49 | |
| 50 | =item B<-www page> |
| 51 | |
| 52 | This specifies the page to GET from the server. A value of '/' gets the |
| 53 | index.htm[l] page. If this parameter is not specified, then B<s_time> will only |
| 54 | perform the handshake to establish SSL connections but not transfer any |
| 55 | payload data. |
| 56 | |
| 57 | =item B<-cert certname> |
| 58 | |
| 59 | The certificate to use, if one is requested by the server. The default is |
| 60 | not to use a certificate. The file is in PEM format. |
| 61 | |
| 62 | =item B<-key keyfile> |
| 63 | |
| 64 | The private key to use. If not specified then the certificate file will |
| 65 | be used. The file is in PEM format. |
| 66 | |
| 67 | =item B<-verify depth> |
| 68 | |
| 69 | The verify depth to use. This specifies the maximum length of the |
| 70 | server certificate chain and turns on server certificate verification. |
| 71 | Currently the verify operation continues after errors so all the problems |
| 72 | with a certificate chain can be seen. As a side effect the connection |
| 73 | will never fail due to a server certificate verify failure. |
| 74 | |
| 75 | =item B<-nameopt option> |
| 76 | |
| 77 | Option which determines how the subject or issuer names are displayed. The |
| 78 | B<option> argument can be a single option or multiple options separated by |
| 79 | commas. Alternatively the B<-nameopt> switch may be used more than once to |
| 80 | set multiple options. See the L<x509(1)> manual page for details. |
| 81 | |
| 82 | =item B<-CApath directory> |
| 83 | |
| 84 | The directory to use for server certificate verification. This directory |
| 85 | must be in "hash format", see B<verify> for more information. These are |
| 86 | also used when building the client certificate chain. |
| 87 | |
| 88 | =item B<-CAfile file> |
| 89 | |
| 90 | A file containing trusted certificates to use during server authentication |
| 91 | and to use when attempting to build the client certificate chain. |
| 92 | |
| 93 | =item B<-no-CAfile> |
| 94 | |
| 95 | Do not load the trusted CA certificates from the default file location |
| 96 | |
| 97 | =item B<-no-CApath> |
| 98 | |
| 99 | Do not load the trusted CA certificates from the default directory location |
| 100 | |
| 101 | =item B<-new> |
| 102 | |
| 103 | Performs the timing test using a new session ID for each connection. |
| 104 | If neither B<-new> nor B<-reuse> are specified, they are both on by default |
| 105 | and executed in sequence. |
| 106 | |
| 107 | =item B<-reuse> |
| 108 | |
| 109 | Performs the timing test using the same session ID; this can be used as a test |
| 110 | that session caching is working. If neither B<-new> nor B<-reuse> are |
| 111 | specified, they are both on by default and executed in sequence. |
| 112 | |
| 113 | =item B<-ssl3> |
| 114 | |
| 115 | This option disables the use of SSL version 3. By default |
| 116 | the initial handshake uses a method which should be compatible with all |
| 117 | servers and permit them to use SSL v3 or TLS as appropriate. |
| 118 | |
| 119 | The timing program is not as rich in options to turn protocols on and off as |
| 120 | the L<s_client(1)> program and may not connect to all servers. |
| 121 | Unfortunately there are a lot of ancient and broken servers in use which |
| 122 | cannot handle this technique and will fail to connect. Some servers only |
| 123 | work if TLS is turned off with the B<-ssl3> option. |
| 124 | |
| 125 | Note that this option may not be available, depending on how |
| 126 | OpenSSL was built. |
| 127 | |
| 128 | =item B<-bugs> |
| 129 | |
| 130 | There are several known bugs in SSL and TLS implementations. Adding this |
| 131 | option enables various workarounds. |
| 132 | |
| 133 | =item B<-cipher cipherlist> |
| 134 | |
| 135 | This allows the TLSv1.2 and below cipher list sent by the client to be modified. |
| 136 | This list will be combined with any TLSv1.3 ciphersuites that have been |
| 137 | configured. Although the server determines which cipher suite is used it should |
| 138 | take the first supported cipher in the list sent by the client. See |
| 139 | L<ciphers(1)> for more information. |
| 140 | |
| 141 | =item B<-ciphersuites val> |
| 142 | |
| 143 | This allows the TLSv1.3 ciphersuites sent by the client to be modified. This |
| 144 | list will be combined with any TLSv1.2 and below ciphersuites that have been |
| 145 | configured. Although the server determines which cipher suite is used it should |
| 146 | take the first supported cipher in the list sent by the client. See |
| 147 | L<ciphers(1)> for more information. The format for this list is a simple |
| 148 | colon (":") separated list of TLSv1.3 ciphersuite names. |
| 149 | |
| 150 | =item B<-time length> |
| 151 | |
| 152 | Specifies how long (in seconds) B<s_time> should establish connections and |
| 153 | optionally transfer payload data from a server. Server and client performance |
| 154 | and the link speed determine how many connections B<s_time> can establish. |
| 155 | |
| 156 | =back |
| 157 | |
| 158 | =head1 NOTES |
| 159 | |
| 160 | B<s_time> can be used to measure the performance of an SSL connection. |
| 161 | To connect to an SSL HTTP server and get the default page the command |
| 162 | |
| 163 | openssl s_time -connect servername:443 -www / -CApath yourdir -CAfile yourfile.pem -cipher commoncipher [-ssl3] |
| 164 | |
| 165 | would typically be used (https uses port 443). 'commoncipher' is a cipher to |
| 166 | which both client and server can agree, see the L<ciphers(1)> command |
| 167 | for details. |
| 168 | |
| 169 | If the handshake fails then there are several possible causes, if it is |
| 170 | nothing obvious like no client certificate then the B<-bugs> and |
| 171 | B<-ssl3> options can be tried |
| 172 | in case it is a buggy server. In particular you should play with these |
| 173 | options B<before> submitting a bug report to an OpenSSL mailing list. |
| 174 | |
| 175 | A frequent problem when attempting to get client certificates working |
| 176 | is that a web client complains it has no certificates or gives an empty |
| 177 | list to choose from. This is normally because the server is not sending |
| 178 | the clients certificate authority in its "acceptable CA list" when it |
| 179 | requests a certificate. By using L<s_client(1)> the CA list can be |
| 180 | viewed and checked. However, some servers only request client authentication |
| 181 | after a specific URL is requested. To obtain the list in this case it |
| 182 | is necessary to use the B<-prexit> option of L<s_client(1)> and |
| 183 | send an HTTP request for an appropriate page. |
| 184 | |
| 185 | If a certificate is specified on the command line using the B<-cert> |
| 186 | option it will not be used unless the server specifically requests |
| 187 | a client certificate. Therefore, merely including a client certificate |
| 188 | on the command line is no guarantee that the certificate works. |
| 189 | |
| 190 | =head1 BUGS |
| 191 | |
| 192 | Because this program does not have all the options of the |
| 193 | L<s_client(1)> program to turn protocols on and off, you may not be |
| 194 | able to measure the performance of all protocols with all servers. |
| 195 | |
| 196 | The B<-verify> option should really exit if the server verification |
| 197 | fails. |
| 198 | |
| 199 | =head1 SEE ALSO |
| 200 | |
| 201 | L<s_client(1)>, L<s_server(1)>, L<ciphers(1)> |
| 202 | |
| 203 | =head1 COPYRIGHT |
| 204 | |
| 205 | Copyright 2004-2020 The OpenSSL Project Authors. All Rights Reserved. |
| 206 | |
| 207 | Licensed under the OpenSSL license (the "License"). You may not use |
| 208 | this file except in compliance with the License. You can obtain a copy |
| 209 | in the file LICENSE in the source distribution or at |
| 210 | L<https://www.openssl.org/source/license.html>. |
| 211 | |
| 212 | =cut |