Wednesday, September 11, 2019

Bareos Client Configuration

Bareos has changed the structure of the configuration files allowing for different sections of the configuration to be isolated in their own files. This improves readability and allows for third-party applications to be written to edit the Bareos configuration. 
If you are new to Bareos or Bareos installation, read the introduction in this article to get more information.
The new way to configure a client is done at the Bareos Client and the Bareos Server. Please take note which host is the following command is executed on.
To create and configure a new Baresos Client,  follow the steps below
1.       Generate a password and copy it somewhere
# < /dev/urandom tr -dc A-Za-z0-9 | head -c32; echo
8wstlW1xkTQmmt1mLdbKjIWSuoSy1F69
2.       Log into the Bareos Server
3.       execute the Bareos Console
# bconsole
4.       Create the client configuration. In this example the client name is prod-server and the IP address is 192.168.0.2. Replace it with the correct IP address and add the password generated above
* configure add client name=prod-server address=192.168.0.2 password=8wstlW1xkTQmmt1mLdbKjIWSuoSy1F69
A sample output is below
*configure add client name=prod-server address=192.168.0.2 password=8wstlW1xkTQmmt1mLdbKjIWSuoSy1F69
Exported resource file "/etc/bareos/bareos-dir-export/client/prod-server/bareos-fd.d/director/bareos-dir.conf":
Director {
 Name = bareos-dir
 Password = "[md5]f7180d44d3cad452f611e2dfdfd3b007"
}
Created resource config file "/etc/bareos/bareos-dir.d/client/prod-server.conf":
Client {
 Name = prod-server
 Address = 192.168.0.2
 Password = 8wstlW1xkTQmmt1mLdbKjIWSuoSy1F69
}
*exit
5.       Restart Bareos Director
# systemctl restart bareos-dir
# systemctl status bareos-dir

The configuration information for the bareos client is the Resource Config File. This must be copied to the Bareos client host in the following steps.

A. On the Bareos server:
The Bareos Client requires information from the Bareos server. The information is in the resource file created when the client configuration was created on the Bareos Server.
Install the configuration for the bareos client using the commands below to copy the configuration file to the bareos client (e.g. prod-server with the IP address 192.168.0.2). On the Bareos Server, from the prompt

# scp /etc/bareos/bareos-dir-export/client/prod-server/bareos-fd.d/director/bareos-dir.conf root@192.168.0.2:/etc/bareos/bareos-fd.d/director/

B. On the Bareos Client
Log into the Bareos Client host (where the Bareos Client is installed), in this example, prod-server (IP 192.168.0.2).
1.       Edit the client configuration file
# cd /etc/bareos/bareos-fd.d/client
# vi myself.conf

2.       Change the Name from localhost to prod-server
Client {
      Name = localhost-fd prod-server
      Maximum Concurrent Jobs = 20

3.       Save the file and test whether this configuration is correct
# bareos-fd –t
The configuration is correct if there are no error messages.

4.       Apply the new configuration by restarting the client.
# systemctl restart bareos-fd
This can be verified with the command 
# systemctl status bareos-fd
Look for the line beginning with " Active " which should say " active (running) ".

Verify on the Bareos server:

# bconsole
* status  client=prod-server
Connecting to Client coders at 192.168.0.2:9102
prod-server Version: 17.2.4 (21 Sep 2017)  x86_64-redhat-linux-gnu redhat CentOS Linux release 7.4.1708 (Core)
Daemon started 09-Jan-19 18:24. Jobs: run=204 running=0.
 Heap: heap=36,864 smbytes=37,990 max_bytes=2,220,893 bufs=227 max_bufs=386
 Sizeof: boffset_t=8 size_t=8 debug=0 trace=0 bwlimit=0kB/s