gnutls-serv(1)
β¨ NAME β¨
okay so real talk, this is the gnutls-serv(1) page and it lives in the User Commands section of the manual π it is, and I cannot stress this enough, the GnuTLS server π
gnutls-serv β GnuTLS server
π¦ SYNOPSIS π¦
gnutls-serv [-flags] [-flag [value]] [--option-name[[=| ]value]]
bestie listen π All arguments must be options. every single one. there is no "just throw a filename at the end" energy here, she simply will not accept it.
π DESCRIPTION π
It's a server program that listens to incoming TLS connections, she's just sitting there, waiting, serving π«Ά
but no cap: this program is only meant for testing and diagnostic purposes. it is not your production queen. it is a vibe-checking tool. do not build your empire on her π
π OPTIONS π
she has so many options, and I love that for her. here's every single one, no skips, no shortcuts π
-d num,--debug=numβ Enable debugging. This option takes an integer number as its argument.- the value of
numis constrained to being in the range0through9999 - Specifies the debug level. turn it up and watch her yap about everything π₯
- the value of
--sni-hostname=strβ Server's hostname for server name extension.- Server name of type
host_namethat the server will recognise as its own. If the server receives a client hello with a different name, it will send a warning-levelunrecognized_namealert. like "not me, that's not my name, wrong girl" π
- Server name of type
--sni-hostname-fatalβ Send fatal alert onsni-hostnamemismatch. so instead of a cute little warning she just fully ends it π--alpn=strβ Specify ALPN protocol to be enabled by the server. This option may appear an unlimited number of times β¨- Specify the (textual) ALPN protocol for the server to use.
--alpn-fatalβ Send fatal alert on non-matching ALPN name. no match, no mercy.--noticketβ Don't accept session tickets.--earlydataβ Accept early data.--maxearlydata=numβ The maximum early data size to accept. This option takes an integer number as its argument.- the value of
numis constrained to being in the range1through2147483648
- the value of
--nocookieβ Don't require cookie on DTLS sessions.-g,--generateβ Generate Diffie-Hellman parameters.-q,--quietβ Suppress some messages. she's being demure π--nodbβ Do not use a resumption database.--httpβ Act as an HTTP server.--echoβ Act as an Echo server.--crlfβ Do not replace CRLF by LF in Echo server mode.-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 of
numis constrained to being in the range0through17000
- the value of
--srtp-profiles=strβ Offer SRTP profiles.-a,--disable-client-certβ Do not request a client certificate.- β οΈ this option must not appear in combination with
require-client-cert. pick a lane bestie, you cannot do both π€
- β οΈ this option must not appear in combination with
-r,--require-client-certβ Require a client certificate.- This option before
3.6.0used to imply--verify-client-cert. Since3.6.0it will no longer verify the certificate by default. glow-up era, she changed β¨
- This option before
--verify-client-certβ If a client certificate is sent then verify it.- Do not require, but if a client certificate is sent then verify it and close the connection if invalid.
--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.- Regularly ping client via heartbeat extension messages π it's giving "u up?"
--x509fmtderβ Use DER format for certificates to read from.--priority=strβ Priorities string.- TLS algorithms and protocols to enable. You can use predefined sets of ciphersuites such as
PERFORMANCE,NORMAL,SECURE128,SECURE256. The default isNORMAL. - Check the GnuTLS manual on section βPriority stringsβ for more information on allowed keywords.
- TLS algorithms and protocols to enable. You can use predefined sets of ciphersuites such as
--dhparams=fileβ DH params file to use.--x509cafile=strβ Certificate file or PKCS #11 URL to use.--x509crlfile=fileβ CRL file to use.--pgpkeyfile=fileβ PGP Key file to use.
NOTE: THIS OPTION IS DEPRECATED π©
--x509keyfile=strβ X.509 key file or PKCS #11 URL to use. This option may appear an unlimited number of times.- Specify the private key file or URI to use; it must correspond to the certificate specified in
--x509certfile. Multiple keys and certificates can be specified with this option and in that case each occurrence ofkeyfilemust be followed by the correspondingx509certfileor vice-versa. they come as a matched set, like a friendship bracelet situation π«Ά
- Specify the private key file or URI to use; it must correspond to the certificate specified in
--x509certfile=strβ X.509 Certificate file or PKCS #11 URL to use. This option may appear an unlimited number of times.- Specify the certificate file or URI to use; it must correspond to the key specified in
--x509keyfile. Multiple keys and certificates can be specified with this option and in that case each occurrence ofkeyfilemust be followed by the correspondingx509certfileor vice-versa.
- Specify the certificate file or URI to use; it must correspond to the key specified in
--x509dsakeyfileβ This is an alias for the--x509keyfileoption.
NOTE: THIS OPTION IS DEPRECATED π©
--x509dsacertfileβ This is an alias for the--x509certfileoption.
NOTE: THIS OPTION IS DEPRECATED π©
--x509ecckeyfileβ This is an alias for the--x509keyfileoption.
NOTE: THIS OPTION IS DEPRECATED π©
--x509ecccertfileβ This is an alias for the--x509certfileoption.
NOTE: THIS OPTION IS DEPRECATED π©
--rawpkkeyfile=strβ Private key file (PKCS #8 or PKCS #12) or PKCS #11 URL to use. This option may appear an unlimited number of times.- Specify the private key file or URI to use; it must correspond to the raw public-key specified in
--rawpkfile. Multiple key pairs can be specified with this option and in that case each occurrence ofkeyfilemust be followed by the correspondingrawpkfileor vice-versa. - 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-*andCTYPE-SRV-*flags). - Check the GnuTLS manual on section βPriority stringsβ for more information on how to set certificate types.
- Specify the private key file or URI to use; it must correspond to the raw public-key specified in
--rawpkfile=strβ Raw public-key file to use. This option may appear an unlimited number of times. This option must appear in combination with the following options:rawpkkeyfile. (yes she needs her partner in crime, no solo missions π )- Specify the raw public-key file to use; it must correspond to the private key specified in
--rawpkkeyfile. Multiple key pairs can be specified with this option and in that case each occurrence ofkeyfilemust be followed by the correspondingrawpkfileor vice-versa. - 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-*andCTYPE-SRV-*flags). - Check the GnuTLS manual on section βPriority stringsβ for more information on how to set certificate types.
- Specify the raw public-key file to use; it must correspond to the private key specified in
--srppasswd=fileβ SRP password file to use.--srppasswdconf=fileβ SRP password configuration file to use.--pskpasswd=fileβ PSK password file to use.--pskhint=strβ PSK identity hint to use.--ocsp-response=strβ The OCSP response to send to client. This option may appear an unlimited number of times.- If the client requested an OCSP response, return data from this file to the client.
--ignore-ocsp-response-errorsβ Ignore any errors when setting the OCSP response.- That option instructs gnutls to not attempt to match the provided OCSP responses with the certificates. she's choosing peace π§
-p num,--port=numβ The port to connect to. This option takes an integer number as its argument.-l,--listβ Print a list of the supported algorithms and modes.- Print a list of the supported algorithms and modes. If a priority string is given then only the enabled ciphersuites are shown. window shopping but make it crypto ποΈ
--provider=fileβ Specify the PKCS #11 provider library.- This will override the default options in
/etc/gnutls/pkcs11.conf
- This will override the default options in
--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.--recordsize=numβ The maximum record size to advertise. This option takes an integer number as its argument.- the value of
numis constrained to being in the range0through16384
- the value of
--httpdata=fileβ The data used as HTTP response.--timeout=numβ The timeout period for server. This option takes an integer number as its argument.--attime=timestampβ Perform validation at the timestamp instead of the system time.timestampis 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'. time travel but legal β³
-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.-!,--more-helpβ Pass the extended usage information through a pager.
π₯ EXAMPLES π₯
okay this is the part where she really shines, let's get into it π
Running your own TLS server based on GnuTLS can be useful when debugging clients and/or GnuTLS itself. This section describes how to use gnutls-serv as a simple HTTPS server.
The most basic server can be started as:
gnutls-serv --http --priority "NORMAL:+ANON-ECDH:+ANON-DH"
quick note: It will only support anonymous ciphersuites, which many TLS clients refuse to use. so like, she works, but the clients are picky π
The next step is to add support for X.509. First we generate a CA:
$ certtool --generate-privkey > x509-ca-key.pem
$ echo 'cn = GnuTLS test CA' > ca.tmpl
$ echo 'ca' >> ca.tmpl
$ echo 'cert_signing_key' >> ca.tmpl
$ certtool --generate-self-signed --load-privkey x509-ca-key.pem --template ca.tmpl --outfile x509-ca.pem
Then generate a server certificate. Remember to change the dns_name value to the name of your server host, or skip that command to avoid the field. (yes bestie, actually change it, don't just copy paste and hope π)
$ certtool --generate-privkey > x509-server-key.pem
$ echo 'organization = GnuTLS test server' > server.tmpl
$ echo 'cn = test.gnutls.org' >> server.tmpl
$ echo 'tls_www_server' >> server.tmpl
$ echo 'encryption_key' >> server.tmpl
$ echo 'signing_key' >> server.tmpl
$ echo 'dns_name = test.gnutls.org' >> server.tmpl
$ certtool --generate-certificate --load-privkey x509-server-key.pem --load-ca-certificate x509-ca.pem --load-ca-privkey x509-ca-key.pem --template server.tmpl --outfile x509-server.pem
For use in the client, you may want to generate a client certificate as well. twin certificates, obsessed π
$ certtool --generate-privkey > x509-client-key.pem
$ echo 'cn = GnuTLS test client' > client.tmpl
$ echo 'tls_www_client' >> client.tmpl
$ echo 'encryption_key' >> client.tmpl
$ echo 'signing_key' >> client.tmpl
$ certtool --generate-certificate --load-privkey x509-client-key.pem --load-ca-certificate x509-ca.pem --load-ca-privkey x509-ca-key.pem --template client.tmpl --outfile x509-client.pem
To be able to import the client key/certificate into some applications, you will need to convert them into a PKCS#12 structure. This also encrypts the security sensitive key with a password. π
$ certtool --to-p12 --load-ca-certificate x509-ca.pem --load-privkey x509-client-key.pem --load-certificate x509-client.pem --outder --outfile x509-client.p12
And for icing π we're gonna make a proxy certificate for the client too, because we're extra and we know it.
$ certtool --generate-privkey > x509-proxy-key.pem
$ echo 'cn = GnuTLS test client proxy' > proxy.tmpl
$ certtool --generate-proxy --load-privkey x509-proxy-key.pem --load-ca-certificate x509-client.pem --load-ca-privkey x509-client-key.pem --load-certificate x509-client.pem --template proxy.tmpl --outfile x509-proxy.pem
Then start the server again, bestie:
$ gnutls-serv --http --x509cafile x509-ca.pem --x509keyfile x509-server-key.pem --x509certfile x509-server.pem
Try connecting to the server using your web browser π
and note that the server listens to port 5556 by default. Like, that's the whole vibe, no cap.
While you are at it, to allow connections using ECDSA, you can also create a ECDSA key and certificate for the server. These credentials will be used in the final example below β¨
$ certtool --generate-privkey --ecdsa > x509-server-key-ecc.pem
$ certtool --generate-certificate --load-privkey x509-server-key-ecc.pem --load-ca-certificate x509-ca.pem --load-ca-privkey x509-ca-key.pem --template server.tmpl --outfile x509-server-ecc.pem
The next step is to add support for SRP authentication. This requires an SRP password file created with srptool. To start the server with SRP support:
gnutls-serv --http --priority NORMAL:+SRP-RSA:+SRP --srppasswdconf srp-tpasswd.conf --srppasswd srp-passwd.txt
Let's also start a server with support for PSK π¦ This would require a password file created with psktool.
gnutls-serv --http --priority NORMAL:+ECDHE-PSK:+PSK --pskpasswd psk-passwd.txt
If you want a server with support for raw public-keys we can also add these credentials. Note however that there is no identity information linked to these keys as is the case with regular x509 certificates β authentication must be done via different means, fr fr. Also we need to explicitly enable raw public-key certificates via the priority strings.
gnutls-serv --http --priority NORMAL:+CTYPE-CLI-RAWPK:+CTYPE-SRV-RAWPK --rawpkfile srv.rawpk.pem --rawpkkeyfile srv.key.pem
Finally, we start the server with all the earlier parameters and you get this command π
gnutls-serv --http --priority NORMAL:+PSK:+SRP:+CTYPE-CLI-RAWPK:+CTYPE-SRV-RAWPK --x509cafile x509-ca.pem --x509keyfile x509-server-key.pem --x509certfile x509-server.pem --x509keyfile x509-server-key-ecc.pem --x509certfile x509-server-ecc.pem --srppasswdconf srp-tpasswd.conf --srppasswd srp-passwd.txt --pskpasswd psk-passwd.txt --rawpkfile srv.rawpk.pem --rawpkkeyfile srv.key.pem
β¨ EXIT STATUS β¨
One of the following exit values will be returned, bestie, so like, check these π:
0(EXIT_SUCCESS) β Successful program execution. We ate. π1(EXIT_FAILURE) β The operation failed or the command syntax was not valid. It's giving not slay π
πΈ SEE ALSO πΈ
iykyk, go read those next π«Ά
π AUTHORS π
(the original page literally leaves this one blank, bestie β so here's nothing but love and vibes for whoever wrote this π)
π 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 β do NOT suffer in silence, that's not the move π
That's the whole page, babes β¨ This one's from the gnutls-serv(1) manual, version 3.8.13, dated 29 Apr 2026. Go forth and serve ππ
π¦ 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