gnutls-serv - GnuTLS server
Usage: gnutls-serv [ -<flag> [<val>] | --<name>[{=| }<val>] ]...
None:
-d, --debug=num Enable debugging
- it must be in the range:
0 to 9999
--sni-hostname=str Server's hostname for server name extension
--sni-hostname-fatal Send fatal alert on sni-hostname mismatch
--alpn=str Specify ALPN protocol to be enabled by the server
--alpn-fatal Send fatal alert on non-matching ALPN name
--noticket Don't accept session tickets
--earlydata Accept early data
--maxearlydata=num The maximum early data size to accept
- it must be in the range:
1 to 2147483648
--nocookie Don't require cookie on DTLS sessions
-g, --generate Generate Diffie-Hellman 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
--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
- it must be in the range:
0 to 17000
--srtp-profiles=str Offer SRTP profiles
-a, --disable-client-cert Do not request a client certificate
- prohibits the option 'require-client-cert'
-r, --require-client-cert Require a client certificate
--verify-client-cert If a client certificate is sent then verify it
--compress-cert=str Compress certificate
-b, --heartbeat Activate heartbeat support
--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
--x509keyfile=str X.509 key file or PKCS #11 URL to use
--x509certfile=str X.509 Certificate file or PKCS #11 URL to use
--rawpkkeyfile=str Private key file (PKCS #8 or PKCS #12) or PKCS #11 URL to use
--rawpkfile=str Raw public-key file to use
- requires the option 'rawpkkeyfile'
--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
--ocsp-response=str The OCSP response to send to client
--ignore-ocsp-response-errors Ignore any errors when setting the OCSP response
-p, --port=num The port to connect to
-l, --list Print a list of the supported algorithms and modes
--provider=file Specify the PKCS #11 provider library
- file must pre-exist
--keymatexport=str Label used for exporting keying material
--keymatexportsize=num Size of the exported keying material
--recordsize=num The maximum record size to advertise
- it must be in the range:
0 to 16384
--httpdata=file The data used as HTTP response
- file must pre-exist
--timeout=num The timeout period for server
--attime=str Perform validation at the timestamp instead of the system time
Version, usage and configuration options:
-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.
Note that this program is only meant for testing and diagnostic purposes.
Please send bug reports to: <bugs@gnutls.org>
Options (55)
| Option | Description | Source |
|---|---|---|
-d, --debug num | Enable debugging. | help + man |
--sni-hostname str | Server's hostname for server name extension. | help + man |
--sni-hostname-fatal | Send fatal alert on sni-hostname mismatch. | help + man |
--alpn str | Specify ALPN protocol to be enabled by the server. | help + man |
--alpn-fatal | Send fatal alert on non-matching ALPN name. | help + man |
--noticket | Don't accept session tickets. | help + man |
--earlydata | Accept early data. | help + man |
--maxearlydata num | The maximum early data size to accept. | help + man |
--nocookie | Don't require cookie on DTLS sessions. | help + man |
-g, --generate | Generate Diffie-Hellman parameters. | help + man |
-q, --quiet | Suppress some messages. | help + man |
--nodb | Do not use a resumption database. | help + man |
--http | Act as an HTTP server. | help + man |
--echo | Act as an Echo server. | help + man |
--crlf | Do not replace CRLF by LF in Echo server mode. | help + man |
-u, --udp | Use DTLS (datagram TLS) over UDP. | help + man |
--mtu num | Set MTU for datagram TLS. | help + man |
--srtp-profiles str | Offer SRTP profiles. | help + man |
-a, --disable-client-cert | Do not request a client certificate. | help + man |
-r, --require-client-cert | Require a client certificate. | help + man |
--verify-client-cert | If a client certificate is sent then verify it. | help + man |
--compress-cert str | Compress certificate. | help + man |
-b, --heartbeat | Activate heartbeat support. | help + man |
--x509fmtder | Use DER format for certificates to read from. | help + man |
--priority str | Priorities string. | help + man |
--dhparams file | DH params file to use. | help + man |
--x509cafile str | Certificate file or PKCS #11 URL to use. | help + man |
--x509crlfile file | CRL file to use. | help + man |
--x509keyfile str | X.509 key file or PKCS #11 URL to use. | help + man |
--x509certfile str | X.509 Certificate file or PKCS #11 URL to use. | help + man |
--rawpkkeyfile str | Private key file (PKCS #8 or PKCS #12) or PKCS #11 URL to use. | help + man |
--rawpkfile str | Raw public-key file to use. | help + man |
--srppasswd file | SRP password file to use. | help + man |
--srppasswdconf file | SRP password configuration file to use. | help + man |
--pskpasswd file | PSK password file to use. | help + man |
--pskhint str | PSK identity hint to use. | help + man |
--ocsp-response str | The OCSP response to send to client. | help + man |
--ignore-ocsp-response-errors | Ignore any errors when setting the OCSP response. | help + man |
-p, --port num | The port to connect to. | help + man |
-l, --list | Print a list of the supported algorithms and modes. | help + man |
--provider file | Specify the PKCS #11 provider library. | help + man |
--keymatexport str | Label used for exporting keying material. | help + man |
--recordsize num | The maximum record size to advertise. | help + man |
--httpdata file | The data used as HTTP response. | help + man |
--timeout num | The timeout period for server. | help + man |
--attime str | Perform validation at the timestamp instead of the system time. | help + man |
-v, --version arg | output version information and exit | help + man |
-h, --help | display extended usage information and exit | help + man |
--more-help | Pass the extended usage information through a pager. | help + man |
--pgpkeyfile file | PGP Key file to use. (in the manual page but not in --help) | man |
--x509dsakeyfile | This is an alias for the --x509keyfile option. (in the manual page but not in --help) | man |
--x509dsacertfile | This is an alias for the --x509certfile option. (in the manual page but not in --help) | man |
--x509ecckeyfile | This is an alias for the --x509keyfile option. (in the manual page but not in --help) | man |
--x509ecccertfile | This is an alias for the --x509certfile option. (in the manual page but not in --help) | man |
--keymatexportsize num | Size of the exported keying material. (in the manual page but not in --help) | man |
Examples (30) from the manual page, untested
gnutls-serv --http --priority "NORMAL:+ANON-ECDH:+ANON-DH"
The most basic server can be started as:certtool --generate-privkey > x509-ca-key.pem
The next step is to add support for X.509.echo 'cn = GnuTLS test CA' > ca.tmpl
The next step is to add support for X.509.echo 'ca' >> ca.tmpl
The next step is to add support for X.509.echo 'cert_signing_key' >> ca.tmpl
The next step is to add support for X.509.certtool --generate-self-signed --load-privkey x509-ca-key.pem --template ca.tmpl --outfile x509-ca.pem
The next step is to add support for X.509.certtool --generate-privkey > x509-server-key.pem
Then generate a server certificate.echo 'organization = GnuTLS test server' > server.tmpl
Then generate a server certificate.echo 'cn = test.gnutls.org' >> server.tmpl
Then generate a server certificate.echo 'tls_www_server' >> server.tmpl
Then generate a server certificate.echo 'encryption_key' >> server.tmpl
Then generate a server certificate.echo 'signing_key' >> server.tmpl
Then generate a server certificate.echo 'dns_name = test.gnutls.org' >> server.tmpl
Then generate a server certificate.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
Then generate a server certificate.certtool --generate-privkey > x509-client-key.pem
For use in the client, you may want to generate a client certificate as well.echo 'cn = GnuTLS test client' > client.tmpl
For use in the client, you may want to generate a client certificate as well.echo 'tls_www_client' >> client.tmpl
For use in the client, you may want to generate a client certificate as well.echo 'encryption_key' >> client.tmpl
For use in the client, you may want to generate a client certificate as well.echo 'signing_key' >> client.tmpl
For use in the client, you may want to generate a client certificate as well.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
For use in the client, you may want to generate a client certificate as well.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
To be able to import the client key/certificate into some applications, you will need to convert them into a PKCS#12 structure.certtool --generate-privkey > x509-proxy-key.pem
For icing, we'll create a proxy certificate for the client too.echo 'cn = GnuTLS test client proxy' > proxy.tmpl
For icing, we'll create a proxy certificate for the client too.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
For icing, we'll create a proxy certificate for the client too.gnutls-serv --http --x509cafile x509-ca.pem --x509keyfile x509-server-key.pem --x509certfile x509-server.pem
Then start the server again:certtool --generate-privkey --ecdsa > x509-server-key-ecc.pem
While you are at it, to allow connections using ECDSA, you can also create a ECDSA key and certificate for the server.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
While you are at it, to allow connections using ECDSA, you can also create a ECDSA key and certificate for the server.gnutls-serv --http --priority NORMAL:+SRP-RSA:+SRP --srppasswdconf srp-tpasswd.conf --srppasswd srp-passwd.txt
The next step is to add support for SRP authentication.gnutls-serv --http --priority NORMAL:+ECDHE-PSK:+PSK --pskpasswd psk-passwd.txt
Let's also start a server with support for PSK.gnutls-serv --http --priority NORMAL:+CTYPE-CLI-RAWPK:+CTYPE-SRV-RAWPK --rawpkfile srv.rawpk.pem --rawpkkeyfile srv.key.pem
If you want a server with support for raw public-keys we can also add these credentials.