gnutls-cli(1)
gnutls-cli π
okay bestie, welcome to the GnuTLS client page β this is part of the User Commands manual, and it's a whole lot, so grab a snack π
β¨ NAME β¨
gnutls-cli β the GnuTLS client, fr fr π
πΈ SYNOPSIS πΈ
gnutls-cli [-flags] [-flag [value]] [--option-name[[=| ]value]]
[hostname]
Operands and options may be intermixed. They will be reordered. β so like, you don't have to be all tidy about it, the program sorts it out for you π«Ά
π¦ DESCRIPTION π¦
So this is a simple client program whose whole job is setting up a TLS connection to some other computer. It sets up that TLS connection, then forwards data from standard input to the secured socket and vice versa. It's giving relay, it's giving middleman, it's giving π«
But listen bestie: this program is only meant for testing and diagnostic purposes. That's the whole vibe check. For more practical use-cases, consider using alternatives like GNU Wget. Periodt. π
π OPTIONS π
-d num,--debug=numβ Enable debugging. This one takes an integer as its argument, andnumis constrained to being:- in the range
0through9999
- in the range
Specifies the debug level. (Higher = louder, basically.)
-V,--verboseβ More verbose output. That's it, that's the whole thing β¨--tofu,--no-tofuβ Enable trust on first use authentication. Theno-tofuform will disable the option.
This option will, in addition to certificate authentication, perform authentication based on previously seen public keys β a model similar to SSH authentication. Note that when tofu is specified (PKI) and DANE authentication will become advisory to assist the public key acceptance process. iykyk π
--strict-tofu,--no-strict-tofuβ Fail to connect if a certificate is unknown or a known certificate has changed. Theno-strict-tofuform will disable the option.
This option will perform authentication as with option --tofu; however, no questions shall be asked whatsoever, neither to accept an unknown certificate nor a changed one. No asking, no vibes, just no. π
--dane,--no-daneβ Enable DANE certificate verification (DNSSEC). Theno-daneform will disable the option.
This option will, in addition to certificate authentication using the trusted CAs, verify the server certificates using on the DANE information available via DNSSEC.
--local-dns,--no-local-dnsβ Use the local DNS server for DNSSEC resolving. Theno-local-dnsform will disable the option.
This option will use the local DNS server for DNSSEC. This is disabled by default due to many servers not allowing DNSSEC.
--ca-verification,--no-ca-verificationβ Enable CA certificate verification. Theno-ca-verificationform will disable the option. This option is enabled by default.
This option can be used to enable or disable CA certificate verification. It is to be used with the --dane or --tofu options.
--ocsp,--no-ocspβ Enable OCSP certificate verification. Theno-ocspform will disable the option.
This option will enable verification of the peer's certificate using ocsp.
-r,--resumeβ Establish a session and resume.
Connect, establish a session, reconnect and resume. Round two, but make it TLS π«
--earlydata=strβ Send early data on resumption from the specified file.-e,--rehandshakeβ Establish a session and rehandshake.
Connect, establish a session and rehandshake immediately. No chill whatsoever.
--sni-hostname=strβ Server's hostname for server name indication extension.
Set explicitly the server name used in the TLS server name indication extension. That is useful when testing with servers setup on different DNS name than the intended. If not specified, the provided hostname is used. Even with this option server certificate verification still uses the hostname passed on the main commandline. Use --verify-hostname to change this. π
--verify-hostname=strβ Server's hostname to use for validation.
Set explicitly the server name to be used when validating the server's certificate.
-s,--starttlsβ Connect, establish a plain session and start TLS.
The TLS session will be initiated when EOF or a SIGALRM is received.
--app-protoβ This is an alias for the--starttls-protooption. Same girl, different name π--starttls-proto=strβ The application protocol to be used to obtain the server's certificate (https,ftp,smtp,imap,ldap,xmpp,lmtp,pop3,nntp,sieve,postgres). This option must not appear in combination with any of the following options:starttls.
Specify the application layer protocol for STARTTLS. If the protocol is supported, gnutls-cli will proceed to the TLS negotiation.
--starttls-name=strβ The hostname presented to the application protocol for STARTTLS (forsmtp,xmpp,lmtp). This option must not appear in combination with any of the following options:starttls. This option must appear in combination with the following options:starttls-proto.
Specify the hostname presented to the application protocol for STARTTLS.
-u,--udpβ Use DTLS (datagram TLS) over UDP.--mtu=numβ Set MTU for datagram TLS. This option takes an integer number as its argument. The value ofnumis constrained to being:- in the range
0through17000
- in the range
--crlfβ Send CR LF instead of LF. Tiny change, huge consequences π--fastopenβ Enable TCP Fast Open. Zoom zoom β‘--x509fmtderβ Use DER format for certificates to read from.--print-certβ Print peer's certificate in PEM format.--save-cert=strβ Save the peer's certificate chain in the specified file in PEM format.--save-ocsp=strβ Save the peer's OCSP status response in the provided file. This option must not appear in combination with any of the following options:save-ocsp-multi.--save-ocsp-multi=strβ Save all OCSP responses provided by the peer in this file. This option must not appear in combination with any of the following options:save-ocsp.
The file will contain a list of PEM encoded OCSP status responses if any were provided by the peer, starting with the one for the peer's server certificate. π
--save-server-trace=strβ Save the server-side TLS message trace in the provided file.--save-client-trace=strβ Save the client-side TLS message trace in the provided file.--dh-bits=numβ The minimum number of bits allowed for DH. This option takes an integer number as its argument.
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. π
--priority=strβ Priorities string.
TLS algorithms and protocols to enable. You can use predefined sets of ciphersuites such as PERFORMANCE, NORMAL, PFS, SECURE128, SECURE256. The default is NORMAL.
Check the GnuTLS manual on section βPriority stringsβ for more information on the allowed keywords.
--x509cafile=strβ Certificate file or PKCS #11 URL to use.--x509crlfile=fileβ CRL file to use.--x509keyfile=strβ X.509 key file or PKCS #11 URL to use.--x509certfile=strβ X.509 Certificate file or PKCS #11 URL to use. This option must appear in combination with the following options:x509keyfile.--rawpkkeyfile=strβ Private key file (PKCS #8 or PKCS #12) or PKCS #11 URL to use.
In order to instruct the application to negotiate raw public keys one must enable the respective certificate types via the priority strings (i.e. CTYPE-CLI-* and CTYPE-SRV-* flags).
Check the GnuTLS manual on section βPriority stringsβ for more information on how to set certificate types.
--rawpkfile=strβ Raw public-key file to use. This option must appear in combination with the following options:rawpkkeyfile.
In order to instruct the application to negotiate raw public keys one must enable the respective certificate types via the priority strings (i.e. CTYPE-CLI-* and CTYPE-SRV-* flags).
Check the GnuTLS manual on section βPriority stringsβ for more information on how to set certificate types.
--srpusername=strβ SRP username to use.--srppasswd=strβ SRP password to use.--pskusername=strβ PSK username to use.--pskkey=strβ PSK key (in hex) to use.-p str,--port=strβ The port or service to connect to.--insecureβ Don't abort program if server certificate can't be validated. Chaotic, but okay. π--verify-allow-brokenβ Allow broken algorithms, such as MD5 for certificate verification. We're letting the MD5 in. We're not proud of it.--rangesβ Use length-hiding padding to prevent traffic analysis.
When possible (e.g., when using CBC ciphersuites), use length-hiding padding to prevent traffic analysis.
NOTE: THIS OPTION IS DEPRECATED β οΈ
--benchmark-ciphersβ Benchmark individual ciphers.
By default the benchmarked ciphers will utilize any capabilities of the local CPU to improve performance. To test against the raw software implementation set the environment variable GNUTLS_CPUID_OVERRIDE to 0x1. π₯
--benchmark-tls-kxβ Benchmark TLS key exchange methods.--benchmark-tls-ciphersβ Benchmark TLS ciphers.
By default the benchmarked ciphers will utilize any capabilities of the local CPU to improve performance. To test against the raw software implementation set the environment variable GNUTLS_CPUID_OVERRIDE to 0x1. π₯
-l,--listβ Print a list of the supported algorithms and modes. This option must not appear in combination with any of the following options:port.
Print a list of the supported algorithms and modes. If a priority string is given then only the enabled ciphersuites are shown.
--priority-listβ Print a list of the supported priority strings.
Print a list of the supported priority strings. The ciphersuites corresponding to each priority string can be examined using -l -p.
--noticketβ Don't allow session tickets.
Disable the request of receiving of session tickets under TLS1.2 or earlier.
--srtp-profiles=strβ Offer SRTP profiles.--alpn=strβ Application layer protocol. This option may appear an unlimited number of times.
This option will set and enable the Application Layer Protocol Negotiation (ALPN) in the TLS protocol.
--compress-cert=strβ Compress certificate. This option may appear an unlimited number of times.
This option sets a supported compression method for certificate compression.
-b,--heartbeatβ Activate heartbeat support. π--recordsize=numβ The maximum record size to advertise. This option takes an integer number as its argument. The value ofnumis constrained to being:- in the range
0through4096
- in the range
--disable-sniβ Do not send a Server Name Indication (SNI). π--disable-extensionsβ Disable all the TLS extensions.
This option disables all TLS extensions. Deprecated option. Use the priority string.
NOTE: THIS OPTION IS DEPRECATED β οΈ
--single-key-shareβ Send a single key share under TLS1.3.
This option switches the default mode of sending multiple key shares, to send a single one (the top one).
--post-handshake-authβ Enable post-handshake authentication under TLS1.3.
This option enables post-handshake authentication when under TLS1.3.
--inline-commandsβ Inline commands of the form^<cmd>^.
Enable inline commands of the form ^<cmd>^. The inline commands are expected to be in a line by themselves. The available commands are: resume, rekey1 (local rekey), rekey (rekey on both peers) and renegotiate.
--inline-commands-prefix=strβ Change the default delimiter for inline commands.
okay that was a lot and we're not even done bestie, hold on π
so like, while we're still in the middle of the flags β there's also the inline-commands delimiter thing. It changes the default delimiter (^) used for inline commands. That delimiter has to be a single US-ASCII character (octets 0 - 127), and honestly this whole option is only relevant if inline commands are enabled via the inline-commands option. iykyk π
--provider=*file*β Specify the PKCS #11 provider library. Heads up bestie: this will override the default options in/etc/gnutls/pkcs11.confβ¨--fips140-modeβ Reports the status of the FIPS140-2 mode in gnutls library. That's it, that's the job π«‘--list-configβ Reports the configuration of the library. Receipts, basically π§Ύ--logfile=*str*β Redirect informational messages to a specific file. And yes, the file may be/dev/nullalso, which makes the gnutls client quiet β perfect to use it in piped server connections where only the server communication may appear on stdout. lowkey genius π--keymatexport=*str*β Label used for exporting keying material.--keymatexportsize=*num*β Size of the exported keying material. This option takes an integer number as its argument.--waitresumptionβ Block waiting for the resumption data under TLS1.3. This makes the client block waiting for the resumption data under TLS1.3, and it has effect only when--resumeis provided. no--resume, no blocking, periodt π--ca-auto-retrieve,--no-ca-auto-retrieveβ Enable automatic retrieval of missing CA certificates. Theno-ca-auto-retrieveform will disable the option. This lets the client automatically retrieve the missing intermediate CA certificates in the certificate chain, based on the Authority Information Access (AIA) extension. self-healing chain energy β¨--attime=*timestamp*β Perform validation at the timestamp instead of the system time. The timestamp is an instance in time encoded as Unix time or in a human readable timestring such as"29 Feb 2004","2004-02-29". Full documentation available athttps://www.gnu.org/software/coreutils/manual/html_node/Date-input-formats.htmlor locally viainfo '(coreutils) date invocation'π°οΈ-v *arg*,--version=*arg*β Output version of program and exit. The default mode isv, a simple version. Thecmode will print copyright information andnwill print the full copyright notice.-h,--helpβ Display usage information and exit. the classic π-!,--more-helpβ Pass the extended usage information through a pager.
β¨ EXAMPLES β¨
π Connecting using PSK authentication
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.
$ ./gnutls-cli -p 5556 localhost --pskusername psk_identity --pskkey 88f3824b3e5659f52d00e959bacab954b6540344 --priority NORMAL:-KX-ALL:+ECDHE-PSK:+DHE-PSK:+PSK
Resolving 'localhost'...
Connecting to '127.0.0.1:5556'...
- PSK authentication.
- Version: TLS1.1
- Key Exchange: PSK
- Cipher: AES-128-CBC
- MAC: SHA1
- Compression: NULL
- Handshake was completed
- Simple Client Mode:
And the cute trick: by keeping the --pskusername parameter and removing the --pskkey parameter, it will query only for the password during the handshake. sneaky, slay π
π¦ Connecting using raw public-key authentication
To connect to a server using raw public-key authentication, you need to enable the option to negotiate raw public-keys via the priority strings such as in the example below.
$ ./gnutls-cli -p 5556 localhost --priority NORMAL:-CTYPE-CLI-ALL:+CTYPE-CLI-RAWPK --rawpkkeyfile cli.key.pem --rawpkfile cli.rawpk.pem
Processed 1 client raw public key pair...
Resolving 'localhost'...
Connecting to '127.0.0.1:5556'...
- Successfully sent 1 certificate(s) to server.
- Server has requested a certificate.
- Certificate type: X.509
- Got a certificate list of 1 certificates.
- Certificate[0] info:
- skipped
- Description: (TLS1.3-Raw Public Key-X.509)-(ECDHE-SECP256R1)-(RSA-PSS-RSAE-SHA256)-(AES-256-GCM)
- Options:
- Handshake was completed
- Simple Client Mode:
π¬ Connecting to STARTTLS services
You could also use the client to connect to services with starttls capability.
$ gnutls-cli --starttls-proto smtp --port 25 localhost
π Listing ciphersuites in a priority string
To list the ciphersuites in a priority string:
$ ./gnutls-cli --priority SECURE192 -l
Cipher suites for SECURE192
TLS_ECDHE_ECDSA_AES_256_CBC_SHA384 0xc0, 0x24 TLS1.2
TLS_ECDHE_ECDSA_AES_256_GCM_SHA384 0xc0, 0x2e TLS1.2
TLS_ECDHE_RSA_AES_256_GCM_SHA384 0xc0, 0x30 TLS1.2
TLS_DHE_RSA_AES_256_CBC_SHA256 0x00, 0x6b TLS1.2
TLS_DHE_DSS_AES_256_CBC_SHA256 0x00, 0x6a TLS1.2
TLS_RSA_AES_256_CBC_SHA256 0x00, 0x3d TLS1.2
Certificate types: CTYPE-X.509
Protocols: VERS-TLS1.2, VERS-TLS1.1, VERS-TLS1.0, VERS-SSL3.0, VERS-DTLS1.0
Compression: COMP-NULL
Elliptic curves: CURVE-SECP384R1, CURVE-SECP521R1
PK-signatures: SIGN-RSA-SHA384, SIGN-ECDSA-SHA384, SIGN-RSA-SHA512, SIGN-ECDSA-SHA512
π Connecting using a PKCS #11 token
To connect to a server using a certificate and a private key present in a PKCS #11 token you need to substitute the PKCS 11 URLs in the x509certfile and x509keyfile parameters.
Those can be found using p11tool --list-tokens and then listing all the objects in the needed token, and using the appropriate.
$ p11tool --list-tokens
Token 0:
URL: pkcs11:model=PKCS15;manufacturer=MyMan;serial=1234;token=Test
Label: Test
Manufacturer: EnterSafe
Model: PKCS15
Serial: 1234
$ p11tool --login --list-certs "pkcs11:model=PKCS15;manufacturer=MyMan;serial=1234;token=Test"
Object 0:
URL: pkcs11:model=PKCS15;manufacturer=MyMan;serial=1234;token=Test;object=client;type=cert
Type: X.509 Certificate
Label: client
ID: 2a:97:0d:58:d1:51:3c:23:07:ae:4e:0d:72:26:03:7d:99:06:02:6a
$ MYCERT="pkcs11:model=PKCS15;manufacturer=MyMan;serial=1234;token=Test;object=client;type=cert"
$ MYKEY="pkcs11:model=PKCS15;manufacturer=MyMan;serial=1234;token=Test;object=client;type=private"
$ export MYCERT MYKEY
$ gnutls-cli www.example.com --x509keyfile $MYKEY --x509certfile $MYCERT
Notice that the private key only differs from the certificate in the type. one word difference and it changes everything, it's giving main character energy β
πͺ EXIT STATUS πͺ
One of the following exit values will be returned:
0(EXIT_SUCCESS) β Successful program execution. we love a happy ending π«Ά1(EXIT_FAILURE) β The operation failed or the command syntax was not valid. π
π SEE ALSO π
βοΈ AUTHORS βοΈ
ngl bestie, this section is just a heading and nothing else β no names, no nothing. the mystery of it all π
Β©οΈ COPYRIGHT Β©οΈ
Copyright (C) 2020-2023 Free Software Foundation, and others all rights reserved. This program is released under the terms of the GNU General Public License, version 3 or later.
π BUGS π
Please send bug reports to: bugs@gnutls.org
Found something cursed? Tell the maintainers, not your group chat. They actually fix things π
and that's the whole page, bestie β you made it to the end, iconic behavior fr fr πΈ This one's gnutls-cli version 3.8.13, dated 29 Apr 2026, and yes it's a GNU thing so you already know the license situation. go forth and handshake responsibly π
β¨
π¦ where this page comes from
- alpine 3.22: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- alpine 3.23: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- alpine 3.24: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- arch rolling: gnutls 3.8.13-3 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 43: gnutls-utils 3.8.13-1.fc43 Β· GPL-3.0-or-later
- fedora 44: gnutls-utils 3.8.13-1.fc44 Β· GPL-3.0-or-later
- nixpkgs unstable: gnutls 3.8.13
- ubuntu stonking: gnutls-bin 3.8.13-1ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms