[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
9.2 Invoking gnutls-serv
Server program that listens to incoming TLS connections.
This section was generated by AutoGen,
using the agtexi-cmd
template and the option descriptions for the gnutls-serv
program.
This software is released under the GNU General Public License, version 3 or later.
gnutls-serv usage (-h)
This is the automatically generated usage text for gnutls-serv:
gnutls-serv - GnuTLS server - Ver. 3.0.17 USAGE: gnutls-serv [ -<flag> [<val>] | --<name>[{=| }<val>] ]... -d, --debug=num Enable debugging. - It must be in the range: 0 to 9999 --noticket Don't accept session tickets -g, --generate Generate Diffie-Hellman and RSA-export parameters -q, --quiet Suppress some messages --nodb Do not use a resumption database --http Act as an HTTP server --echo Act as an Echo server -u, --udp Use DTLS (datagram TLS) over UDP --mtu=num Set MTU for datagram TLS - It must be in the range: 0 to 17000 -a, --disable-client-cert Do not request a client certificate -r, --require-client-cert Require a client certificate --x509fmtder Use DER format for certificates to read from --priority=str Priorities string --dhparams=file DH params file to use - file must pre-exist --x509cafile=str Certificate file or PKCS #11 URL to use --x509crlfile=file CRL file to use - file must pre-exist --pgpkeyfile=file PGP Key file to use - file must pre-exist --pgpkeyring=file PGP Key ring file to use - file must pre-exist --pgpcertfile=file PGP Public Key (certificate) file to use - file must pre-exist --x509keyfile=str X.509 key file or PKCS #11 URL to use --x509certfile=str X.509 Certificate file or PKCS #11 URL to use --x509dsakeyfile=str Alternative X.509 key file or PKCS #11 URL to use --x509dsacertfile=str Alternative X.509 Certificate file or PKCS #11 URL to use --x509ecckeyfile=str Alternative X.509 key file or PKCS #11 URL to use --x509ecccertfile=str Alternative X.509 Certificate file or PKCS #11 URL to use --pgpsubkey=str PGP subkey to use (hex or auto) --srppasswd=file SRP password file to use - file must pre-exist --srppasswdconf=file SRP password configuration file to use - file must pre-exist --pskpasswd=file PSK password file to use - file must pre-exist --pskhint=str PSK identity hint to use -p, --port=num The port to connect to -l, --list Print a list of the supported algorithms and modes -v, --version[=arg] Output version information and exit -h, --help Display extended usage information and exit -!, --more-help Extended usage information passed thru pager Options are specified by doubled hyphens and their name or by a single hyphen and the flag character. Server program that listens to incoming TLS connections. please send bug reports to: bug-gnutls@gnu.org
debug option (-d)
This is the “enable debugging.” option. Specifies the debug level.
dhparams option
This is the “dh params file to use” option.
disable-client-cert option (-a)
This is the “do not request a client certificate” option.
echo option
This is the “act as an echo server” option.
generate option (-g)
This is the “generate diffie-hellman and rsa-export parameters” option.
http option
This is the “act as an http server” option.
list option (-l)
This is the “print a list of the supported algorithms and modes” option. Print a list of the supported algorithms and modes. If a priority string is given then only the enabled ciphersuites are shown.
mtu option
This is the “set mtu for datagram tls” option.
nodb option
This is the “do not use a resumption database” option.
noticket option
This is the “don’t accept session tickets” option.
pgpcertfile option
This is the “pgp public key (certificate) file to use” option.
pgpkeyfile option
This is the “pgp key file to use” option.
pgpkeyring option
This is the “pgp key ring file to use” option.
pgpsubkey option
This is the “pgp subkey to use (hex or auto)” option.
port option (-p)
This is the “the port to connect to” option.
priority option
This is the “priorities string” option. TLS algorithms and protocols to enable. You can use predefined sets of ciphersuites such as PERFORMANCE, NORMAL, SECURE128, SECURE256.
Check the GnuTLS manual on section “Priority strings” for more information on allowed keywords
pskhint option
This is the “psk identity hint to use” option.
pskpasswd option
This is the “psk password file to use” option.
quiet option (-q)
This is the “suppress some messages” option.
require-client-cert option (-r)
This is the “require a client certificate” option.
srppasswd option
This is the “srp password file to use” option.
srppasswdconf option
This is the “srp password configuration file to use” option.
udp option (-u)
This is the “use dtls (datagram tls) over udp” option.
x509cafile option
This is the “certificate file or pkcs #11 url to use” option.
x509certfile option
This is the “x.509 certificate file or pkcs #11 url to use” option.
x509crlfile option
This is the “crl file to use” option.
x509dsacertfile option
This is the “alternative x.509 certificate file or pkcs #11 url to use” option.
x509dsakeyfile option
This is the “alternative x.509 key file or pkcs #11 url to use” option.
x509ecccertfile option
This is the “alternative x.509 certificate file or pkcs #11 url to use” option.
x509ecckeyfile option
This is the “alternative x.509 key file or pkcs #11 url to use” option.
x509fmtder option
This is the “use der format for certificates to read from” option.
x509keyfile option
This is the “x.509 key file or pkcs #11 url to use” option.
gnutls-serv exit status
One of the following exit values will be returned:
- ‘0’
Successful program execution.
- ‘1’
The operation failed or the command syntax was not valid.
gnutls-serv See Also
gnutls-cli-debug(1), gnutls-cli(1)
gnutls-serv 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 gnutls-serv
as a simple HTTPS server.
The most basic server can be started as:
gnutls-serv --http
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 = 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.
$ 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 ...enter whatever details you want, use 'test.gnutls.org' as name...
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 \ --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 \ --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 \ --pskpasswd psk-passwd.txt
Finally, we start the server with all the earlier parameters and you get this command:
gnutls-serv --http \ --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
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on March 23, 2012 using texi2html 5.0.