Blame doc/invoke-gnutls-serv.texi

Packit Service 4684c1
@node gnutls-serv Invocation
Packit Service 4684c1
@section Invoking gnutls-serv
Packit Service 4684c1
@pindex gnutls-serv
Packit Service 4684c1
@ignore
Packit Service 4684c1
#  -*- buffer-read-only: t -*- vi: set ro:
Packit Service 4684c1
#
Packit Service 4684c1
# DO NOT EDIT THIS FILE   (invoke-gnutls-serv.texi)
Packit Service 4684c1
#
Packit Service 4684c1
# It has been AutoGen-ed
Packit Service 4684c1
# From the definitions    ../src/serv-args.def
Packit Service 4684c1
# and the template file   agtexi-cmd.tpl
Packit Service 4684c1
@end ignore
Packit Service 4684c1
Packit Service 4684c1
Packit Service 4684c1
Server program that listens to incoming TLS connections.
Packit Service 4684c1
Packit Service 4684c1
This section was generated by @strong{AutoGen},
Packit Service 4684c1
using the @code{agtexi-cmd} template and the option descriptions for the @code{gnutls-serv} program.
Packit Service 4684c1
This software is released under the GNU General Public License, version 3 or later.
Packit Service 4684c1
Packit Service 4684c1
Packit Service 4684c1
@anchor{gnutls-serv usage}
Packit Service 4684c1
@subheading gnutls-serv help/usage (@option{--help})
Packit Service 4684c1
@cindex gnutls-serv help
Packit Service 4684c1
Packit Service 4684c1
This is the automatically generated usage text for gnutls-serv.
Packit Service 4684c1
Packit Service 4684c1
The text printed is the same whether selected with the @code{help} option
Packit Service 4684c1
(@option{--help}) or the @code{more-help} option (@option{--more-help}).  @code{more-help} will print
Packit Service 4684c1
the usage text by passing it through a pager program.
Packit Service 4684c1
@code{more-help} is disabled on platforms without a working
Packit Service 4684c1
@code{fork(2)} function.  The @code{PAGER} environment variable is
Packit Service 4684c1
used to select the program, defaulting to @file{more}.  Both will exit
Packit Service 4684c1
with a status code of 0.
Packit Service 4684c1
Packit Service 4684c1
@exampleindent 0
Packit Service 4684c1
@example
Packit Service 4684c1
gnutls-serv - GnuTLS server
Packit Service 4684c1
Usage:  gnutls-serv [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]...
Packit Service 4684c1
Packit Service 4684c1
   -d, --debug=num            Enable debugging
Packit Service 4684c1
                                - it must be in the range:
Packit Service 4684c1
                                  0 to 9999
Packit Service 4684c1
       --sni-hostname=str     Server's hostname for server name extension
Packit Service 4684c1
       --sni-hostname-fatal   Send fatal alert on sni-hostname mismatch
Packit Service 4684c1
       --alpn=str             Specify ALPN protocol to be enabled by the server
Packit Service 4684c1
                                - may appear multiple times
Packit Service 4684c1
       --alpn-fatal           Send fatal alert on non-matching ALPN name
Packit Service 4684c1
       --noticket             Don't accept session tickets
Packit Service 4684c1
       --earlydata            Accept early data
Packit Service 4684c1
       --maxearlydata=num     The maximum early data size to accept
Packit Service 4684c1
                                - it must be in the range:
Packit Service 4684c1
                                  1 to 4294967295
Packit Service 4684c1
       --nocookie             Don't require cookie on DTLS sessions
Packit Service 4684c1
   -g, --generate             Generate Diffie-Hellman parameters
Packit Service 4684c1
   -q, --quiet                Suppress some messages
Packit Service 4684c1
       --nodb                 Do not use a resumption database
Packit Service 4684c1
       --http                 Act as an HTTP server
Packit Service 4684c1
       --echo                 Act as an Echo server
Packit Service 4684c1
   -u, --udp                  Use DTLS (datagram TLS) over UDP
Packit Service 4684c1
       --mtu=num              Set MTU for datagram TLS
Packit Service 4684c1
                                - it must be in the range:
Packit Service 4684c1
                                  0 to 17000
Packit Service 4684c1
       --srtp-profiles=str    Offer SRTP profiles
Packit Service 4684c1
   -a, --disable-client-cert  Do not request a client certificate
