TLS Configuration Directives
Additional configuration directives have been added to all the components (daemons) (Director, File daemon, and Storage daemon) as well as the various different Console programs).
Note that for the connection between a Storage Daemon and a File Daemon or between two Storage Daemons, the TLS directives that will be used are the ones defined in the FileDaemon resource on the client, and in the Storage resource on the Storage Daemon.
The default value of the directive TLS-PSK Enable is yes, if both TLS Enable and TLS-PSK Enable are enable on both side, then Bacula will use TLS certificates.
If none of TLS or TLS-PSK are enabled, then the TLS directives have no effect.
These new directives are defined as follows:
TLS Enable = <yes|no> Enable TLS support. If TLS is not enabled, none of the other TLS directives have any effect. In other words, even if you set TLS Require = yes you need to have TLS enabled or TLS will not be used.
TLS PSK Enable = <yes|no> Enable or Disable automatic TLS PSK support. TLS PSK is enabled by default between all Bacula components. The Pre-Shared Key used between the programs is the Bacula password. If both TLS Enable and TLS PSK Enable are enabled, the system will use TLS certificates.
TLS Require = <yes|no> Require TLS or TLS-PSK encryption. This directive is ignored unless one of TLS Enable or TLS PSK Enable is set to yes. If TLS is not required while TLS or TLS-PSK are enabled, then the Bacula component will connect with other components either with or without TLS or TLS-PSK
If TLS or TLS-PSK is enabled and TLS is required, then the Bacula component will refuse any connection request that does not use TLS.
TLS Authenticate = <yes|no> When TLS Authenticate is enabled, after doing the CRAM-MD5 authentication, Bacula will also do TLS authentication, then TLS encryption will be turned off, and the rest of the communication between the two Bacula components will be done without encryption. If TLS-PSK is used instead of the regular TLS, the encryption is turned off after the TLS-PSK authentication step.
If you want to encrypt communications data, use the normal TLS directives but do not turn on TLS Authenticate.
TLS Certificate = <Filename> The full path and filename of a PEM encoded TLS certificate. It will be used as either a client or server certificate, depending on the connection direction. PEM stands for Privacy Enhanced Mail, but in this context refers to how the certificates are encoded. This format is used because PEM files are base64 encoded and hence ASCII text based rather than binary. They may also contain encrypted information.
This directive is required in a server context, but it may not be specified in a client context if TLS Verify Peer is set to no in the corresponding server context.
Example:
File Daemon configuration file (bacula-fd.conf), resource configuration has TLS Verify Peer=no:
Director {
Name = bacula-dir
Password = "password"
Address = director.example.com
# TLS configuration directives
TLS Enable = yes
TLS Require = yes
TLS Verify Peer = no
TLS CA Certificate File = /opt/bacula/ssl/certs/root_cert.pem
TLS Certificate = /opt/bacula/ssl/certs/client1_cert.pem
TLS Key = /opt/bacula/ssl/keys/client1_key.pem
}
Having TLS Verify Peer=no, means the File Daemon, server context, will not check Director’s public certificate, client context. There is no need to specify TLS Certificate File neither TLS Key directives in the Client resource, director configuration file. We can have the below client configuration in bacula-dir.conf:
Client {
Name = client1-fd
Address = client1.example.com
FDPort = 9102
Catalog = MyCatalog
Password = "password"
...
# TLS configuration directives
TLS Enable = yes
TLS Require = yes
TLS CA Certificate File = /opt/bacula/ssl/certs/ca_client1_cert.pem
}
TLS Key = <Filename> The full path and filename of a PEM encoded TLS private key. It must correspond to the TLS certificate.
TLS Verify Peer = <yes|no> Verify peer certificate. Instructs server to request and verify the client’s X.509 certificate. Any client certificate signed by a known-CA will be accepted. Additionally, the client’s X509 certificate Common Name must meet the value of the Address directive. If the TLSAllowedCN configuration option is used, the client’s x509 certificate Common Name must also correspond to one of the CN specified in the TLS Allowed CN directive. This directive is valid only for a server and not in client context. The default is yes.
TLS Allowed CN = <string list> Common name attribute of allowed peer certificates. This directive is valid for a server and in a client context. If this directive is specified, the peer certificate will be verified against this list. In the case this directive is configured on a server side, the allowed CN list will not be checked if TLS Verify Peer is set to no (TLS Verify Peer is yes by default). This can be used to ensure that only the CN-approved component may connect. This directive may be specified more than once.
In the case this directive is configured in a server side, the allowed CN list will only be checked if TLS Verify Peer = yes (default). For example, in bacula-fd.conf, Director resource definition:
Director {
Name = bacula-dir
Password = "password"
Address = director.example.com
# TLS configuration directives
TLS Enable = yes
TLS Require = yes
# if TLS Verify Peer = no, then TLS Allowed CN will not be checked.
TLS Verify Peer = yes
TLS Allowed CN = director.example.com
TLS CA Certificate File = /opt/bacula/ssl/certs/root_cert.pem
TLS Certificate = /opt/bacula/ssl/certs/client1_cert.pem
TLS Key = /opt/bacula/ssl/keys/client1_key.pem
}
In the case this directive is configured in a client side, the allowed CN list will always be checked.
Client {
Name = client1-fd
Address = client1.example.com
FDPort = 9102
Catalog = MyCatalog
Password = "password"
...
# TLS configuration directives
TLS Enable = yes
TLS Require = yes
# the Allowed CN will be checked for this client by director
# the client’s certificate Common Name must match any of
# the values of the Allowed CN list
TLS Allowed CN = client1.example.com
TLS CA Certificate File = /opt/bacula/ssl/certs/ca_client1_cert.pem
TLS Certificate = /opt/bacula/ssl/certs/director_cert.pem
TLS Key = /opt/bacula/ssl/keys/director_key.pem
}
If the client doesn’t provide a certificate with a Common Name that meets any value in the TLS Allowed CN list, an error message will be issued:
16-Nov 17:30 bacula-dir JobId 0: Fatal error: bnet.c:273 TLS certificate
verification failed. Peer certificate did not match a required commonName
16-Nov 17:30 bacula-dir JobId 0: Fatal error: TLS negotiation failed with FD at
"192.168.100.2:9102".
TLS CA Certificate File = <Filename> The full path and filename specifying a PEM encoded TLS CA certificate(s). Multiple certificates are permitted in the file. One of TLS CA Certificate File or TLS CA Certificate Dir are required in a server context, unless TLS Verify Peer (see above) is set to no, and are always required in a client context.
TLS CA Certificate Dir = <Directory> Full path to TLS CA certificate directory. In the current implementation, certificates must be stored PEM encoded with OpenSSL-compatible hashes, which is the subject name’s hash and an extension of .0. One of TLS CA Certificate File or TLS CA Certificate Dir are required in a server context, unless TLS Verify Peer is set to no, and are always required in a client context.
TLS DH File = <Directory> Path to PEM encoded Diffie-Hellman parameter file. If this directive is specified, DH key exchange will be used for the ephemeral keying, allowing for forward secrecy of communications. DH key exchange adds an additional level of security because the key used for encryption/decryption by the server and the client is computed on each end and thus is never passed over the network if Diffie-Hellman key exchange is used. Even if DH key exchange is not used, the encryption/decryption key is always passed encrypted. This directive is only valid within a server context.
To generate the parameter file, you may use openssl:
openssl dhparam -out dh4096.pem -5 4096
See also
Go to:
Go back to the Bacula Communications Encryption chapter.
Go back to the main Advanced Features Usage page.