.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Podwrapper::Man 1.38.1 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "nbdkit-tls 1" .TH nbdkit-tls 1 2024-04-21 nbdkit-1.38.1 NBDKIT .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME nbdkit\-tls \- authentication and encryption of NBD connections (sometimes called "SSL") .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 5 \& nbdkit [\-\-tls=off|on|require] \& [\-\-tls\-certificates=/path/to/certificates] \& [\-\-tls\-psk=/path/to/pskfile] \& [\-\-tls\-verify\-peer] \& PLUGIN [...] .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" TLS (authentication and encryption, sometimes incorrectly called "SSL") is supported if nbdkit was compiled with GnuTLS. This allows the server to verify that the client is allowed access, and to encrypt the contents of the protocol in transit over the network. .PP TLS can be disabled or enabled by specifying either \fI\-\-tls=off\fR or \&\fI\-\-tls=on\fR. With \fI\-\-tls=off\fR, if a client tries to use TLS to connect, it will be rejected by the server (in other words, as if the server doesn't support TLS). .PP \&\fI\-\-tls=on\fR means that the client may choose to connect either with or without TLS. .PP \&\fI\-\-tls=require\fR enables TLS \fBand\fR rejects all non-TLS connection attempts. This prevents downgrade attacks where a malicious proxy pretends not to support TLS in order to force either the client or server to communicate in plaintext. .SS Example .IX Subsection "Example" If certificates have been set up correctly then you should be able to start a TLS server by doing: .PP .Vb 1 \& nbdkit \-\-tls=require memory 1G .Ve .PP and connect to it by doing: .PP .Vb 1 \& nbdinfo nbds://localhost .Ve .PP If certificates are in a non-standard directory and you have libnbd\ ≥\ 1.10: .PP .Vb 2 \& nbdkit \-\-tls=require \-\-tls\-certificates=/certs memory 1G \& nbdinfo nbds://localhost?tls\-certificates=/certs .Ve .SS "TLS with X.509 certificates" .IX Subsection "TLS with X.509 certificates" When nbdkit starts up, it loads TLS certificates from some built-in paths, or from the directory specified by the \fI\-\-tls\-certificates\fR option. .PP In this directory, nbdkit expects to find several files: .IP \fIca\-cert.pem\fR 4 .IX Item "ca-cert.pem" The Certificate Authority certificate. .IP \fIserver\-cert.pem\fR 4 .IX Item "server-cert.pem" The server certificate. .IP \fIserver\-key.pem\fR 4 .IX Item "server-key.pem" The server private key. .IP \fIca\-crl.pem\fR 4 .IX Item "ca-crl.pem" (Optional) The certificate revocation list. .PP \fISetting up the Certificate Authority\fR .IX Subsection "Setting up the Certificate Authority" .PP This step only needs to be done once per organization. It may be that your organization already has a CA. .PP .Vb 2 \& $ certtool \-\-generate\-privkey > ca\-key.pem \& $ chmod 0600 ca\-key.pem .Ve .PP The \fIca\-key.pem\fR file is the CA private key and is \fIextremely\fR sensitive data. With possession of this key, anyone can create certificates pretending to be your organization! .PP To create the CA certificate file: .PP .Vb 9 \& $ cat > ca.info < server\-key.pem \& $ chmod 0600 server\-key.pem .Ve .PP The server key file is sensitive. Setting the mode to \f(CW0600\fR helps to prevent other users on the same machine from reading it. .PP The common name (\f(CW\*(C`cn\*(C'\fR below) field must be the fully qualified hostname that the client connects to. However most clients and servers including nbdkit support the Subject Alternative Name extension (RFC\ 2818) which uses the \f(CW\*(C`dns_name\*(C'\fR and \f(CW\*(C`ip_address\*(C'\fR fields and deprecates \f(CW\*(C`cn\*(C'\fR. .PP .Vb 10 \& $ cat > server.info < client\-key.pem \& $ chmod 0600 client\-key.pem .Ve .PP The client key file is sensitive. .PP The client DNS name (\f(CW\*(C`cn\*(C'\fR below) is the client's name that nbdkit sees and checks. .PP .Vb 10 \& $ cat > client.info <