Packit Service 4684c1
                                - prohibits the option 'require-client-cert'
Packit Service 4684c1
   -r, --require-client-cert  Require a client certificate
Packit Service 4684c1
       --verify-client-cert   If a client certificate is sent then verify it.
Packit Service 4684c1
   -b, --heartbeat            Activate heartbeat support
Packit Service 4684c1
       --x509fmtder           Use DER format for certificates to read from
Packit Service 4684c1
       --priority=str         Priorities string
Packit Service 4684c1
       --dhparams=file        DH params file to use
Packit Service 4684c1
                                - file must pre-exist
Packit Service 4684c1
       --x509cafile=str       Certificate file or PKCS #11 URL to use
Packit Service 4684c1
       --x509crlfile=file     CRL file to use
Packit Service 4684c1
                                - file must pre-exist
Packit Service 4684c1
       --x509keyfile=str      X.509 key file or PKCS #11 URL to use
Packit Service 4684c1
                                - may appear multiple times
Packit Service 4684c1
       --x509certfile=str     X.509 Certificate file or PKCS #11 URL to use
Packit Service 4684c1
                                - may appear multiple times
Packit Service 4684c1
       --rawpkkeyfile=str     Private key file (PKCS #8 or PKCS #12) or PKCS #11 URL to use
Packit Service 4684c1
                                - may appear multiple times
Packit Service 4684c1
       --rawpkfile=str        Raw public-key file to use
Packit Service 4684c1
                                - requires the option 'rawpkkeyfile'
Packit Service 4684c1
                                - may appear multiple times
Packit Service 4684c1
       --srppasswd=file       SRP password file to use
Packit Service 4684c1
                                - file must pre-exist
Packit Service 4684c1
       --srppasswdconf=file   SRP password configuration file to use
Packit Service 4684c1
                                - file must pre-exist
Packit Service 4684c1
       --pskpasswd=file       PSK password file to use
Packit Service 4684c1
                                - file must pre-exist
Packit Service 4684c1
       --pskhint=str          PSK identity hint to use
Packit Service 4684c1
       --ocsp-response=str    The OCSP response to send to client
Packit Service 4684c1
                                - may appear multiple times
Packit Service 4684c1
       --ignore-ocsp-response-errors  Ignore any errors when setting the OCSP response
Packit Service 4684c1
   -p, --port=num             The port to connect to
Packit Service 4684c1
   -l, --list                 Print a list of the supported algorithms and modes
Packit Service 4684c1
       --provider=file        Specify the PKCS #11 provider library
Packit Service 4684c1
                                - file must pre-exist
Packit Service 4684c1
       --keymatexport=str     Label used for exporting keying material
Packit Service 4684c1
       --keymatexportsize=num Size of the exported keying material
Packit Service 4684c1
       --recordsize=num       The maximum record size to advertise
Packit Service 4684c1
                                - it must be in the range:
Packit Service 4684c1
                                  0 to 16384
Packit Service 4684c1
       --httpdata=file        The data used as HTTP response
Packit Service 4684c1
                                - file must pre-exist
Packit Service 4684c1
   -v, --version[=arg]        output version information and exit
Packit Service 4684c1
   -h, --help                 display extended usage information and exit
Packit Service 4684c1
   -!, --more-help            extended usage information passed thru pager
Packit Service 4684c1
Packit Service 4684c1
Options are specified by doubled hyphens and their name or by a single
Packit Service 4684c1
hyphen and the flag character.
Packit Service 4684c1
Packit Service 4684c1
Server program that listens to incoming TLS connections.
Packit Service 4684c1
Packit Service 4684c1
@end example
Packit Service 4684c1
@exampleindent 4
Packit Service 4684c1
Packit Service 4684c1
@anchor{gnutls-serv debug}
Packit Service 4684c1
@subheading debug option (-d)
Packit Service 4684c1
Packit Service 4684c1
This is the ``enable debugging'' option.
Packit Service 4684c1
This option takes a number argument.
Packit Service 4684c1
Specifies the debug level.
Packit Service 4684c1
@anchor{gnutls-serv sni-hostname}
Packit Service 4684c1
@subheading sni-hostname option
Packit Service 4684c1
Packit Service 4684c1
This is the ``server's hostname for server name extension'' option.
Packit Service 4684c1
This option takes a string argument.
Packit Service 4684c1
Server name of type host_name that the server will recognise as its own. If the server receives client hello with different name, it will send a warning-level unrecognized_name alert.
Packit Service 4684c1
@anchor{gnutls-serv alpn}
Packit Service 4684c1
@subheading alpn option
Packit Service 4684c1
Packit Service 4684c1
This is the ``specify alpn protocol to be enabled by the server'' option.
Packit Service 4684c1
This option takes a string argument.
Packit Service 4684c1
Packit Service 4684c1
@noindent
Packit Service 4684c1
This option has some usage constraints.  It:
Packit Service 4684c1
@itemize @bullet
Packit Service 4684c1
@item
Packit Service 4684c1
may appear an unlimited number of times.
Packit Service 4684c1
@end itemize
Packit Service 4684c1
Packit Service 4684c1
Specify the (textual) ALPN protocol for the server to use.
Packit Service 4684c1
@anchor{gnutls-serv require-client-cert}
Packit Service 4684c1
@subheading require-client-cert option (-r)
Packit Service 4684c1
Packit Service 4684c1
This is the ``require a client certificate'' option.
Packit Service 4684c1
This option before 3.6.0 used to imply --verify-client-cert.
Packit Service 4684c1
Since 3.6.0 it will no longer verify the certificate by default.
Packit Service 4684c1
@anchor{gnutls-serv verify-client-cert}
Packit Service 4684c1
@subheading verify-client-cert option
Packit Service 4684c1
Packit Service 4684c1
This is the ``if a client certificate is sent then verify it.'' option.
Packit Service 4684c1
Do not require, but if a client certificate is sent then verify it and close the connection if invalid.
Packit Service 4684c1
@anchor{gnutls-serv heartbeat}
Packit Service 4684c1
@subheading heartbeat option (-b)
Packit Service 4684c1
Packit Service 4684c1
This is the ``activate heartbeat support'' option.
Packit Service 4684c1
Regularly ping client via heartbeat extension messages
Packit Service 4684c1
@anchor{gnutls-serv priority}
Packit Service 4684c1
@subheading priority option
Packit Service 4684c1
Packit Service 4684c1
This is the ``priorities string'' option.
Packit Service 4684c1
This option takes a string argument.
Packit Service 4684c1
TLS algorithms and protocols to enable. You can
Packit Service 4684c1
use predefined sets of ciphersuites such as PERFORMANCE,
Packit Service 4684c1
NORMAL, SECURE128, SECURE256. The default is NORMAL.
Packit Service 4684c1
Packit Service 4684c1
Check  the  GnuTLS  manual  on  section  ``Priority strings'' for more
Packit Service 4684c1
information on allowed keywords
Packit Service 4684c1
@anchor{gnutls-serv x509keyfile}
Packit Service 4684c1
@subheading x509keyfile option
Packit Service 4684c1
Packit Service 4684c1
This is the ``x.509 key file or pkcs #11 url to use'' option.
Packit Service 4684c1
This option takes a string argument.
Packit Service 4684c1
Packit Service 4684c1
@noindent
Packit Service 4684c1
This option has some usage constraints.  It:
Packit Service 4684c1
@itemize @bullet
Packit Service 4684c1
@item
Packit Service 4684c1
may appear an unlimited number of times.
Packit Service 4684c1
@end itemize
Packit Service 4684c1
Packit Service 4684c1
Specify the private key file or URI to use; it must correspond to
Packit Service 4684c1
the certificate specified in --x509certfile. Multiple keys and certificates
Packit Service 4684c1
can be specified with this option and in that case each occurrence of keyfile
Packit Service 4684c1
must be followed by the corresponding x509certfile or vice-versa.
Packit Service 4684c1
@anchor{gnutls-serv x509certfile}
Packit Service 4684c1
@subheading x509certfile option
Packit Service 4684c1
Packit Service 4684c1
This is the ``x.509 certificate file or pkcs #11 url to use'' option.
Packit Service 4684c1
This option takes a string argument.
Packit Service 4684c1
Packit Service 4684c1
@noindent
Packit Service 4684c1
This option has some usage constraints.  It:
Packit Service 4684c1
@itemize @bullet
Packit Service 4684c1
@item
Packit Service 4684c1
may appear an unlimited number of times.
Packit Service 4684c1
@end itemize
Packit Service 4684c1
Packit Service 4684c1
Specify the certificate file or URI to use; it must correspond to
Packit Service 4684c1
the key specified in --x509keyfile. Multiple keys and certificates
Packit Service 4684c1
can be specified with this option and in that case each occurrence of keyfile
Packit Service 4684c1
must be followed by the corresponding x509certfile or vice-versa.
Packit Service 4684c1
@anchor{gnutls-serv x509dsakeyfile}
Packit Service 4684c1
@subheading x509dsakeyfile option
Packit Service 4684c1
Packit Service 4684c1
This is an alias for the @code{x509keyfile} option,
Packit Service 4684c1
@pxref{gnutls-serv x509keyfile, the x509keyfile option documentation}.
Packit Service 4684c1
Packit Service 4684c1
@anchor{gnutls-serv x509dsacertfile}
Packit Service 4684c1
@subheading x509dsacertfile option
Packit Service 4684c1
Packit Service 4684c1
This is an alias for the @code{x509certfile} option,
Packit Service 4684c1
@pxref{gnutls-serv x509certfile, the x509certfile option documentation}.
Packit Service 4684c1
Packit Service 4684c1
@anchor{gnutls-serv x509ecckeyfile}
Packit Service 4684c1
@subheading x509ecckeyfile option
Packit Service 4684c1
Packit Service 4684c1
This is an alias for the @code{x509keyfile} option,
Packit Service 4684c1
@pxref{gnutls-serv x509keyfile, the x509keyfile option documentation}.
Packit Service 4684c1
Packit Service 4684c1
@anchor{gnutls-serv x509ecccertfile}
Packit Service 4684c1
@subheading x509ecccertfile option
Packit Service 4684c1
Packit Service 4684c1
This is an alias for the @code{x509certfile} option,
Packit Service 4684c1
@pxref{gnutls-serv x509certfile, the x509certfile option documentation}.
Packit Service 4684c1
Packit Service 4684c1
@anchor{gnutls-serv rawpkkeyfile}
Packit Service 4684c1
@subheading rawpkkeyfile option
Packit Service 4684c1
Packit Service 4684c1
This is the ``private key file (pkcs #8 or pkcs #12) or pkcs #11 url to use'' option.
Packit Service 4684c1
This option takes a string argument.
Packit Service 4684c1
Packit Service 4684c1
@noindent
Packit Service 4684c1
This option has some usage constraints.  It:
Packit Service 4684c1
@itemize @bullet
Packit Service 4684c1
@item
Packit Service 4684c1
may appear an unlimited number of times.
Packit Service 4684c1
@end itemize
Packit Service 4684c1
Packit Service 4684c1
Specify the private key file or URI to use; it must correspond to
Packit Service 4684c1
the raw public-key specified in --rawpkfile. Multiple key pairs
Packit Service 4684c1
can be specified with this option and in that case each occurrence of keyfile
Packit Service 4684c1
must be followed by the corresponding rawpkfile or vice-versa.
Packit Service 4684c1
Packit Service 4684c1
In order to instruct the application to negotiate raw public keys one
Packit Service 4684c1
must enable the respective certificate types via the priority strings (i.e. CTYPE-CLI-*
Packit Service 4684c1
and CTYPE-SRV-* flags).
Packit Service 4684c1
Packit Service 4684c1
Check  the  GnuTLS  manual  on  section  ``Priority strings'' for more
Packit Service 4684c1
information on how to set certificate types.
Packit Service 4684c1
@anchor{gnutls-serv rawpkfile}
Packit Service 4684c1
@subheading rawpkfile option
Packit Service 4684c1
Packit Service 4684c1
This is the ``raw public-key file to use'' option.
Packit Service 4684c1
This option takes a string argument.
Packit Service 4684c1
Packit Service 4684c1
@noindent
Packit Service 4684c1
This option has some usage constraints.  It:
Packit Service 4684c1
@itemize @bullet
Packit Service 4684c1
@item
Packit Service 4684c1
may appear an unlimited number of times.
Packit Service 4684c1
@item
Packit Service 4684c1
must appear in combination with the following options:
Packit Service 4684c1
rawpkkeyfile.
Packit Service 4684c1
@end itemize
Packit Service 4684c1
Packit Service 4684c1
Specify the raw public-key file to use; it must correspond to
Packit Service 4684c1
the private key specified in --rawpkkeyfile. Multiple key pairs
Packit Service 4684c1
can be specified with this option and in that case each occurrence of keyfile
Packit Service 4684c1
must be followed by the corresponding rawpkfile or vice-versa.
Packit Service 4684c1
Packit Service 4684c1
In order to instruct the application to negotiate raw public keys one
Packit Service 4684c1
must enable the respective certificate types via the priority strings (i.e. CTYPE-CLI-*
Packit Service 4684c1
and CTYPE-SRV-* flags).
Packit Service 4684c1
Packit Service 4684c1
Check  the  GnuTLS  manual  on  section  ``Priority strings'' for more
Packit Service 4684c1
information on how to set certificate types.
Packit Service 4684c1
@anchor{gnutls-serv ocsp-response}
Packit Service 4684c1
@subheading ocsp-response option
Packit Service 4684c1
Packit Service 4684c1
This is the ``the ocsp response to send to client'' option.
Packit Service 4684c1
This option takes a string argument.
Packit Service 4684c1
Packit Service 4684c1
@noindent
Packit Service 4684c1
This option has some usage constraints.  It:
Packit Service 4684c1
@itemize @bullet
Packit Service 4684c1
@item
Packit Service 4684c1
may appear an unlimited number of times.
Packit Service 4684c1
@end itemize
Packit Service 4684c1
Packit Service 4684c1
If the client requested an OCSP response, return data from this file to the client.
Packit Service 4684c1
@anchor{gnutls-serv ignore-ocsp-response-errors}
Packit Service 4684c1
@subheading ignore-ocsp-response-errors option
Packit Service 4684c1
Packit Service 4684c1
This is the ``ignore any errors when setting the ocsp response'' option.
Packit Service 4684c1
That option instructs gnutls to not attempt to match the provided OCSP responses with the certificates.
Packit Service 4684c1
@anchor{gnutls-serv list}
Packit Service 4684c1
@subheading list option (-l)
Packit Service 4684c1
Packit Service 4684c1
This is the ``print a list of the supported algorithms and modes'' option.
Packit Service 4684c1
Print a list of the supported algorithms and modes. If a priority string is given then only the enabled ciphersuites are shown.
Packit Service 4684c1
@anchor{gnutls-serv provider}
Packit Service 4684c1
@subheading provider option
Packit Service 4684c1
Packit Service 4684c1
This is the ``specify the pkcs #11 provider library'' option.
Packit Service 4684c1
This option takes a file argument.
Packit Service 4684c1
This will override the default options in /etc/gnutls/pkcs11.conf
Packit Service 4684c1
@anchor{gnutls-serv exit status}
Packit Service 4684c1
@subheading gnutls-serv exit status
Packit Service 4684c1
Packit Service 4684c1
One of the following exit values will be returned:
Packit Service 4684c1
@table @samp
Packit Service 4684c1
@item 0 (EXIT_SUCCESS)
Packit Service 4684c1
Successful program execution.
Packit Service 4684c1
@item 1 (EXIT_FAILURE)
Packit Service 4684c1
The operation failed or the command syntax was not valid.
Packit Service 4684c1
@end table
Packit Service 4684c1
@anchor{gnutls-serv See Also}
Packit Service 4684c1
@subheading gnutls-serv See Also
Packit Service 4684c1
gnutls-cli-debug(1), gnutls-cli(1)
Packit Service 4684c1
@anchor{gnutls-serv Examples}
Packit Service 4684c1
@subheading gnutls-serv Examples
Packit Service 4684c1
Running your own TLS server based on GnuTLS can be useful when
Packit Service 4684c1
debugging clients and/or GnuTLS itself.  This section describes how to
Packit Service 4684c1
use @code{gnutls-serv} as a simple HTTPS server.
Packit Service 4684c1
Packit Service 4684c1
The most basic server can be started as:
Packit Service 4684c1
Packit Service 4684c1
@example
Packit Service 4684c1
gnutls-serv --http --priority "NORMAL:+ANON-ECDH:+ANON-DH"
Packit Service 4684c1
@end example
Packit Service 4684c1
Packit Service 4684c1
It will only support anonymous ciphersuites, which many TLS clients
Packit Service 4684c1
refuse to use.
Packit Service 4684c1
Packit Service 4684c1
The next step is to add support for X.509.  First we generate a CA:
Packit Service 4684c1
Packit Service 4684c1
@example
Packit Service 4684c1
$ certtool --generate-privkey > x509-ca-key.pem
Packit Service 4684c1
$ echo 'cn = GnuTLS test CA' > ca.tmpl
Packit Service 4684c1
$ echo 'ca' >> ca.tmpl
Packit Service 4684c1
$ echo 'cert_signing_key' >> ca.tmpl
Packit Service 4684c1
$ certtool --generate-self-signed --load-privkey x509-ca-key.pem \
Packit Service 4684c1
  --template ca.tmpl --outfile x509-ca.pem
Packit Service 4684c1
@end example
Packit Service 4684c1
Packit Service 4684c1
Then generate a server certificate.  Remember to change the dns_name
Packit Service 4684c1
value to the name of your server host, or skip that command to avoid
Packit Service 4684c1
the field.
Packit Service 4684c1
Packit Service 4684c1
@example
Packit Service 4684c1
$ certtool --generate-privkey > x509-server-key.pem
Packit Service 4684c1
$ echo 'organization = GnuTLS test server' > server.tmpl
Packit Service 4684c1
$ echo 'cn = test.gnutls.org' >> server.tmpl
Packit Service 4684c1
$ echo 'tls_www_server' >> server.tmpl
Packit Service 4684c1
$ echo 'encryption_key' >> server.tmpl
Packit Service 4684c1
$ echo 'signing_key' >> server.tmpl
Packit Service 4684c1
$ echo 'dns_name = test.gnutls.org' >> server.tmpl
Packit Service 4684c1
$ certtool --generate-certificate --load-privkey x509-server-key.pem \
Packit Service 4684c1
  --load-ca-certificate x509-ca.pem --load-ca-privkey x509-ca-key.pem \
Packit Service 4684c1
  --template server.tmpl --outfile x509-server.pem
Packit Service 4684c1
@end example
Packit Service 4684c1
Packit Service 4684c1
For use in the client, you may want to generate a client certificate
Packit Service 4684c1
as well.
Packit Service 4684c1
Packit Service 4684c1
@example
Packit Service 4684c1
$ certtool --generate-privkey > x509-client-key.pem
Packit Service 4684c1
$ echo 'cn = GnuTLS test client' > client.tmpl
Packit Service 4684c1
$ echo 'tls_www_client' >> client.tmpl
Packit Service 4684c1
$ echo 'encryption_key' >> client.tmpl
Packit Service 4684c1
$ echo 'signing_key' >> client.tmpl
Packit Service 4684c1
$ certtool --generate-certificate --load-privkey x509-client-key.pem \
Packit Service 4684c1
  --load-ca-certificate x509-ca.pem --load-ca-privkey x509-ca-key.pem \
Packit Service 4684c1
  --template client.tmpl --outfile x509-client.pem
Packit Service 4684c1
@end example
Packit Service 4684c1
Packit Service 4684c1
To be able to import the client key/certificate into some
Packit Service 4684c1
applications, you will need to convert them into a PKCS#12 structure.
Packit Service 4684c1
This also encrypts the security sensitive key with a password.
Packit Service 4684c1
Packit Service 4684c1
@example
Packit Service 4684c1
$ certtool --to-p12 --load-ca-certificate x509-ca.pem \
Packit Service 4684c1
  --load-privkey x509-client-key.pem --load-certificate x509-client.pem \
Packit Service 4684c1
  --outder --outfile x509-client.p12
Packit Service 4684c1
@end example
Packit Service 4684c1
Packit Service 4684c1
For icing, we'll create a proxy certificate for the client too.
Packit Service 4684c1
Packit Service 4684c1
@example
Packit Service 4684c1
$ certtool --generate-privkey > x509-proxy-key.pem
Packit Service 4684c1
$ echo 'cn = GnuTLS test client proxy' > proxy.tmpl
Packit Service 4684c1
$ certtool --generate-proxy --load-privkey x509-proxy-key.pem \
Packit Service 4684c1
  --load-ca-certificate x509-client.pem --load-ca-privkey x509-client-key.pem \
Packit Service 4684c1
  --load-certificate x509-client.pem --template proxy.tmpl \
Packit Service 4684c1
  --outfile x509-proxy.pem
Packit Service 4684c1
@end example
Packit Service 4684c1
Packit Service 4684c1
Then start the server again:
Packit Service 4684c1
Packit Service 4684c1
@example
Packit Service 4684c1
$ gnutls-serv --http \
Packit Service 4684c1
            --x509cafile x509-ca.pem \
Packit Service 4684c1
            --x509keyfile x509-server-key.pem \
Packit Service 4684c1
            --x509certfile x509-server.pem
Packit Service 4684c1
@end example
Packit Service 4684c1
Packit Service 4684c1
Try connecting to the server using your web browser.  Note that the
Packit Service 4684c1
server listens to port 5556 by default.
Packit Service 4684c1
Packit Service 4684c1
While you are at it, to allow connections using ECDSA, you can also
Packit Service 4684c1
create a ECDSA key and certificate for the server.  These credentials
Packit Service 4684c1
will be used in the final example below.
Packit Service 4684c1
Packit Service 4684c1
@example
Packit Service 4684c1
$ certtool --generate-privkey --ecdsa > x509-server-key-ecc.pem
Packit Service 4684c1
$ certtool --generate-certificate --load-privkey x509-server-key-ecc.pem \
Packit Service 4684c1
  --load-ca-certificate x509-ca.pem --load-ca-privkey x509-ca-key.pem \
Packit Service 4684c1
  --template server.tmpl --outfile x509-server-ecc.pem
Packit Service 4684c1
@end example
Packit Service 4684c1
Packit Service 4684c1
Packit Service 4684c1
The next step is to add support for SRP authentication. This requires
Packit Service 4684c1
an SRP password file created with @code{srptool}.
Packit Service 4684c1
To start the server with SRP support:
Packit Service 4684c1
Packit Service 4684c1
@example
Packit Service 4684c1
gnutls-serv --http --priority NORMAL:+SRP-RSA:+SRP \
Packit Service 4684c1
            --srppasswdconf srp-tpasswd.conf \
Packit Service 4684c1
            --srppasswd srp-passwd.txt
Packit Service 4684c1
@end example
Packit Service 4684c1
Packit Service 4684c1
Let's also start a server with support for PSK. This would require
Packit Service 4684c1
a password file created with @code{psktool}.
Packit Service 4684c1
Packit Service 4684c1
@example
Packit Service 4684c1
gnutls-serv --http --priority NORMAL:+ECDHE-PSK:+PSK \
Packit Service 4684c1
            --pskpasswd psk-passwd.txt
Packit Service 4684c1
@end example
Packit Service 4684c1
Packit Service 4684c1
If you want a server with support for raw public-keys we can also add these
Packit Service 4684c1
credentials. Note however that there is no identity information linked to these
Packit Service 4684c1
keys as is the case with regular x509 certificates. Authentication must be done
Packit Service 4684c1
via different means. Also we need to explicitly enable raw public-key certificates
Packit Service 4684c1
via the priority strings.
Packit Service 4684c1
Packit Service 4684c1
@example
Packit Service 4684c1
gnutls-serv --http --priority NORMAL:+CTYPE-CLI-RAWPK:+CTYPE-SRV-RAWPK \
Packit Service 4684c1
            --rawpkfile srv.rawpk.pem \
Packit Service 4684c1
            --rawpkkeyfile srv.key.pem
Packit Service 4684c1
@end example
Packit Service 4684c1
Packit Service 4684c1
Packit Service 4684c1
Finally, we start the server with all the earlier parameters and you
Packit Service 4684c1
get this command:
Packit Service 4684c1
Packit Service 4684c1
@example
Packit Service 4684c1
gnutls-serv --http --priority NORMAL:+PSK:+SRP:+CTYPE-CLI-RAWPK:+CTYPE-SRV-RAWPK \
Packit Service 4684c1
            --x509cafile x509-ca.pem \
Packit Service 4684c1
            --x509keyfile x509-server-key.pem \
Packit Service 4684c1
            --x509certfile x509-server.pem \
Packit Service 4684c1
            --x509keyfile x509-server-key-ecc.pem \
Packit Service 4684c1
            --x509certfile x509-server-ecc.pem \
Packit Service 4684c1
            --srppasswdconf srp-tpasswd.conf \
Packit Service 4684c1
            --srppasswd srp-passwd.txt \
Packit Service 4684c1
            --pskpasswd psk-passwd.txt \
Packit Service 4684c1
            --rawpkfile srv.rawpk.pem \
Packit Service 4684c1
            --rawpkkeyfile srv.key.pem
Packit Service 4684c1
@end example