.de1 NOP . it 1 an-trap . if \\n[.$] \,\\$*\/ .. .ie t \ .ds B-Font [CB] .ds I-Font [CI] .ds R-Font [CR] .el \ .ds B-Font B .ds I-Font I .ds R-Font R .TH gnutls-serv 1 "01 Jul 2017" "3.3.8" "User Commands" .\" .\" DO NOT EDIT THIS FILE (in-mem file) .\" .\" It has been AutoGen-ed .\" From the definitions ../../src/serv-args.def.tmp .\" and the template file agman-cmd.tpl .SH NAME \f\*[B-Font]gnutls-serv\fP \- GnuTLS server .SH SYNOPSIS \f\*[B-Font]gnutls-serv\fP .\" Mixture of short (flag) options and long options [\f\*[B-Font]\-flags\f[]] [\f\*[B-Font]\-flag\f[] [\f\*[I-Font]value\f[]]] [\f\*[B-Font]\-\-option-name\f[][[=| ]\f\*[I-Font]value\f[]]] .sp \n(Ppu .ne 2 All arguments must be options. .sp \n(Ppu .ne 2 .SH "DESCRIPTION" Server program that listens to incoming TLS connections. .SH "OPTIONS" .TP .NOP \f\*[B-Font]\-d\f[] \f\*[I-Font]number\f[], \f\*[B-Font]\-\-debug\f[]=\f\*[I-Font]number\f[] Enable debugging. This option takes an integer number as its argument. The value of \f\*[I-Font]number\f[] is constrained to being: .in +4 .nf .na in the range 0 through 9999 .fi .in -4 .sp Specifies the debug level. .TP .NOP \f\*[B-Font]\-\-noticket\f[] Don't accept session tickets. .sp .TP .NOP \f\*[B-Font]\-g\f[], \f\*[B-Font]\-\-generate\f[] Generate Diffie-Hellman and RSA-export parameters. .sp .TP .NOP \f\*[B-Font]\-q\f[], \f\*[B-Font]\-\-quiet\f[] Suppress some messages. .sp .TP .NOP \f\*[B-Font]\-\-nodb\f[] Do not use a resumption database. .sp .TP .NOP \f\*[B-Font]\-\-http\f[] Act as an HTTP server. .sp .TP .NOP \f\*[B-Font]\-\-echo\f[] Act as an Echo server. .sp .TP .NOP \f\*[B-Font]\-u\f[], \f\*[B-Font]\-\-udp\f[] Use DTLS (datagram TLS) over UDP. .sp .TP .NOP \f\*[B-Font]\-\-mtu\f[]=\f\*[I-Font]number\f[] Set MTU for datagram TLS. This option takes an integer number as its argument. The value of \f\*[I-Font]number\f[] is constrained to being: .in +4 .nf .na in the range 0 through 17000 .fi .in -4 .sp .TP .NOP \f\*[B-Font]\-\-srtp\-profiles\f[]=\f\*[I-Font]string\f[] Offer SRTP profiles. .sp .TP .NOP \f\*[B-Font]\-a\f[], \f\*[B-Font]\-\-disable\-client\-cert\f[] Do not request a client certificate. .sp .TP .NOP \f\*[B-Font]\-r\f[], \f\*[B-Font]\-\-require\-client\-cert\f[] Require a client certificate. .sp .TP .NOP \f\*[B-Font]\-\-verify\-client\-cert\f[] If a client certificate is sent then verify it.. .sp Do not require, but if a client certificate is sent then verify it and close the connection if invalid. .TP .NOP \f\*[B-Font]\-b\f[], \f\*[B-Font]\-\-heartbeat\f[] Activate heartbeat support. .sp Regularly ping client via heartbeat extension messages .TP .NOP \f\*[B-Font]\-\-x509fmtder\f[] Use DER format for certificates to read from. .sp .TP .NOP \f\*[B-Font]\-\-priority\f[]=\f\*[I-Font]string\f[] Priorities string. .sp TLS algorithms and protocols to enable. You can use predefined sets of ciphersuites such as PERFORMANCE, NORMAL, SECURE128, SECURE256. The default is NORMAL. .sp Check the GnuTLS manual on section \(lqPriority strings\(rq for more information on allowed keywords .TP .NOP \f\*[B-Font]\-\-dhparams\f[]=\f\*[I-Font]file\f[] DH params file to use. .sp .TP .NOP \f\*[B-Font]\-\-x509cafile\f[]=\f\*[I-Font]string\f[] Certificate file or PKCS #11 URL to use. .sp .TP .NOP \f\*[B-Font]\-\-x509crlfile\f[]=\f\*[I-Font]file\f[] CRL file to use. .sp .TP .NOP \f\*[B-Font]\-\-pgpkeyfile\f[]=\f\*[I-Font]file\f[] PGP Key file to use. .sp .TP .NOP \f\*[B-Font]\-\-pgpkeyring\f[]=\f\*[I-Font]file\f[] PGP Key ring file to use. .sp .TP .NOP \f\*[B-Font]\-\-pgpcertfile\f[]=\f\*[I-Font]file\f[] PGP Public Key (certificate) file to use. .sp .TP .NOP \f\*[B-Font]\-\-x509keyfile\f[]=\f\*[I-Font]string\f[] X.509 key file or PKCS #11 URL to use. .sp .TP .NOP \f\*[B-Font]\-\-x509certfile\f[]=\f\*[I-Font]string\f[] X.509 Certificate file or PKCS #11 URL to use. .sp .TP .NOP \f\*[B-Font]\-\-x509dsakeyfile\f[]=\f\*[I-Font]string\f[] Alternative X.509 key file or PKCS #11 URL to use. .sp .TP .NOP \f\*[B-Font]\-\-x509dsacertfile\f[]=\f\*[I-Font]string\f[] Alternative X.509 Certificate file or PKCS #11 URL to use. .sp .TP .NOP \f\*[B-Font]\-\-x509ecckeyfile\f[]=\f\*[I-Font]string\f[] Alternative X.509 key file or PKCS #11 URL to use. .sp .TP .NOP \f\*[B-Font]\-\-x509ecccertfile\f[]=\f\*[I-Font]string\f[] Alternative X.509 Certificate file or PKCS #11 URL to use. .sp .TP .NOP \f\*[B-Font]\-\-pgpsubkey\f[]=\f\*[I-Font]string\f[] PGP subkey to use (hex or auto). .sp .TP .NOP \f\*[B-Font]\-\-srppasswd\f[]=\f\*[I-Font]file\f[] SRP password file to use. .sp .TP .NOP \f\*[B-Font]\-\-srppasswdconf\f[]=\f\*[I-Font]file\f[] SRP password configuration file to use. .sp .TP .NOP \f\*[B-Font]\-\-pskpasswd\f[]=\f\*[I-Font]file\f[] PSK password file to use. .sp .TP .NOP \f\*[B-Font]\-\-pskhint\f[]=\f\*[I-Font]string\f[] PSK identity hint to use. .sp .TP .NOP \f\*[B-Font]\-\-ocsp\-response\f[]=\f\*[I-Font]file\f[] The OCSP response to send to client. .sp If the client requested an OCSP response, return data from this file to the client. .TP .NOP \f\*[B-Font]\-p\f[] \f\*[I-Font]number\f[], \f\*[B-Font]\-\-port\f[]=\f\*[I-Font]number\f[] The port to connect to. This option takes an integer number as its argument. .sp .TP .NOP \f\*[B-Font]\-l\f[], \f\*[B-Font]\-\-list\f[] Print a list of the supported algorithms and modes. .sp Print a list of the supported algorithms and modes. If a priority string is given then only the enabled ciphersuites are shown. .TP .NOP \f\*[B-Font]\-h\f[], \f\*[B-Font]\-\-help\f[] Display usage information and exit. .TP .NOP \f\*[B-Font]\-\&!\f[], \f\*[B-Font]\-\-more-help\f[] Pass the extended usage information through a pager. .TP .NOP \f\*[B-Font]\-v\f[] [{\f\*[I-Font]v|c|n\f[] \f\*[B-Font]\-\-version\f[] [{\f\*[I-Font]v|c|n\f[]}]}] 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. .PP .SH EXAMPLES Running your own TLS server based on GnuTLS can be useful when debugging clients and/or GnuTLS itself. This section describes how to use \fBgnutls\-serv\fP as a simple HTTPS server. .sp The most basic server can be started as: .sp .br .in +4 .nf gnutls\-serv \-\-http \-\-priority "NORMAL:+ANON\-ECDH:+ANON\-DH" .in -4 .fi .sp It will only support anonymous ciphersuites, which many TLS clients refuse to use. .sp The next step is to add support for X.509. First we generate a CA: .sp .br .in +4 .nf $ 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 ... .in -4 .fi .sp 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. .sp .br .in +4 .nf $ 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 ... .in -4 .fi .sp For use in the client, you may want to generate a client certificate as well. .sp .br .in +4 .nf $ 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 ... .in -4 .fi .sp 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. .sp .br .in +4 .nf $ 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 .in -4 .fi .sp For icing, we'll create a proxy certificate for the client too. .sp .br .in +4 .nf $ 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 ... .in -4 .fi .sp Then start the server again: .sp .br .in +4 .nf $ gnutls\-serv \-\-http \ \-\-x509cafile x509\-ca.pem \ \-\-x509keyfile x509\-server\-key.pem \ \-\-x509certfile x509\-server.pem .in -4 .fi .sp Try connecting to the server using your web browser. Note that the server listens to port 5556 by default. .sp 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. .sp .br .in +4 .nf $ 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 ... .in -4 .fi .sp The next step is to create OpenPGP credentials for the server. .sp .br .in +4 .nf gpg \-\-gen\-key ...enter whatever details you want, use 'test.gnutls.org' as name... .in -4 .fi .sp Make a note of the OpenPGP key identifier of the newly generated key, here it was \fB5D1D14D8\fP. You will need to export the key for GnuTLS to be able to use it. .sp .br .in +4 .nf 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 .in -4 .fi .sp Let's start the server with support for OpenPGP credentials: .sp .br .in +4 .nf gnutls\-serv \-\-http \-\-priority NORMAL:+CTYPE\-OPENPGP \ \-\-pgpkeyfile openpgp\-server\-key.txt \ \-\-pgpcertfile openpgp\-server.txt .in -4 .fi .sp The next step is to add support for SRP authentication. This requires an SRP password file created with \fBsrptool\fP. To start the server with SRP support: .sp .br .in +4 .nf gnutls\-serv \-\-http \-\-priority NORMAL:+SRP\-RSA:+SRP \ \-\-srppasswdconf srp\-tpasswd.conf \ \-\-srppasswd srp\-passwd.txt .in -4 .fi .sp Let's also start a server with support for PSK. This would require a password file created with \fBpsktool\fP. .sp .br .in +4 .nf gnutls\-serv \-\-http \-\-priority NORMAL:+ECDHE\-PSK:+PSK \ \-\-pskpasswd psk\-passwd.txt .in -4 .fi .sp Finally, we start the server with all the earlier parameters and you get this command: .sp .br .in +4 .nf 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 .in -4 .fi .SH "EXIT STATUS" One of the following exit values will be returned: .TP .NOP 0 " (EXIT_SUCCESS)" Successful program execution. .TP .NOP 1 " (EXIT_FAILURE)" The operation failed or the command syntax was not valid. .TP .NOP 70 " (EX_SOFTWARE)" libopts had an internal operational error. Please report it to autogen-users@lists.sourceforge.net. Thank you. .PP .SH "SEE ALSO" gnutls\-cli\-debug(1), gnutls\-cli(1) .SH "AUTHORS" Nikos Mavrogiannopoulos, Simon Josefsson and others; see /usr/share/doc/gnutls/AUTHORS for a complete list. .SH "COPYRIGHT" Copyright (C) 2000-2014 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. .SH "BUGS" Please send bug reports to: bugs@gnutls.org .SH "NOTES" This manual page was \fIAutoGen\fP-erated from the \fBgnutls-serv\fP option definitions.