Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages

Manual Reference Pages  -  GNUTLS-SERV (1)


-Font]gnutls-serv - GnuTLS server




-Font]gnutls-serv [-Font]-flags]] [-Font]-flag] [-Font]value]]] [-Font]--option-name][[=| ]-Font]value]]]

All arguments must be options.


Server program that listens to incoming TLS connections.


Enable debugging.
  This option takes an integer number as its argument. The value of -Font]number] is constrained to being:

in the range  0 through 9999

Specifies the debug level.

Don’t accept session tickets.

Generate Diffie-Hellman parameters.

Suppress some messages.

Do not use a resumption database.

Act as an HTTP server.

Act as an Echo server.

Use DTLS (datagram TLS) over UDP.

Set MTU for datagram TLS.
  This option takes an integer number as its argument. The value of -Font]number] is constrained to being:

in the range  0 through 17000

Offer SRTP profiles.

Do not request a client certificate.

Require a client certificate.

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.

Activate heartbeat support.

Regularly ping client via heartbeat extension messages

Use DER format for certificates to read from.

Priorities string.

TLS algorithms and protocols to enable. You can use predefined sets of ciphersuites such as PERFORMANCE, NORMAL, SECURE128, SECURE256. The default is NORMAL.

Check the GnuTLS manual on section \(lqPriority strings\(rq for more information on allowed keywords

DH params file to use.

Certificate file or PKCS #11 URL to use.

CRL file to use.

PGP Key file to use.

PGP Key ring file to use.

PGP Public Key (certificate) file to use.

X.509 key file or PKCS #11 URL to use.

X.509 Certificate file or PKCS #11 URL to use.

Alternative X.509 key file or PKCS #11 URL to use.

Alternative X.509 Certificate file or PKCS #11 URL to use.

Alternative X.509 key file or PKCS #11 URL to use.

Alternative X.509 Certificate file or PKCS #11 URL to use.

PGP subkey to use (hex or auto).

SRP password file to use.

SRP password configuration file to use.

PSK password file to use.

PSK identity hint to use.

The OCSP response to send to client.

If the client requested an OCSP response, return data from this file to the client.

The port to connect to.
  This option takes an integer number as its argument.

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.

Specify the PKCS #11 provider library.

This will override the default options in /etc/gnutls/pkcs11.conf

Display usage information and exit.
Pass the extended usage information through a pager.
Output version of program and exit. The default mode is ‘v’, a simple
  version. The ‘c’ mode will print copyright information and ‘n’ will print the full copyright notice.


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"

It will only support anonymous ciphersuites, which many TLS clients refuse to use.

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.

$ certtool --generate-privkey > x509-server-key.pem
$ echo ’organization = GnuTLS test server’ > server.tmpl
$ echo ’cn =’ >> server.tmpl
$ echo ’tls_www_server’ >> server.tmpl
$ echo ’encryption_key’ >> server.tmpl
$ echo ’signing_key’ >> server.tmpl
$ echo ’dns_name =’ >> 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.

$ 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

For icing, we’ll create a proxy certificate for the client too.

$ 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:

$ 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. Note that the server listens to port 5556 by default.

While you are at it, to allow connections using DSA, you can also create a DSA key and certificate for the server. These credentials will be used in the final example below.

$ certtool --generate-privkey --dsa > x509-server-key-dsa.pem
$ certtool --generate-certificate --load-privkey x509-server-key-dsa.pem 
  --load-ca-certificate x509-ca.pem --load-ca-privkey x509-ca-key.pem 
  --template server.tmpl --outfile x509-server-dsa.pem

The next step is to create OpenPGP credentials for the server.

gpg --gen-key

Make a note of the OpenPGP key identifier of the newly generated key, here it was 5D1D14D8. You will need to export the key for GnuTLS to be able to use it.

gpg -a --export 5D1D14D8 > openpgp-server.txt
gpg --export 5D1D14D8 > openpgp-server.bin
gpg --export-secret-keys 5D1D14D8 > openpgp-server-key.bin
gpg -a --export-secret-keys 5D1D14D8 > openpgp-server-key.txt

Let’s start the server with support for OpenPGP credentials:

gnutls-serv --http --priority NORMAL:+CTYPE-OPENPGP 
            --pgpkeyfile openpgp-server-key.txt 
            --pgpcertfile openpgp-server.txt

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

Finally, we start the server with all the earlier parameters and you get this command:

gnutls-serv --http --priority NORMAL:+PSK:+SRP:+CTYPE-OPENPGP 
            --x509cafile x509-ca.pem 
            --x509keyfile x509-server-key.pem 
            --x509certfile x509-server.pem 
            --x509dsakeyfile x509-server-key-dsa.pem 
            --x509dsacertfile x509-server-dsa.pem 
            --pgpkeyfile openpgp-server-key.txt 
            --pgpcertfile openpgp-server.txt 
            --srppasswdconf srp-tpasswd.conf 
            --srppasswd srp-passwd.txt 
            --pskpasswd psk-passwd.txt


One of the following exit values will be returned:
Successful program execution.
The operation failed or the command syntax was not valid.
libopts had an internal operational error. Please report
  it to Thank you.


gnutls-cli-debug(1), gnutls-cli(1)


Nikos Mavrogiannopoulos, Simon Josefsson and others; see /usr/share/doc/gnutls/AUTHORS for a complete list.


Copyright (C) 2000-2016 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.


Please send bug reports to:


This manual page was AutoGen-erated from the gnutls-serv option definitions.
Search for    or go to Top of page |  Section 1 |  Main Index

3.4.10 GNUTLS-SERV (1) 03 Mar 2016

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.