Connection Overview

The following diagrams show Bareos components with any possible network connections between them. Arrows point always from the TCP Client to the respective TCP Server, thus the direction of the connection initiation. This is not neccessarily the direction of the data flow.

Full connection overview

This diagram contains all possible connections between Bareos components that are virtually usable. See the chapters below for specific diagrams of the Bareos operating modes.

left to right direction
skinparam shadowing false

(Console\nPython\nWebUI) as Con
(Tray Monitor) as Tray

[Filedaemon] as FD
[Directordaemon] as Dir
[Storagedaemon] as SD
[Storagedaemon2] as SD2

database Catalog

!define arrow_hidden(from,direction,to,comment) from -[#white]direction->to : <color white>comment</color>

!define arrow(from,direction,to,comment) from -direction->to : comment

arrow(Con, right, Dir, 1)
arrow(Con, right, Dir, 2)

arrow(Dir, up, FD, 3)
arrow(FD, down, Dir, 4)

arrow(Dir, right, SD, 5a)

arrow(FD, down, SD, 6)
arrow(SD, down, FD, 7)

arrow(SD, down, SD2, 8)
arrow(Dir, down, SD2, 5b)

arrow(Tray, down, Dir, 9)
arrow(Tray, down, FD, 10)
arrow(Tray, down, SD, 11)

arrow(Dir, down, Catalog, 12)

Sequence diagram of a Bareos File Daemon connection

Legend for full connection overview
Connection Number Description Type
1 Named Console control channel
2 Default Console control channel
3 Director to File Daemon (default) control channel
4 Client initiated File Daemon to Director control channel
5a Director to Storage (default) control channel
5b Director to 2nd Storage doing SD-SD copy or migrate control channel
6 File Daemon to Storage Daemon (default) data channel
7 Passive Client Storage Daemon to File Daemon data channel
8 Storage Daemon to Storage Daemon data channel
9 Tray Monitor to Director Daemon monitor channel
10 Tray Monitor to File Daemon monitor channel
11 Tray Monitor to Storage Daemon monitor channel
12 Director to catalog database database channel

Named Console and Default Console

left to right direction
skinparam shadowing false

(Console\nPython\nWebUI) as Con
(Tray Monitor) as Tray

[Filedaemon] as FD
[Directordaemon] as Dir
[Storagedaemon] as SD
[Storagedaemon2] as SD2

!define arrow_hidden(from,direction,to,comment) from -[#white]direction->to : <color white>comment</color>

!define arrow(from,direction,to,comment) from -direction->to : comment

arrow(Con, right, Dir, 1)
arrow(Con, right, Dir, 2)

arrow_hidden(Dir, up, FD, 3)
arrow_hidden(FD, down, Dir, 4)

arrow_hidden(Dir, right, SD, 5a)

arrow_hidden(FD, down, SD, 6)
arrow_hidden(SD, down, FD, 7)

arrow_hidden(SD, down, SD2, 8)
arrow_hidden(Dir, down, SD2, 5b)

arrow_hidden(Tray, down, Dir, 9)
arrow_hidden(Tray, down, FD, 10)
arrow_hidden(Tray, down, SD, 11)

Diagram of Console to Director connection

Default Backup/Restore

left to right direction
skinparam shadowing false

(Console\nPython\nWebUI) as Con
(Tray Monitor) as Tray

[Filedaemon] as FD
[Directordaemon] as Dir
[Storagedaemon] as SD
[Storagedaemon2] as SD2

!define arrow_hidden(from,direction,to,comment) from -[#white]direction->to : <color white>comment</color>

!define arrow(from,direction,to,comment) from -direction->to : comment

arrow_hidden(Con, right, Dir, 1)
arrow_hidden(Con, right, Dir, 2)

arrow(Dir, up, FD, 3)
arrow_hidden(FD, down, Dir, 4)

arrow(Dir, right, SD, 5a)

arrow(FD, down, SD, 6)
arrow_hidden(SD, down, FD, 7)

arrow_hidden(SD, down, SD2, 8)
arrow_hidden(Dir, down, SD2, 5b)

arrow_hidden(Tray, down, Dir, 9)
arrow_hidden(Tray, down, FD, 10)
arrow_hidden(Tray, down, SD, 11)

Diagram of a default Backup or Restore operation

Client Initiated Backup/Restore

left to right direction
skinparam shadowing false

(Console\nPython\nWebUI) as Con
(Tray Monitor) as Tray

[Filedaemon] as FD
[Directordaemon] as Dir
[Storagedaemon] as SD
[Storagedaemon2] as SD2

!define arrow_hidden(from,direction,to,comment) from -[#white]direction->to : <color white>comment</color>

!define arrow(from,direction,to,comment) from -direction->to : comment

arrow_hidden(Con, right, Dir, 1)
arrow_hidden(Con, right, Dir, 2)

arrow_hidden(Dir, up, FD, 3)
arrow(FD, down, Dir, 4)

arrow(Dir, right, SD, 5a)

arrow(FD, down, SD, 6)
arrow_hidden(SD, down, FD, 7)

arrow_hidden(SD, down, SD2, 8)
arrow_hidden(Dir, down, SD2, 5b)

arrow_hidden(Tray, down, Dir, 9)
arrow_hidden(Tray, down, FD, 10)
arrow_hidden(Tray, down, SD, 11)

Diagram of a client initiated Backup or Restore operation

Passive Client Backup/Restore

left to right direction
skinparam shadowing false

(Console\nPython\nWebUI) as Con
(Tray Monitor) as Tray

[Filedaemon] as FD
[Directordaemon] as Dir
[Storagedaemon] as SD
[Storagedaemon2] as SD2

!define arrow_hidden(from,direction,to,comment) from -[#white]direction->to : <color white>comment</color>

!define arrow(from,direction,to,comment) from -direction->to : comment

arrow_hidden(Con, right, Dir, 1)
arrow_hidden(Con, right, Dir, 2)

arrow(Dir, up, FD, 3)
arrow_hidden(FD, down, Dir, 4)

arrow(Dir, right, SD, 5a)

arrow_hidden(FD, down, SD, 6)
arrow(SD, down, FD, 7)

arrow_hidden(SD, down, SD2, 8)
arrow_hidden(Dir, down, SD2, 5b)

arrow_hidden(Tray, down, Dir, 9)
arrow_hidden(Tray, down, FD, 10)
arrow_hidden(Tray, down, SD, 11)

Diagram of a passive client Backup or Restore operation

Storage-Storage Migration

left to right direction
skinparam shadowing false

(Console\nPython\nWebUI) as Con
(Tray Monitor) as Tray

[Filedaemon] as FD
[Directordaemon] as Dir
[Storagedaemon] as SD
[Storagedaemon2] as SD2

!define arrow_hidden(from,direction,to,comment) from -[#white]direction->to : <color white>comment</color>

!define arrow(from,direction,to,comment) from -direction->to : comment

arrow_hidden(Con, right, Dir, 1)
arrow_hidden(Con, right, Dir, 2)

arrow_hidden(Dir, up, FD, 3)
arrow_hidden(FD, down, Dir, 4)

arrow(Dir, right, SD, 5a)

arrow_hidden(FD, down, SD, 6)
arrow_hidden(SD, down, FD, 7)

arrow(SD, down, SD2, 8)
arrow(Dir, down, SD2, 5b)

arrow_hidden(Tray, down, Dir, 9)
arrow_hidden(Tray, down, FD, 10)
arrow_hidden(Tray, down, SD, 11)

Diagram of a Storage to Storage copy or migrate operation

Tray-Monitor

left to right direction
skinparam shadowing false

(Console\nPython\nWebUI) as Con
(Tray Monitor) as Tray

[Filedaemon] as FD
[Directordaemon] as Dir
[Storagedaemon] as SD
[Storagedaemon2] as SD2

!define arrow_hidden(from,direction,to,comment) from -[#white]direction->to : <color white>comment</color>

!define arrow(from,direction,to,comment) from -direction->to : comment

arrow_hidden(Con, right, Dir, 1)
arrow_hidden(Con, right, Dir, 2)

arrow_hidden(Dir, up, FD, 3)
arrow_hidden(FD, down, Dir, 4)

arrow_hidden(Dir, right, SD, 5a)

arrow_hidden(FD, down, SD, 6)
arrow_hidden(SD, down, FD, 7)

arrow_hidden(SD, down, SD2, 8)
arrow_hidden(Dir, down, SD2, 5b)

arrow(Tray, down, Dir, 9)
arrow(Tray, down, FD, 10)
arrow(Tray, down, SD, 11)

Diagram of all Tray Monitor Connections

TLS Configuration Reference

To be able to communicate via TLS, TLS needs to be configured on both sides. In Bareos certain directives are used to set up TLS.

The following table explains the location of the relevant TLS configuration directives for all possible Bareos TCP connections. Each resource is referred to as <component>-<resource> to identify the exact configuration location. Refer to chapter Customizing the Configuration for more details about configuration.

In Bareos Version 18.2 the relevant resources for some connections had to be changed. Affected directives are marked with the applicable version and the respective resource is written in bold letters.

Remark: TLS-PSK is not available on Bareos components before Version 18.2.

TLS Configuration Reference
Config Directive / Connection No. [1] TCP-Client   TCP-Server
       
1 Default Console Director
Name [2] *UserAgent* [4]   *UserAgent* [4]
Password [3] Console-Director   Director-Director
Certificate directives Console-Director   Director-Director
Tls Enable / Tls Require Console-Director   Director-Director
       
2 Named Console Director
Name [2] Console-Console   Director-Console
Password [3] Console-Console   Director-Console
Certificate directives [5], Version 17.2: Console-Console   Director-Console
Certificate directives [5], Version 18.2: Console-Console   Director-Director
Tls Enable / Tls Require Console-Console   Director-Console
       
3 Director File Daemon
Name, Version 17.2: Director-Client   Client-Director
Name [2], Version 18.2: Director-Director   Client-Director
Password [3] Director-Client   Client-Director
Certificate directives [5], Version 17.2: Director-Client   Client-Director
Certificate directives [5], Version 18.2: Director-Client   Client-Client
Tls Enable / Tls Require Director-Client   Client-Director
       
4 File Daemon Director
Name, Version 17.2: Client-Director   Director-Client
Name [2], Version 18.2: Client-Client   Director-Client
Password [3] Client-Director   Director-Client
Certificate directives [5], Version 17.2: Client-Director   Director-Client
Certificate directives [5], Version 18.2: Client-Director   Director-Director
Tls Enable / Tls Require Client-Director   Director-Client
       
5a, 5b Director Storage Daemon
Name, Version 17.2: Director-Storage   Storage-Director
Name [2], Version 18.2: Director-Director   Storage-Director
Password [3] Director-Storage   Storage-Director
Certificate directives [5], Version 17.2: Director-Storage   Storage-Director
Certificate directives [5], Version 18.2: Director-Storage   Storage-Storage
Tls Enable / Tls Require Director-Storage   Storage-Director
       
6 File Daemon Storage Daemon
Name, Version 17.2: not defined   not defined
Name [2], Version 18.2: job name   job name
Password [3] job session key   job session key
Certificate directives [5], Version 17.2: Director-Storage   Storage-Director
Certificate directives [5], Version 18.2: Director-Storage   Storage-Storage
Tls Enable / Tls Require Director-Storage   Storage-Director
       
7 Storage Daemon File Daemon
Name, Version 17.2: not defined   not defined
Name [2], Version 18.2: job name   job name
Password [3] job session key   job session key
Certificate directives [5], Version 17.2:      
Certificate directives [5], Version 18.2: Storage-Storage   Client-Client
Tls Enable / Tls Require Director-Client   Client-Client
       
8 Storage Daemon Storage Daemon
Name, Version 17.2: not defined   not defined
Name [2], Version 18.2: job name   job name
Password [3] job session key   job session key
Certificate directives [5] Storage-Storage   Storage-Storage
Tls Enable / Tls Require Director-W Storage   Director-W Storage
       
9 Traymon Director
Name [2] Traymon-Traymon   Director-Console
Password [3] Traymon-Traymon   Director-Console
Certificate directives [5] Traymon-Director   Director-Director
Tls Enable / Tls Require Traymon-Director   Director-Console
       
10 Traymon FD
Name [2] Traymon-Traymon   Client-Director
Password [3] Traymon-Client   Client-Director
Certificate directives [5] Traymon-Client   Client-Client
Tls Enable / Tls Require Traymon-Client   Client-Director
       
11 Traymon SD
Name [2] Traymon-Traymon   Storage-Director
Password [3] Traymon-Storage   Storage-Director
Certificate directives [5] Traymon-Storage   Storage-Storage
Tls Enable / Tls Require Traymon-Storage   Storage-Director

Footnotes

[1]The connection number references this table: Legend for full connection overview
[2](1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) From Version 18.2 onwards this is identical to the TLS-PSK Identitiy
[3](1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) From Version 18.2 onwards this is identical to the TLS-PSK Pre-Shared Key
[4](1, 2) The name of the default console is predefined and cannot be changed
[5](1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) Certificate directives are: TlsVerifyPeer, TlsCaCertificateFile, TlsCaCertificateDir, TlsCertificateRevocationList, TlsCertificate, TlsKey, TlsAllowedCn

Compatibility with Bareos File Daemon

Bareos File Daemon connection handshake probing

As from Bareos 18.2 all components by default establish a secure connection with encryption first, followed by the proprietary Bareos protocol. This is accomplished using TLS PSK. Older components of Bareos than version 18.2 start a connection with a cleartext handshake without encryption.

For downward compatibility Bareos Director Daemons and Bareos Storage Daemons are able to connect to Bareos File Daemons older than version 18.2. In this case Director and Storage switch to the old protocol.

There are two connection modes of a File Daemon, active and passive. In contrast to a connection from an active Bareos File Daemon, the protocol version of a passive File Daemon has to be probed by the Director Daemon initially when a job is initiated. This information is stored in the configuration and immediately submitted to the Storage Daemon when the job is started.

The following sequence is used to figure out the right protocol version and to submit this information to the attached Bareos Storage Daemon:

hide footbox

Actor user
participant "ConfigurationParser\nclass" as Config << C,#EEEEEE >>
participant "Some methods in\ndirectordaemon namespace" as Dir << N,#EEEEEE >>
participant "Client methods in\n directordaemon namespace" as F << N,#EEEEEE >>
participant "Client methods in\n filedaemon namespace" as FC << N,#EEEEEE >>

== Config Initialisation ==

user -> Config: reload config
activate Config
Config -> Config: ParseConfigFile()
Config -> Dir: ConfigReadyCallback()
activate Dir
Dir -> Config: ResetAllClientConnectionHandshakeModes
Dir <-- Config: All handshake modes reset to\nClientConnectionHandshakeMode::kUndefined
Config <-- Dir: ConfigReadyCallback() done
deactivate Dir
user <-- Config: config reloaded

... try to connect to a client ...

== Client Connection to old unknown client ==

user -> Dir: run some client command
activate Dir

Dir -> F: ConnectToFileDaemon()
activate F
note right of F: Possible modes:\nkTlsFirst (try TLS immediately),\nkCleartextFirst (old cleartext handshake)
F ->> FC: Try to connect to Filedaemon with immediate TLS\nconnection mode (kTlsFirst)
F ->> FC: If immediate TLS fails try cleartext handshake mode\n(kCleartextFirst, this will happen with old clients before 18.2)
F <- FC: Connection established
Config <- F: Save successful mode into configuration of client
Dir <-- F: ConnectToFileDaemon() done
... do something with client ...
FC <--> F: close client connection
Dir <-- F:
user <-- Dir : finished some client command
deactivate F
deactivate Dir

... connect to the same filedaemon again ...

== Client Connection to a known client ==

user -> Dir: run some client command
activate Dir
Dir -> F: ConnectToFileDaemon()
activate F
Config -> F: Load successful mode from configuration of client
F -> FC: Connect to Filedaemon with saved connection mode from config
F <- FC: Connection established without waiting or probing
Dir <-- F: ConnectToFileDaemon() done
... do something with client ...
FC <--> F: close client connection
Dir <-- F:
user <-- Dir : finished some client command
deactivate F
deactivate Dir

deactivate Config

Sequence diagram of a Bareos File Daemon connection

Bareos File Daemon 18.2 with Bareos before 18.2

Bareos File Daemon 18.2 onwards can be used on a Bareos system before 18.2.

The older Bareos Director and Bareos Storage Daemon connect to Bareos File Daemon using the cleartext Bareos handshake before they can switch to TLS. If you want transport encryption only TLS with certificates can be used, not PSK as it is possible with Bareos 18.2.

However, it is also possible to disable transport encryption and use cleartext transport using the following configuration changes:

Bareos Director configuration

/etc/bareos/bareos-dir.d/client/bareos-fd.conf
Client {
  ...
  TlsEnable = no
  TlsRequire = no
  ...
}
/etc/bareos/bareos-dir.d/storage/bareos-sd.conf
Storage {
  ...
  TlsEnable = no
  TlsRequire = no
  ...
}

Bareos Storage Daemon configuration

/etc/bareos/bareos-sd.d/storage/bareos-sd.conf
Storage {
  ...
  TlsEnable = no
  TlsRequire = no
  ...
}

Bareos File Daemon configuration

/etc/bareos/bareos-fd.d/client/bareos-fd.conf
Client {
  ...
  TlsEnable = no
  TlsRequire = no
  ...
}
/etc/bareos/bareos-fd.d/director/bareos-dir.conf
Director {
  ...
  TlsEnable = no
  TlsRequire = no
  ...
}

Bareos File Daemon before 18.2 with Bareos 18.2

Bareos File Daemon before 18.2 can be used on a Bareos system 18.2 onwards.

The newer Bareos Director and Bareos Storage Daemon connect to Bareos File Daemon using the cleartext Bareos handshake before they switch to TLS. If you want transport encryption only TLS with certificates can be used, not PSK as it is possible with Bareos 18.2.

However, it is also possible to disable transport encryption and use cleartext transport using the following configuration changes:

Bareos File Daemon configuration

/etc/bareos/bareos-fd.d/client/bareos-fd.conf
Client {
  ...
  TlsEnable = no
  TlsRequire = no
  ...
}
/etc/bareos/bareos-fd.d/director/bareos-dir.conf
Director {
  ...
  TlsEnable = no
  TlsRequire = no
  ...
}

PAM-Configuration

Introduction

Before Bareos Version 18.2 authentication with a Bareos Director is done primarily by a named Console connection. Name and password are set in the regarding Bareos Console or Bareos WebUI configuration resource. Starting with Bareos Version 18.2 it is also possible to use Pluggable Authentication Modules (PAM) to authenticate a user indenpendently from the Console Resource.

As consequence a dedicated named Console or Bareos WebUI configuration must be used to establish a connection to a Bareos Director Daemon. This connection has name and password credentials, but only to establish an encrypted connection to the Director. To be able to authenticate users with PAM using this console, each user needs an additional User configuration that holds the regarding name and the Access Control List (ACL) or ACL profile. The ACL will be loaded as soon as the User is authenticated.

The credentials for user authentication comes from the PAM module which has been enabled for the Bareos Director Daemon.

For a simplified technical overview the following diagram shows the connection sequence of a Bareos Console to a Bareos Director using an interactive PAM authentication using the pam_unix.so PAM module.

More technical details can be found in the Bareos Developer Guide: PAM.

hide footbox

actor user
participant "B-Console" as console
participant "Director" as director
participant "PAM-Linux" as pam

user -> console: start a named bconsole
console <-> director: initiate TCP connection
console <-> director: initiate a secure TLS connection (cert/psk)
console <-> director: primary challenge/response authentication

== PAM user authentication ==
note left of pam: i.e. pam_unix.so\nconfigured in /etc/pam.d/bareos
autonumber
director -> pam: initialize pam module
director <- pam: request username / password via callback
console <- director: send "login:" / "password:" request encrypted via TLS
user <- console: prompt "login:" / "Password:"
user -> console: enter username / password (hidden)
console -> director: send username / password encrypted via TLS
director -> pam: give back username / password
director <- pam: return success of authentication
console <- director: send welcome message
user <- console: show welcome message
director -> pam: shutdown pam module

autonumber stop
== PAM user authentication end ==

... do something with console ...

user -> console: quit session ('q'; Ctrl + D)
console <-> director: Shutdown TLS
console <-> director: Finish TCP connection

Initiation of a Bareos Console connection using PAM authentication

Configuration

To enable PAM authentication two systems have to be configured. The PAM module in the operating system and the Bareos Console.

PAM Module

This is depending on the operating system and on the used pam module. For details read the manuals. The name of the service that has to be registered is “bareos”.

Fedora 28 example: :

/etc/pam.d/bareos
# check authorization
auth       required     pam_unix.so

Bareos Console

For PAM authentication a dedicated named console is used. Set the directive UsePamAuthentication=yes in the regarding Director-Console resource:

bareos-dir.d/console/pam-console.conf
Console {
   Name = "PamConsole"
   Password = "Secretpassword"
   UsePamAuthentication = yes
}
bconsole/pam-console.conf
Console {
   Name = "PamConsole"
   Password = "Secretpassword"
}

PAM User

Example of a User resource (Bareos Director Configuration)

bareos-dir.d/console/pam-user.conf
User {
   Name = "Bareos"
   Password = ""
   CommandACL = status, .status
   JobACL = *all*
}