Added gnutls_session_get_id2().
[gnutls.git] / doc / invoke-gnutls-cli.texi
blob41b9e8215551f883c3114ff3dfbe60af2ae67083
1 @node gnutls-cli Invocation
2 @section Invoking gnutls-cli
3 @pindex gnutls-cli
4 @cindex GnuTLS client
5 @ignore
6 #  -*- buffer-read-only: t -*- vi: set ro:
7
8 # DO NOT EDIT THIS FILE   (invoke-gnutls-cli.texi)
9
10 # It has been AutoGen-ed  October 13, 2012 at 08:49:25 PM by AutoGen 5.16
11 # From the definitions    ../src/cli-args.def
12 # and the template file   agtexi-cmd.tpl
13 @end ignore
16 Simple client program to set up a TLS connection to some other computer. 
17 It sets up a TLS connection and forwards data from the standard input to the secured socket and vice versa.
19 This section was generated by @strong{AutoGen},
20 using the @code{agtexi-cmd} template and the option descriptions for the @code{gnutls-cli} program.
21 This software is released under the GNU General Public License, version 3 or later.
24 @anchor{gnutls-cli usage}
25 @subheading gnutls-cli help/usage (-h)
26 @cindex gnutls-cli help
28 This is the automatically generated usage text for gnutls-cli.
29 The text printed is the same whether for the @code{help} option (-h) or the @code{more-help} option (-!).  @code{more-help} will print
30 the usage text by passing it through a pager program.
31 @code{more-help} is disabled on platforms without a working
32 @code{fork(2)} function.  The @code{PAGER} environment variable is
33 used to select the program, defaulting to @file{more}.  Both will exit
34 with a status code of 0.
36 @exampleindent 0
37 @example
38 gnutls-cli - GnuTLS client - Ver. @@VERSION@@
39 USAGE:  gnutls-cli [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... [hostname]
41    -d, --debug=num            Enable debugging.
42                                 - It must be in the range:
43                                   0 to 9999
44    -V, --verbose              More verbose output
45                                 - may appear multiple times
46        --tofu                 Enable trust on first use authentication
47                                 - disabled as --no-tofu
48        --dane                 Enable DANE certificate verification (DNSSEC)
49                                 - disabled as --no-dane
50        --local-dns            Use the local DNS server for DNSSEC resolving.
51                                 - disabled as --no-local-dns
52        --ca-verification      Disable CA certificate verification
53                                 - disabled as --no-ca-verification
54                                 - enabled by default
55        --ocsp                 Enable OCSP certificate verification
56                                 - disabled as --no-ocsp
57    -r, --resume               Establish a session and resume
58    -b, --heartbeat            Activate heartbeat support
59    -e, --rehandshake          Establish a session and rehandshake
60        --noticket             Don't accept session tickets
61        --ocsp-status-request  Enable OCSP status request
62                                 - disabled as --no-ocsp-status-request
63                                 - enabled by default
64    -s, --starttls             Connect, establish a plain session and start TLS.
65    -u, --udp                  Use DTLS (datagram TLS) over UDP
66        --mtu=num              Set MTU for datagram TLS
67                                 - It must be in the range:
68                                   0 to 17000
69        --crlf                 Send CR LF instead of LF
70        --x509fmtder           Use DER format for certificates to read from
71    -f, --fingerprint          Send the openpgp fingerprint, instead of the key
72        --disable-extensions   Disable all the TLS extensions
73        --print-cert           Print peer's certificate in PEM format
74        --recordsize=num       The maximum record size to advertize
75                                 - It must be in the range:
76                                   0 to 4096
77        --dh-bits=num          The minimum number of bits allowed for DH
78        --priority=str         Priorities string
79        --x509cafile=str       Certificate file or PKCS #11 URL to use
80        --x509crlfile=file     CRL file to use
81                                 - file must pre-exist
82        --pgpkeyfile=file      PGP Key file to use
83                                 - file must pre-exist
84        --pgpkeyring=file      PGP Key ring file to use
85                                 - file must pre-exist
86        --pgpcertfile=file     PGP Public Key (certificate) file to use
87                                 - file must pre-exist
88        --x509keyfile=str      X.509 key file or PKCS #11 URL to use
89        --x509certfile=str     X.509 Certificate file or PKCS #11 URL to use
90        --pgpsubkey=str        PGP subkey to use (hex or auto)
91        --srpusername=str      SRP username to use
92        --srppasswd=str        SRP password to use
93        --pskusername=str      PSK username to use
94        --pskkey=str           PSK key (in hex) to use
95    -p, --port=str             The port or service to connect to
96        --insecure             Don't abort program if server certificate can't be validated
97        --benchmark-ciphers    Benchmark individual ciphers
98        --benchmark-soft-ciphers  Benchmark individual software ciphers (no hw acceleration)
99        --benchmark-tls-kx     Benchmark TLS key exchange methods
100        --benchmark-tls-ciphers  Benchmark TLS ciphers
101    -l, --list                 Print a list of the supported algorithms and modes
102    -v, --version[=arg]        Output version information and exit
103    -h, --help                 Display extended usage information and exit
104    -!, --more-help            Extended usage information passed thru pager
106 Options are specified by doubled hyphens and their name or by a single
107 hyphen and the flag character.
108 Operands and options may be intermixed.  They will be reordered.
112 Simple client program to set up a TLS connection to some other computer.  It
113 sets up a TLS connection and forwards data from the standard input to the
114 secured socket and vice versa.
116 please send bug reports to:  bug-gnutls@@gnu.org
117 @end example
118 @exampleindent 4
120 @anchor{gnutls-cli debug}
121 @subheading debug option (-d)
122 @cindex gnutls-cli-debug
124 This is the ``enable debugging.'' option.
125 This option takes an argument number.
126 Specifies the debug level.
127 @anchor{gnutls-cli tofu}
128 @subheading tofu option
129 @cindex gnutls-cli-tofu
131 This is the ``enable trust on first use authentication'' option.
132 This option will, in addition to certificate authentication, perform authentication based on previously seen public keys, a model similar to SSH authentication.
133 @anchor{gnutls-cli dane}
134 @subheading dane option
135 @cindex gnutls-cli-dane
137 This is the ``enable dane certificate verification (dnssec)'' option.
138 This option will, in addition to certificate authentication using 
139 the trusted CAs, verify the server certificates using on the DANE information
140 available via DNSSEC.
141 @anchor{gnutls-cli local-dns}
142 @subheading local-dns option
143 @cindex gnutls-cli-local-dns
145 This is the ``use the local dns server for dnssec resolving.'' option.
146 This option will use the local DNS server for DNSSEC.
147 This is disabled by default due to many servers not allowing DNSSEC.
148 @anchor{gnutls-cli ca-verification}
149 @subheading ca-verification option
150 @cindex gnutls-cli-ca-verification
152 This is the ``disable ca certificate verification'' option.
154 @noindent
155 This option has some usage constraints.  It:
156 @itemize @bullet
157 @item
158 is enabled by default.
159 @end itemize
161 This option will disable CA certificate verification. It is to be used with the --dane or --tofu options.
162 @anchor{gnutls-cli ocsp}
163 @subheading ocsp option
164 @cindex gnutls-cli-ocsp
166 This is the ``enable ocsp certificate verification'' option.
167 This option will enable verification of the peer's certificate using ocsp
168 @anchor{gnutls-cli resume}
169 @subheading resume option (-r)
170 @cindex gnutls-cli-resume
172 This is the ``establish a session and resume'' option.
173 Connect, establish a session, reconnect and resume.
174 @anchor{gnutls-cli rehandshake}
175 @subheading rehandshake option (-e)
176 @cindex gnutls-cli-rehandshake
178 This is the ``establish a session and rehandshake'' option.
179 Connect, establish a session and rehandshake immediately.
180 @anchor{gnutls-cli ocsp-status-request}
181 @subheading ocsp-status-request option
182 @cindex gnutls-cli-ocsp-status-request
184 This is the ``enable ocsp status request'' option.
186 @noindent
187 This option has some usage constraints.  It:
188 @itemize @bullet
189 @item
190 is enabled by default.
191 @end itemize
193 The client will indicate to the server in a TLS extension that it wants a OCSP status request.
194 @anchor{gnutls-cli starttls}
195 @subheading starttls option (-s)
196 @cindex gnutls-cli-starttls
198 This is the ``connect, establish a plain session and start tls.'' option.
199 The TLS session will be initiated when EOF or a SIGALRM is received.
200 @anchor{gnutls-cli disable-extensions}
201 @subheading disable-extensions option
202 @cindex gnutls-cli-disable-extensions
204 This is the ``disable all the tls extensions'' option.
205 This option disables all TLS extensions. Deprecated option. Use the priority string.
206 @anchor{gnutls-cli dh-bits}
207 @subheading dh-bits option
208 @cindex gnutls-cli-dh-bits
210 This is the ``the minimum number of bits allowed for dh'' option.
211 This option takes an argument number.
212 This option sets the minimum number of bits allowed for a Diffie-Hellman key exchange. You may want to lower the default value if the peer sends a weak prime and you get an connection error with unacceptable prime.
213 @anchor{gnutls-cli priority}
214 @subheading priority option
215 @cindex gnutls-cli-priority
217 This is the ``priorities string'' option.
218 This option takes an argument string.
219 TLS algorithms and protocols to enable. You can
220 use predefined sets of ciphersuites such as PERFORMANCE,
221 NORMAL, SECURE128, SECURE256.
223 Check  the  GnuTLS  manual  on  section  ``Priority strings'' for more
224 information on allowed keywords
225 @anchor{gnutls-cli list}
226 @subheading list option (-l)
227 @cindex gnutls-cli-list
229 This is the ``print a list of the supported algorithms and modes'' option.
230 Print a list of the supported algorithms and modes. If a priority string is given then only the enabled ciphersuites are shown.
231 @anchor{gnutls-cli exit status}
232 @subheading gnutls-cli exit status
234 One of the following exit values will be returned:
235 @table @samp
236 @item 0 (EXIT_SUCCESS)
237 Successful program execution.
238 @item 1 (EXIT_FAILURE)
239 The operation failed or the command syntax was not valid.
240 @end table
241 @anchor{gnutls-cli See Also}
242 @subheading gnutls-cli See Also
243 gnutls-cli-debug(1), gnutls-serv(1)
245 @anchor{gnutls-cli Examples}
246 @subheading gnutls-cli Examples
247 @subheading Connecting using PSK authentication
248 To connect to a server using PSK authentication, you need to enable the choice of PSK by using a cipher priority parameter such as in the example below. 
249 @example
250 $ ./gnutls-cli -p 5556 localhost --pskusername psk_identity \
251     --pskkey 88f3824b3e5659f52d00e959bacab954b6540344 \
252     --priority NORMAL:-KX-ALL:+ECDHE-PSK:+DHE-PSK:+PSK
253 Resolving 'localhost'...
254 Connecting to '127.0.0.1:5556'...
255 - PSK authentication.
256 - Version: TLS1.1
257 - Key Exchange: PSK
258 - Cipher: AES-128-CBC
259 - MAC: SHA1
260 - Compression: NULL
261 - Handshake was completed
262     
263 - Simple Client Mode:
264 @end example
265 By keeping the --pskusername parameter and removing the --pskkey parameter, it will query only for the password during the handshake. 
267 @subheading Listing ciphersuites in a priority string
268 To list the ciphersuites in a priority string:
269 @example
270 $ ./gnutls-cli --priority SECURE192 -l
271 Cipher suites for SECURE192
272 TLS_ECDHE_ECDSA_AES_256_CBC_SHA384         0xc0, 0x24   TLS1.2
273 TLS_ECDHE_ECDSA_AES_256_GCM_SHA384         0xc0, 0x2e   TLS1.2
274 TLS_ECDHE_RSA_AES_256_GCM_SHA384           0xc0, 0x30   TLS1.2
275 TLS_DHE_RSA_AES_256_CBC_SHA256             0x00, 0x6b   TLS1.2
276 TLS_DHE_DSS_AES_256_CBC_SHA256             0x00, 0x6a   TLS1.2
277 TLS_RSA_AES_256_CBC_SHA256                 0x00, 0x3d   TLS1.2
279 Certificate types: CTYPE-X.509
280 Protocols: VERS-TLS1.2, VERS-TLS1.1, VERS-TLS1.0, VERS-SSL3.0, VERS-DTLS1.0
281 Compression: COMP-NULL
282 Elliptic curves: CURVE-SECP384R1, CURVE-SECP521R1
283 PK-signatures: SIGN-RSA-SHA384, SIGN-ECDSA-SHA384, SIGN-RSA-SHA512, SIGN-ECDSA-SHA512
284 @end example