Bareos @FreeBSD @Freenas 11.2

Verwendete Komponenten:

bareos-logo

Voraussetzung für dieses Setup:

  • FreeNAS 11.2-RELEASE-p6
  • Vollständige Basiskonfiguration inklusive Netzwerkdevices, Storage-Pool, etc.

Um Bareos Server und die WebUI auf einem FreeNAS 11.2 Storage Server zu installieren, muss man sich über folgendes im Klaren sein:

  • FreeNAS ist eine Appliance und somit ist per Design keine direkte Installation einer zusätzlichen Software vorgesehen und das muss auch so bleiben.
  • FreeNAS bietet ein Plugin für Bacula, nicht jedoch für Bareos.
  • Alle zusätzlichen Services, die nicht unter FreeNAS verfügbar sind, müssen daher in jeweils einem eigenen Jail laufen.

Vorgehensweise:

Wir erstellen ein Jail mit dem Namen „bareos-server“ innerhalb von FreeNAS, weisen ein Ethernet-Device zu und starten das Jail:

  • Jail Name: bareos-server
  • Template: FreeBSD
  • IPv4 address: <static_ip>
  • Autostart: Checked
  • VIMAGE: Checked
  • Alle anderen Optionen bleiben default (oder basierend auf einer eigenen Konfiguration)

Um Zugriff von Außen via SSH auf den neuen „bareos-server“ zu erhalten, sind folgende Schritte nötig:

Rechts am Ende des Jail-Eintrags befinden sich drei Punkte. Beim Klick darauf öffnet sich ein Kontextmenü. Hier eine Shell öffnen. (Jails > Jails > bareos-server > Shell)

Innerhalb der Shell des „bareos-server“ Jails folgende Änderungen vornehmen:

  • Änderung /etc/rc.conf:
    • echo 'sshd_enable="YES"' >>/etc/rc.conf
  • Erlaube root login. (alternativ kann man einen Benutzer anlegen und sudo verwenden)
    • vi /etc/ssh/sshd_config
      • PermitRootLogin YES
  • Start SSH service.
    • service sshd start
  • Ändere das root Passwort.
    • passwd
    • Folge dem Prompt, um das Passwort zu ändern.

Von nun an kann man sich direkt via SSH am bareos-server anmelden mit

  • ssh root@bareos-server

Anschließend sind folgende Vorbereitungen notwendig:

  • sed -i '' s/quarterly/latest/g /etc/pkg/FreeBSD.conf
  • pkg search bareos
  • pkg install bareos-client bareos-server bareos-webui postgresql95-server nginx php72 php72-xml php72-session php72-simplexml php72-gd php72-ctype php72-mbstring php72-zlib php72-tokenizer php72-iconv php72-pecl-mcrypt php72-pear-DB_ldap php72-zip php72-dom php72-sqlite3 php72-gettext php72-curl php72-json php72-opcache php72-wddx php72-hash php72-soap
  • echo 'bareos_sd_enable="YES"' >>/etc/rc.conf

Mit der zweiten Zeile wird der bareos_sd service beim Booten des Jails mit gestartet.

Nun ist noch eine Konfiguration notwendig, die alle bareos-sd.d/* Konfigurationen lädt:

  • echo '@/usr/local/etc/bareos/bareos-sd.d/*/*' >>/usr/local/etc/bareos/bareos-sd.conf

Nun benötigen wir einen pgsql login und setzen die Collation auf deutsch, da wir bei der Suche deutsche Umlaute erwarten:

  • cat >> /etc/login.conf << __EOF
    # PostgreSQL
    pgsql:\
    :lang=de_DE.UTF-8:\
    :setenv=LC_COLLATE=C:\
    :tc=default:
    __EOF

Neuladen der Login-Datenbank:

  • cap_mkdb /etc/login.conf

Nun initialisieren wir die Datenbanken:

  • /usr/local/etc/rc.d/postgresql initdb

Nun starten wir den PostgreSQL:

  • root@bareos-server:~ # /usr/local/etc/rc.d/postgresql start
    LOG: Logausgabe nach stderr endet
    TIPP: Die weitere Logausgabe geht an Logziel "syslog".

Wir kümmern uns nun um die Bareos Server Konfiguration. Die nicht benötigten*.sample Files werden gelöscht und die Permissions korrigiert:

  • chown -R bareos:bareos /usr/local/etc/bareos
  • find /usr/local/etc/bareos -type f -exec chmod 640 {} ';'
  • find /usr/local/etc/bareos -type d -exec chmod 750 {} ';'
  • find /usr/local/etc/bareos -name \*\.sample -delete

Für das „Tracking“ behalten wir eine Kopie der originalen Konfiguration:

  • cp -a /usr/local/etc/bareos /usr/local/etc/bareos.orig

Nun passen wie die Bareos Catalog Konfiguration an unter:
/usr/local/etc/bareos.ORG/bareos-dir.d/catalog/MyCatalog.conf
Nach der Anpassung sieht das so aus (das Passwort ist natürlich entsprechend anzupassen):

  • Catalog {
    Name = MyCatalog
    dbdriver = "postgresql"
    dbname = "bareos"
    dbuser = "bareos"
    dbpassword = "BAREOS-DATABASE-PASSWORD"
    }

Wir prüfen, ob beide Benutzer in der bareos-Gruppe sind:

  • root@bareos-server:~ # pw groupmod bareos -m pgsql
    root@bareos-server:~ # id pgsql
    uid=70(pgsql) gid=70(pgsql) groups=70(pgsql),997(bareos)
    root@bareos-server:~ # pw groupmod bareos -m www
    root@bareos-server:~ # id www
    uid=80(www) gid=80(www) groups=80(www),997(bareos)

Nun wird die PostgreSQL Datenbank für die Bareos Instanz vorbereitet. Dazu verwenden wir die Skripte aus dem Bareos Paket unter /usr/local/lib/bareos/scripts.

  • root@bareos-server:~ # su - pgsql
    $ whoami
    pgsql
    $ /usr/local/lib/bareos/scripts/create_bareos_database
    Creating postgresql database
    CREATE DATABASE
    ALTER DATABASE
    Database encoding OK
    Creating of bareos database succeeded.
    $ /usr/local/lib/bareos/scripts/make_bareos_tables
    Making postgresql tables
    CREATE TABLE
    ALTER TABLE
    CREATE INDEX
    CREATE TABLE
    CREATE INDEX
    CREATE INDEX
    CREATE TABLE
    CREATE INDEX
    CREATE TABLE
    CREATE INDEX
    CREATE TABLE
    CREATE INDEX
    CREATE TABLE
    CREATE TABLE
    CREATE INDEX
    CREATE TABLE
    CREATE INDEX
    CREATE TABLE
    CREATE INDEX
    CREATE INDEX
    CREATE TABLE
    CREATE TABLE
    CREATE TABLE
    CREATE TABLE
    CREATE INDEX
    CREATE TABLE
    CREATE INDEX
    CREATE TABLE
    CREATE INDEX
    CREATE TABLE
    CREATE TABLE
    CREATE TABLE
    CREATE INDEX
    CREATE TABLE
    CREATE INDEX
    CREATE TABLE
    CREATE INDEX
    CREATE TABLE
    CREATE TABLE
    CREATE TABLE
    CREATE TABLE
    CREATE TABLE
    CREATE TABLE
    CREATE TABLE
    CREATE TABLE
    INSERT 0 1
    INSERT 0 1
    INSERT 0 1
    INSERT 0 1
    INSERT 0 1
    INSERT 0 1
    INSERT 0 1
    INSERT 0 1
    INSERT 0 1
    INSERT 0 1
    INSERT 0 1
    INSERT 0 1
    INSERT 0 1
    INSERT 0 1
    INSERT 0 1
    INSERT 0 1
    INSERT 0 1
    INSERT 0 1
    INSERT 0 1
    INSERT 0 1
    INSERT 0 1
    INSERT 0 1
    INSERT 0 1
    INSERT 0 1
    INSERT 0 1
    INSERT 0 1
    DELETE 0
    INSERT 0 1
    Creation of Bareos PostgreSQL tables succeeded.
    $ /usr/local/lib/bareos/scripts/grant_bareos_privileges
    Granting postgresql tables
    CREATE ROLE
    GRANT
    GRANT
    GRANT
    GRANT
    GRANT
    GRANT
    GRANT
    GRANT
    GRANT
    GRANT
    GRANT
    GRANT
    GRANT
    GRANT
    GRANT
    GRANT
    GRANT
    GRANT
    GRANT
    GRANT
    GRANT
    GRANT
    GRANT
    GRANT
    GRANT
    GRANT
    GRANT
    GRANT
    GRANT
    GRANT
    GRANT
    GRANT
    GRANT
    GRANT
    GRANT
    GRANT
    GRANT
    GRANT
    GRANT
    GRANT
    GRANT
    GRANT
    GRANT
    GRANT
    Privileges for user bareos granted ON database bareos.
    $

Verfizierung, ob die benötigte DB vorhanden ist:

  • su -m bareos -c 'psql -l'
    List of databases
    Name       | Owner | Encoding  | Collate | Ctype       |Access privileges
    -----------+-------+-----------+---------+-------------+-----------------
    bareos     | pgsql | SQL_ASCII | C       | C           |
    postgres   | pgsql | UTF8      | C       | de_DE.UTF-8 |
    template0  | pgsql | UTF8      | C       | de_DE.UTF-8 | =c/pgsql +
    |          |       |           |         | pgsql=CTc/pgsql
    template1  | pgsql | UTF8      | C       | de_DE.UTF-8 | =c/pgsql +
    |          |       |           |         | pgsql=CTc/pgsql
    (4 rows)

Wir fügen die PostgreSQL Database Jobs ein in crontab(1):

  • root@bareos-server:~ # su - pgsql
    $ whoami
    pgsql
    $ cat >/usr/local/pgsql/vacuum.sh << __EOF
    #! /bin/sh
    /usr/local/bin/vacuumdb -a -z 1> /dev/null 2> /dev/null
    /usr/local/bin/reindexdb -a 1> /dev/null 2> /dev/null
    /usr/local/bin/reindexdb -s 1> /dev/null 2> /dev/null
    __EOF
    $ chmod +x /usr/local/pgsql/vacuum.sh
    $ cat /usr/local/pgsql/vacuum.sh
    #! /bin/sh
    /usr/local/bin/vacuumdb -a -z 1> /dev/null 2> /dev/null
    /usr/local/bin/reindexdb -a 1> /dev/null 2> /dev/null
    /usr/local/bin/reindexdb -s 1> /dev/null 2> /dev/null
    $ crontab -e
    crontab: no crontab for pgsql - using an empty one
    # DO NOT EDIT THIS FILE - edit the master and reinstall.
    # (/tmp/crontab.Be9j9VVCUa installed on Thu Apr 26 21:45:04 2018)
    # (Cron version -- $FreeBSD$)
    0 0 * * * /usr/local/pgsql/vacuum.sh
    /tmp/crontab.g8mCztyvSv: 5 lines, 191 characters.
    crontab: installing new crontab
    $ crontab -l
    # DO NOT EDIT THIS FILE - edit the master and reinstall.
    # (/tmp/crontab.Be9j9VVCUa installed on Thu Apr 26 21:45:04 2018)
    # (Cron version -- $FreeBSD$)
    0 0 * * * /usr/local/pgsql/vacuum.sh
    $ exit
    root@bareos-server:~ # cat /var/cron/tabs/pgsql
    # DO NOT EDIT THIS FILE - edit the master and reinstall.
    # (/tmp/crontab.g8mCztyvSv installed on Mon Dec 31 05:01:54 2018)
    # (Cron version -- $FreeBSD: releng/11.2/usr.sbin/cron/crontab/crontab.c 321241 2017-07-19 20:22:16Z ngie $)
    # DO NOT EDIT THIS FILE - edit the master and reinstall.
    # (/tmp/crontab.Be9j9VVCUa installed on Thu Apr 26 21:45:04 2018)
    # (Cron version -- $FreeBSD$)
    0 0 * * * /usr/local/pgsql/vacuum.sh
    root@bareos-server:~ # su -m pgsql -c 'crontab -l'
    # DO NOT EDIT THIS FILE - edit the master and reinstall.
    # (/tmp/crontab.Be9j9VVCUa installed on Thu Apr 26 21:45:04 2018)
    # (Cron version -- $FreeBSD$)
    0 0 * * * /usr/local/pgsql/vacuum.sh

Wir legen nun lokal die bareos-Verzeichnisse an, das /bareos-dr dient später als NFS mount point für ein weiteres DR-Storage:

  • root@bareos-server:~ # mkdir -p /bareos/bootstrap
    root@bareos-server:~ # mkdir -p /bareos/restore
    root@bareos-server:~ # mkdir -p /bareos/storage/FileStorage
    root@bareos-server:~ # mkdir -p /bareos/storage/FileStorage2
    root@bareos-server:~ # mkdir -p /bareos-dr/bootstrap
    root@bareos-server:~ # mkdir -p /bareos-dr/restore
    root@bareos-server:~ # mkdir -p /bareos-dr/storage/FileStorage
    root@bareos-server:~ # mkdir -p /bareos-dr/storage/FileStorage2
    root@bareos-server:~ # chown -R bareos:bareos /bareos /bareos-dr
    root@bareos-server:~ # find /bareos /bareos-dr -ls | column -t
    120761 1 drwxr-xr-x 5 bareos bareos 5 Dec 31 05:20 /bareos
    120774 1 drwxr-xr-x 3 bareos bareos 3 Dec 31 05:20 /bareos/storage
    120775 1 drwxr-xr-x 2 bareos bareos 2 Dec 31 05:20 /bareos/storage/FileStorage
    120786 1 drwxr-xr-x 2 bareos bareos 2 Dec 31 05:20 /bareos/storage/FileStorage2
    120768 1 drwxr-xr-x 2 bareos bareos 2 Dec 31 05:20 /bareos/restore
    120762 1 drwxr-xr-x 2 bareos bareos 2 Dec 31 05:20 /bareos/bootstrap
    120776 1 drwxr-xr-x 5 bareos bareos 5 Dec 31 05:21 /bareos-dr
    120777 1 drwxr-xr-x 2 bareos bareos 2 Dec 31 05:20 /bareos-dr/bootstrap
    120783 1 drwxr-xr-x 2 bareos bareos 2 Dec 31 05:20 /bareos-dr/restore
    120784 1 drwxr-xr-x 3 bareos bareos 3 Dec 31 05:21 /bareos-dr/storage
    120785 1 drwxr-xr-x 2 bareos bareos 2 Dec 31 05:21 /bareos-dr/storage/FileStorage
    120787 1 drwxr-xr-x 2 bareos bareos 2 Dec 31 05:21 /bareos-dr/storage/FileStorage2

Bareos

Im nächsten Schritt benötigen wir die Passwörter für die Bareos Subsysteme, wie wir das bereits analog für dasBAREOS-DATABASE-PASSWORD für den bareos User für die PostgreSQL Bareos Datenbank erstellt hatten:

  • BAREOS-DATABASE-PASSWORD
  • BAREOS-DIR-PASSWORD
  • BAREOS-SD-PASSWORD
  • BAREOS-FD-PASSWORD
  • BAREOS-MON-PASSWORD
  • ADMIN-PASSWORD

Wir verwenden dabei /dev/urandom zur Generierung der jeweiligen Passwörter, wie hier im Beispiel (je länger, je sicherer):

  • root@bareos-server:~ # cat /dev/urandom | env LC_CTYPE=C tr -dc a-zA-Z0-9 | head -c 60 ; echo
    R32CERWerLmlHunzCfiTOEjhG2oo4oaWmTChzlQiuOEh50sSSwb7xKccOw8g

Wir haben bereits die MyCatalog.conf mit nachfolgendem Inhalt angelegt:

# cat /usr/local/etc/bareos/bareos-dir.d/catalog/MyCatalog.conf
Catalog {
  Name = MyCatalog
  dbdriver = "postgresql"
  dbname = "bareos"
  dbuser = "bareos"
  dbpassword = "BAREOS-DATABASE-PASSWORD"
}

Anlegen von /usr/local/etc/bareos/bconsole.d falls nicht vorhanden:

# test -d /usr/local/etc/bareos/bconsole.d/ || mkdir -p /usr/local/etc/bareos/bconsole.d/;\
chown bareos.bareos /usr/local/etc/bareos/bconsole.d

Symbolischen Link erstellen, falls notwendig:

# test -n /usr/local/etc/bareos/bconsole.d/bconsole.conf || \
ln -s /usr/local/etc/bareos/bconsole.conf /usr/local/etc/bareos/bconsole.d/

Inhalt von /usr/local/etc/bareos/bconsole.d/bconsole.conf nach der Anpassung:

# cat /usr/local/etc/bareos/bconsole.d/bconsole.conf
#
# Bareos User Agent (or Console) Configuration File
#

Director {
  Name = bareos-server.getcom.de
  address = localhost
  Password = "BAREOS-DIR-PASSWORD"
  Description = "Bareos Console credentials for local Director"
}

Inhalt von/usr/local/etc/bareos/bareos-dir.d/director/bareos-dir.conf nach der Anpassung:

# cat /usr/local/etc/bareos/bareos-dir.d/director/bareos-dir.conf
Director {
  Name = bareos-server.getcom.de
  QueryFile = "/usr/local/lib/bareos/scripts/query.sql"
  Maximum Concurrent Jobs = 100
  Password = "BAREOS-DIR-PASSWORD"
  Messages = Daemon
  Auditing = yes

  # Enable the Heartbeat if you experience connection losses
  # (eg. because of your router or firewall configuration).
  # Additionally the Heartbeat can be enabled in bareos-sd and bareos-fd.
  #
  # Heartbeat Interval = 1 min

  # remove comment in next line to load dynamic backends from specified directory
  # Backend Directory = /usr/local/lib

  # remove comment from "Plugin Directory" to load plugins from specified directory.
  # if "Plugin Names" is defined, only the specified plugins will be loaded,
  # otherwise all director plugins (*-dir.so) from the "Plugin Directory".
  #
  # Plugin Directory = /usr/local/lib/bareos/plugins
  # Plugin Names = ""
}

Inhalt von /usr/local/etc/bareos/bareos-dir.d/job/RestoreFiles.confnach der Anpassung:

# cat /usr/local/etc/bareos/bareos-dir.d/job/RestoreFiles.conf
Job {
  Name = "RestoreFiles"
  Description = "Standard Restore."
  Type = Restore
  Client = Default
  FileSet = "SelfTest"
  Storage = File
  Pool = BR-MO
  Messages = Standard
  Where = /bareos/restore
  Accurate = yes
}

Neues File /usr/local/etc/bareos/bareos-dir.d/client/Default.conf :

# cat /usr/local/etc/bareos/bareos-dir.d/client/Default.conf
Client {
  Name = Default
  address = bareos-server.getcom.de
  Password = "BAREOS-FD-PASSWORD"
}

Neues File /usr/local/etc/bareos/bareos-dir.d/client/bareos-server.getcom.de.conf :

# cat /usr/local/etc/bareos/bareos-dir.d/client/bareos-server.getcom.de.conf
Client {
  Name = bareos-server.getcom.de
  Description = "Client resource of the Director itself."
  address = bareos-server.getcom.de
  Password = "BAREOS-FD-PASSWORD"
}

Nachfolgendes File ist ohne Änderung:

# cat /usr/local/etc/bareos/bareos-dir.d/job/BackupCatalog.conf
Job {
  Name = "BackupCatalog"
  Description = "Backup the catalog database (after the nightly save)"
  JobDefs = "DefaultJob"
  Level = Full
  FileSet="Catalog"
  Schedule = "WeeklyCycleAfterBackup"

  # This creates an ASCII copy of the catalog
  # Arguments to make_catalog_backup.pl are:
  #  make_catalog_backup.pl 
  RunBeforeJob = "/usr/local/lib/bareos/scripts/make_catalog_backup.pl MyCatalog"

  # This deletes the copy of the catalog
  RunAfterJob  = "/usr/local/lib/bareos/scripts/delete_catalog_backup"

  # This sends the bootstrap via mail for disaster recovery.
  # Should be sent to another system, please change recipient accordingly
  Write Bootstrap = "|/usr/local/bin/bsmtp -h localhost -f \"\(Bareos\) \" -s \"Bootstrap for Job %j\" root@localhost" # (#01)
  Priority = 11                   # run after main backup
}

Nachfolgendes File ist ohne Änderung:

# cat /usr/local/etc/bareos/bareos-dir.d/messages/Standard.conf
Messages {
  Name = Standard
  Description = "Reasonable message delivery -- send most everything to email address and to the console."
  operatorcommand = "/usr/local/bin/bsmtp -h localhost -f \"\(Bareos\) \\" -s \"Bareos: Intervention needed for %j\" %r"
  mailcommand = "/usr/local/bin/bsmtp -h localhost -f \"\(Bareos\) \\" -s \"Bareos: %t %e of %c %l\" %r"
  operator = root@localhost = mount                                 # (#03)
  mail = root@localhost = all, !skipped, !saved, !audit             # (#02)
  console = all, !skipped, !saved, !audit
  append = "/var/log/bareos/bareos.log" = all, !skipped, !saved, !audit
  catalog = all, !skipped, !saved, !audit
}

Nachfolgendes File ist ohne Änderung:

# cat /usr/local/etc/bareos/bareos-dir.d/messages/Daemon.conf
Messages {
  Name = Daemon
  Description = "Message delivery for daemon messages (no job)."
  mailcommand = "/usr/local/bin/bsmtp -h localhost -f \"\(Bareos\) \\" -s \"Bareos daemon message\" %r"
  mail = root@localhost = all, !skipped, !audit # (#02)
  console = all, !skipped, !saved, !audit
  append = "/var/log/bareos/bareos.log" = all, !skipped, !audit
  append = "/var/log/bareos/bareos-audit.log" = audit
}

Pools

Per default hat Bareos vier Pools konfiguriert. Da wir sie nicht benutzen, löschen wir sie:

# ls -l /usr/local/etc/bareos/bareos-dir.d/pool
total 14
-rw-rw----  1 bareos  bareos  536 Apr 16 08:14 Differential.conf
-rw-rw----  1 bareos  bareos  512 Apr 16 08:14 Full.conf
-rw-rw----  1 bareos  bareos  534 Apr 16 08:14 Incremental.conf
-rw-rw----  1 bareos  bareos   48 Apr 16 08:14 Scratch.conf

# rm -f /usr/local/etc/bareos/bareos-dir.d/pool/*.conf

Wir legen nun zwei Pools für DAILY Backups und MONTHLY Backups an:

# cat /usr/local/etc/bareos/bareos-dir.d/pool/BRONZE-DAILY-POOL.conf
Pool {
  Name = BR-DA
  Pool Type = Backup
  Recycle = yes                       # Bareos can automatically recycle Volumes
  AutoPrune = yes                     # Prune expired volumes
  Volume Retention = 7 days           # How long should the Full Backups be kept? (#06)
  Maximum Volume Bytes = 2G           # Limit Volume size to something reasonable
  Maximum Volumes = 100000            # Limit number of Volumes in Pool
  Label Format = "BR-DA-"             # Volumes will be labeled "BR-DA-"
}

# cat /usr/local/etc/bareos/bareos-dir.d/pool/BRONZE-MONTHLY-POOL.conf
Pool {
  Name = BR-MO
  Pool Type = Backup
  Recycle = yes                       # Bareos can automatically recycle Volumes
  AutoPrune = yes                     # Prune expired volumes
  Volume Retention = 120 days         # How long should the Full Backups be kept? (#06)
  Maximum Volume Bytes = 2G           # Limit Volume size to something reasonable
  Maximum Volumes = 100000            # Limit number of Volumes in Pool
  Label Format = "BR-MO-"             # Volumes will be labeled "BR-MO-"
}

Nachfolgendes File ist ohne Änderung:

# cat /usr/local/etc/bareos/bareos-dir.d/schedule/WeeklyCycle.conf
Schedule {
  Name = "WeeklyCycle"
  Run = Full 1st sat at 21:00                   # (#04)
  Run = Differential 2nd-5th sat at 21:00       # (#07)
  Run = Incremental mon-fri at 21:00            # (#10)
}

Nachfolgendes File ist ohne Änderung:

# cat /usr/local/etc/bareos/bareos-dir.d/schedule/WeeklyCycle.conf
Schedule {
  Name = "WeeklyCycle"
  Run = Full 1st sat at 21:00                   # (#04)
  Run = Differential 2nd-5th sat at 21:00       # (#07)
  Run = Incremental mon-fri at 21:00            # (#10)
}

Inhalt von/usr/local/etc/bareos/bareos-dir.d/jobdefs/DefaultJob.conf nach der Änderung:

# cat /usr/local/etc/bareos/bareos-dir.d/jobdefs/DefaultJob.conf
JobDefs {
  Name = "DefaultJob"
  Type = Backup
  Level = Differential
  Client = Default
  FileSet = "SelfTest"
  Schedule = "WeeklyCycle"
  Storage = File
  Messages = Standard
  Pool = BR-DA
  Priority = 10
  Write Bootstrap = "/bareos/bootstrap/%c.bsr"
}

Inhalt von /usr/local/etc/bareos/bareos-dir.d/storage/File.conf
nach der Änderung:

# cat /usr/local/etc/bareos/bareos-dir.d/storage/File.conf
Storage {
  Name = File
  Address = bareos-server.getcom.de
  Password = "BAREOS-SD-PASSWORD"
  Device = FileStorage
  Media Type = File
}

Inhalt von /usr/local/etc/bareos/bareos-dir.d/console/bareos-mon.conf nach der Änderung:

# cat /usr/local/etc/bareos/bareos-dir.d/console/bareos-mon.conf
Console {
  Name = bareos-mon
  Description = "Restricted console used by tray-monitor to get the status of the director."
  Password = "BAREOS-MON-PASSWORD"
  CommandACL = status, .status
  JobACL = *all*
}

Inhalt von /usr/local/etc/bareos/bareos-dir.d/fileset/Catalog.conf nach der Änderung:

# cat /usr/local/etc/bareos/bareos-dir.d/fileset/Catalog.conf
FileSet {
  Name = "Catalog"
  Description = "Backup the catalog dump and Bareos configuration files."
  Include {
    Options {
      signature = MD5
      Compression = lzo
    }
    File = "/var/db/bareos"
    File = "/usr/local/etc/bareos"
  }
}

Inhalt von /usr/local/etc/bareos/bareos-dir.d/fileset/SelfTest.conf nach der Änderung:

# cat /usr/local/etc/bareos/bareos-dir.d/fileset/SelfTest.conf
FileSet {
  Name = "SelfTest"
  Description = "fileset just to backup some files for selftest"
  Include {
    Options {
      Signature   = MD5
      Compression = lzo
    }
    File = "/usr/local/sbin"
  }
}

Wir benötigen kein gebundeltes LinuxAll.conf und WindowsAllDrives.conf filesets, daher löschen wir das:

# ls -l /usr/local/etc/bareos/bareos-dir.d/fileset/
total 18
-rw-rw----  1 bareos  bareos  250 Apr 27 02:25 Catalog.conf
-rw-rw----  1 bareos  bareos  765 Apr 16 08:14 LinuxAll.conf
-rw-rw----  1 bareos  bareos  210 Apr 27 02:27 SelfTest.conf
-rw-rw----  1 bareos  bareos  362 Apr 16 08:14 WindowsAllDrives.conf

# rm -f /usr/local/etc/bareos/bareos-dir.d/fileset/LinuxAll.conf
# rm -f /usr/local/etc/bareos/bareos-dir.d/fileset/Windows*All*Drives.conf

Wir definieren nun zwei neue filesets Windows.conf und UNIX.conf :

Neue Datei /usr/local/etc/bareos/bareos-dir.d/fileset/Windows.conf :

# cat /usr/local/etc/bareos/bareos-dir.d/fileset/Windows.conf
FileSet {
  Name = Windows
  Enable VSS = yes
  Include {
    Options {
      Signature = MD5
      Drive Type = fixed
      IgnoreCase = yes
      WildFile = "[A-Z]:/pagefile.sys"
      WildDir  = "[A-Z]:/RECYCLER"
      WildDir  = "[A-Z]:/$RECYCLE.BIN"
      WildDir  = "[A-Z]:/System Volume Information"
      Exclude = yes
      Compression = lzo
    }
    File = /
  }

Neue Datei /usr/local/etc/bareos/bareos-dir.d/fileset/UNIX.conf :

# cat /usr/local/etc/bareos/bareos-dir.d/fileset/UNIX.conf
FileSet {
  Name = "UNIX"
  Include {
    Options {
      Signature = MD5 # calculate md5 checksum per file
      One FS = No     # change into other filessytems
      FS Type = ufs
      FS Type = btrfs
      FS Type = ext2  # filesystems of given types will be backed up
      FS Type = ext3  # others will be ignored
      FS Type = ext4
      FS Type = reiserfs
      FS Type = jfs
      FS Type = xfs
      FS Type = zfs
      noatime = yes
      Compression = lzo
    }
    File = /
  }
  # Things that usually have to be excluded
  # You have to exclude /tmp
  # on your bareos server
  Exclude {
    File = /var/db/bareos
    File = /tmp
    File = /proc
    File = /sys
    File = /var/tmp
    File = /.journal
    File = /.fsck
  }
}

Nachfolgendes File ist ohne Änderung:

# cat /usr/local/etc/bareos/bareos-dir.d/profile/operator.conf
Profile {
   Name = operator
   Description = "Profile allowing normal Bareos operations."

   Command ACL = !.bvfs_clear_cache, !.exit, !.sql
   Command ACL = !configure, !create, !delete, !purge, !sqlquery, !umount, !unmount
   Command ACL = *all*

   Catalog ACL = *all*
   Client ACL = *all*
   FileSet ACL = *all*
   Job ACL = *all*
   Plugin Options ACL = *all*
   Pool ACL = *all*
   Schedule ACL = *all*
   Storage ACL = *all*
   Where ACL = *all*
}

Inhalt von /usr/local/etc/bareos/bareos-sd.d/messages/Standard.conf nach der Änderung:

# cat /usr/local/etc/bareos/bareos-sd.d/messages/Standard.conf
Messages {
  Name = Standard
  Director = bareos-server.getcom.de = all
  Description = "Send all messages to the Director."
}

Wir fügen den Pfad /bareos/storage/FileStorage als unseren FileStorage Platz hinzu:

Inhalt von /usr/local/etc/bareos/bareos-sd.d/device/FileStorage.confnach der Änderung:

# cat /usr/local/etc/bareos/bareos-sd.d/device/FileStorage.conf
Device {
  Name = FileStorage
  Media Type = File
  Archive Device = /bareos/storage/FileStorage
  LabelMedia = yes;                   # lets Bareos label unlabeled media
  Random Access = yes;
  AutomaticMount = yes;               # when device opened, read it
  RemovableMedia = no;
  AlwaysOpen = no;
  Description = "File device. A connecting Director must have the same Name and MediaType."
}

Inhalt von /usr/local/etc/bareos/bareos-sd.d/storage/bareos-sd.confnach der Änderung:

# cat /usr/local/etc/bareos/bareos-sd.d/storage/bareos-sd.conf
Storage {
  Name = bareos-server.getcom.de
  Maximum Concurrent Jobs = 20

  # remove comment from "Plugin Directory" to load plugins from specified directory.
  # if "Plugin Names" is defined, only the specified plugins will be loaded,
  # otherwise all storage plugins (*-sd.so) from the "Plugin Directory".
  #
  # Plugin Directory = /usr/local/lib/bareos/plugins
  # Plugin Names = ""
}

Inhalt von /usr/local/etc/bareos/bareos-sd.d/director/bareos-mon.conf nach der Änderung:

# cat /usr/local/etc/bareos/bareos-sd.d/director/bareos-mon.conf
Director {
  Name = bareos-mon
  Password = "BAREOS-SD-PASSWORD"
  Monitor = yes
  Description = "Restricted Director, used by tray-monitor to get the status of this storage daemon."
}

Inhalt von /usr/local/etc/bareos/bareos-sd.d/director/bareos-dir.conf nach der Änderung:

# cat /usr/local/etc/bareos/bareos-sd.d/director/bareos-dir.conf
Director {
  Name = bareos-server.getcom.de
  Password = "BAREOS-SD-PASSWORD"
  Description = "Director, who is permitted to contact this storage daemon."
}

Inhalt von /usr/local/etc/bareos/bareos-fd.d/messages/Standard.conf nach der Änderung:

# cat /usr/local/etc/bareos/bareos-fd.d/messages/Standard.conf
Messages {
  Name = Standard
  Director = bareos-server.getcom.de = all, !skipped, !restored
  Description = "Send relevant messages to the Director."
}

Inhalt von /usr/local/etc/bareos/bareos-fd.d/director/bareos-dir.conf nach der Änderung:

# cat /usr/local/etc/bareos/bareos-fd.d/director/bareos-dir.conf
Director {
  Name = bareos-server.getcom.de
  Password = "BAREOS-FD-PASSWORD"
  Description = "Allow the configured Director to access this file daemon."
}

Inhalt von /usr/local/etc/bareos/bareos-fd.d/director/bareos-mon.confnach der Änderung:

# cat /usr/local/etc/bareos/bareos-fd.d/director/bareos-mon.conf
Director {
  Name = bareos-mon
  Password = "BAREOS-MON-PASSWORD"
  Monitor = yes
  Description = "Restricted Director, used by tray-monitor to get the status of this file daemon."
}

Inhalt von/usr/local/etc/bareos/bareos-fd.d/client/myself.confnach der Änderung:

# cat /usr/local/etc/bareos/bareos-fd.d/client/myself.conf
Client {
  Name = bareos-server.getcom.de
  Maximum Concurrent Jobs = 20

  # remove comment from "Plugin Directory" to load plugins from specified directory.
  # if "Plugin Names" is defined, only the specified plugins will be loaded,
  # otherwise all storage plugins (*-fd.so) from the "Plugin Directory".
  #
  # Plugin Directory = /usr/local/lib/bareos/plugins
  # Plugin Names = ""

  # if compatible is set to yes, we are compatible with bacula
  # if set to no, new bareos features are enabled which is the default
  # compatible = yes
}

Inhalt von /usr/local/etc/bareos/bareos-dir.d/client/bareos-fd.conf nach der Änderung:

# cat /usr/local/etc/bareos/bareos-dir.d/client/bareos-fd.conf
Client {
  Name = bareos-fd
  Description = "Client resource of the Director itself."
  Address = localhost
  Password = "BAREOS-FD-PASSWORD"
}

Wir prüfen, welches Passwort in welchem File gesetzt ist:

# pwd
/usr/local/etc/bareos

# grep -r Password . | sort -k 4 | column -t
./bareos-dir.d/director/bareos-dir.conf:        Password  =  "BAREOS-DIR-PASSWORD"
./bconsole.d/bconsole.conf:                     Password  =  "BAREOS-DIR-PASSWORD"
./bareos-dir.d/client/Default.conf:             Password  =  "BAREOS-FD-PASSWORD"
./bareos-dir.d/client/bareos-fd.conf:           Password  =  "BAREOS-FD-PASSWORD"
./bareos-dir.d/client/replica.backup.org.conf:  Password  =  "BAREOS-FD-PASSWORD"
./bareos-fd.d/director/bareos-dir.conf:         Password  =  "BAREOS-FD-PASSWORD"
./bareos-dir.d/console/bareos-mon.conf:         Password  =  "BAREOS-MON-PASSWORD"
./bareos-fd.d/director/bareos-mon.conf:         Password  =  "BAREOS-MON-PASSWORD"
./bareos-dir.d/storage/File.conf:               Password  =  "BAREOS-SD-PASSWORD"
./bareos-sd.d/director/bareos-dir.conf:         Password  =  "BAREOS-SD-PASSWORD"
./bareos-sd.d/director/bareos-mon.conf:         Password  =  "BAREOS-SD-PASSWORD"

Wir bereinigen die Berechtigungen:

# chown -R bareos:bareos /usr/local/etc/bareos
# find /usr/local/etc/bareos -type f -exec chmod 640 {} ';'
# find /usr/local/etc/bareos -type d -exec chmod 750 {} ';'

Bareos WebUI

Wir ergänzen oder ändern die Konfigurationen für das Bareos WebUI Interface.

Die Nginx Webserver Konfiguration Datei:

# cat /usr/local/etc/nginx/nginx.conf
user                 www;
worker_processes     4;
worker_rlimit_nofile 51200;
error_log            /var/log/nginx/error.log;

events {
  worker_connections 1024;
}

http {
  include           mime.types;
  default_type      application/octet-stream;
  log_format        main '$remote_addr - $remote_user [$time_local] "$request" ';
  access_log        /var/log/nginx/access.log main;
  sendfile          on;
  keepalive_timeout 65;

  server {
    listen       9100;
    server_name  replica.backup.org bareos;
    root         /usr/local/www/bareos-webui/public;

    location / {
      index index.php;
      try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ .php$ {
      fastcgi_pass 127.0.0.1:9000;
      fastcgi_param APPLICATION_ENV production;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      include fastcgi_params;
      try_files $uri =404;
    }
  }
}

Für PHP ändern wir die Konfigurationsdatei aus dem Paket /usr/local/etc/php.ini-production :

# cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini

# vi /usr/local/etc/php.ini

Wir fügen die Zeitzone Europe/Berlin hinzu:

# diff -u php.ini-production php.ini
--- php.ini-production  2019-02-13 03:23:36.000000000 +0200
+++ php.ini     2019-02-13 13:50:40.513138000 +0200
@@ -934,6 +934,7 @@
 ; Defines the default timezone used by the date functions
 ; http://php.net/date.timezone
-;date.timezone =
+date.timezone = Europe/Berlin

 ; http://php.net/date.default-latitude
 ;date.default_latitude = 31.7667

Inhalt der php-fpm daemon Konfiguration:

# cat /usr/local/etc/php-fpm.conf
[global]
pid = run/php-fpm.pid
log_level = notice

[www]
user = www
group = www
listen = 127.0.0.1:9000
listen.backlog = -1
listen.owner = www
listen.group = www
listen.mode = 0660
listen.allowed_clients = 127.0.0.1
pm = static
pm.max_children = 4
pm.start_servers = 1
pm.min_spare_servers = 0
pm.max_spare_servers = 4
pm.process_idle_timeout = 1000s;
pm.max_requests = 500
request_terminate_timeout = 0
rlimit_files = 51200
env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp

Der verbliebene Rest der Bareos WebUI Konfiguration:

Neue Datei /usr/local/etc/bareos/bareos-dir.d/console/admin.conf :

# cat /usr/local/etc/bareos/bareos-dir.d/console/admin.conf
Console {
  Name = admin
  Password = ADMIN-PASSWORD
  Profile = webui-admin
}

Neue Datei /usr/local/etc/bareos/bareos-dir.d/profile/webui-admin.conf :

# cat /usr/local/etc/bareos/bareos-dir.d/profile/webui-admin.conf
Profile {
  Name = webui-admin
  CommandACL = !.bvfs_clear_cache, !.exit, !.sql, !configure, !create, !delete, !purge, !sqlquery, !umount, !unmount, *all*
  Job ACL = *all*
  Schedule ACL = *all*
  Catalog ACL = *all*
  Pool ACL = *all*
  Storage ACL = *all*
  Client ACL = *all*
  FileSet ACL = *all*
  Where ACL = *all*
  Plugin Options ACL = *all*
}

Man kann hier durchaus auch weitere Bareos directors hinzu fügen:

Geänderte /usr/local/etc/bareos-webui/directors.ini :

#   test -d /usr/local/etc/bareos-webui || mkdir -p /usr/local/etc/bareos-webui
#   chown bareos.bareos /usr/local/etc/bareos-webui
# cat /usr/local/etc/bareos-webui/directors.ini
;------------------------------------------------------------------------------
; Section localhost-dir
;------------------------------------------------------------------------------
[bareos-server.getcom.de]
enabled = "yes"
diraddress = "bareos-server.getcom.de"
dirport = 9101
catalog = "MyCatalog"

Geänderte Datei /usr/local/etc/bareos-webui/configuration.ini :

# cat /usr/local/etc/bareos-webui/configuration.ini
;------------------------------------------------------------------------------
; SESSION SETTINGS
;------------------------------------------------------------------------------
[session]
timeout=3600

;------------------------------------------------------------------------------
; DASHBOARD SETTINGS
;------------------------------------------------------------------------------
[dashboard]
autorefresh_interval=60000

;------------------------------------------------------------------------------
; TABLE SETTINGS
;------------------------------------------------------------------------------
[tables]
pagination_values=10,25,50,100
pagination_default_value=25
save_previous_state=false

;------------------------------------------------------------------------------
; VARIOUS SETTINGS
;------------------------------------------------------------------------------
[autochanger]
labelpooltype=scratch

Zuletzt noch die Berechtigungen setzen für Bareos WebUI Konfigurations-Dateien:

# chown -R www:www /usr/local/etc/bareos-webui
# chown -R www:www /usr/local/www/bareos-webui

Logs

Erstellung der Log files, Verzeichnisse und Änderung der Berechtigungen:

# chown -R bareos:bareos /var/log/bareos
# :>               /var/log/php-fpm.log
# chown -R www:www /var/log/php-fpm.log
# chown -R www:www /var/log/nginx

Wir benötigen noch Regeln für den newsyslog(8) log rotate daemon, um zu verhindern, dass das Dateisystem früher oder später geflutet wird:

Für den newsyslog daemon verwenden wird die   *.conf.d Verzeichnisse, anstatt das File /etc/newsyslog.conf zu editieren:

# grep conf\\.d /etc/newsyslog.conf
 /etc/newsyslog.conf.d/*
 /usr/local/etc/newsyslog.conf.d/*
# mkdir -p /usr/local/etc/newsyslog.conf.d
# cat > /usr/local/etc/newsyslog.conf.d/bareos << __EOF
# BAREOS
/var/log/php-fpm.log             www:www       640  7     100    @T00  J
/var/log/nginx/access.log        www:www       640  7     100    @T00  J
/var/log/nginx/error.log         www:www       640  7     100    @T00  J
/var/log/bareos/bareos.log       bareos:bareos 640  7     100    @T00  J
/var/log/bareos/bareos-audit.log bareos:bareos 640  7     100    @T00  J
__EOF

Wir verifizieren, ob newsyslog(8) unsere Konfiguration versteht:

# newsyslog -v | tail -5
/var/log/php-fpm.log : --> will trim at Tue May  1 00:00:00 2019
/var/log/nginx/access.log : --> will trim at Tue May  1 00:00:00 2019
/var/log/nginx/error.log : --> will trim at Tue May  1 00:00:00 2019
/var/log/bareos/bareos.log : --> will trim at Tue May  1 00:00:00 2019
/var/log/bareos/bareos-audit.log : --> will trim at Tue May  1 00:00:00 2019

Skel

Wir legen nun die sogenannten Bareos skel files für das rc(8) Script an, um das komplette Setup über ein File zu triggern.

Wenn wir das nicht tun würden, würde der Bareos services nicht stoppen und folgender Fehler würde ausgegeben werden:

# /usr/local/etc/rc.d/bareos-sd onestart
Starting bareos_sd.
27-Apr 02:59 bareos-sd JobId 0: Error: parse_conf.c:580 Failed to read config file "/usr/local/etc/bareos/bareos-sd.conf"
bareos-sd ERROR TERMINATION
parse_conf.c:148 Failed to find config filename.
/usr/local/etc/rc.d/bareos-sd: WARNING: failed to start bareos_sd

Wir legen sie an:

# cat > /usr/local/etc/bareos/bareos-dir.conf << __EOF
 @/usr/local/etc/bareos/bareos-dir.d/*/*
__EOF

# cat > /usr/local/etc/bareos/bareos-fd.conf << __EOF
@/usr/local/etc/bareos/bareos-fd.d/*/*
__EOF

# cat > /usr/local/etc/bareos/bareos-sd.conf << __EOF
@/usr/local/etc/bareos/bareos-sd.d/*/*
__EOF

# cat > /usr/local/etc/bareos/bconsole.conf << __EOF
@/usr/local/etc/bareos/bconsole.d/*
__EOF

Die Verifizierung:

# cat /usr/local/etc/bareos/bareos-dir.conf
@/usr/local/etc/bareos/bareos-dir.d/*/*
# cat /usr/local/etc/bareos/bareos-fd.conf
@/usr/local/etc/bareos/bareos-fd.d/*/*

# cat /usr/local/etc/bareos/bareos-sd.conf
@/usr/local/etc/bareos/bareos-sd.d/*/*

# cat /usr/local/etc/bareos/bconsole.conf
@/usr/local/etc/bareos/bconsole.d/*

Nach all den Änderungen und Anlegen neuer Files, versichern wir uns, dass alle Files unterhalb von /usr/local/etc/bareos die richtigen Berechtigungen haben werden:

# chown -R bareos:bareos /usr/local/etc/bareos
# find /usr/local/etc/bareos -type f -exec chmod 640 {} ';'
# find /usr/local/etc/bareos -type d -exec chmod 750 {} ';'

Es ist soweit…

Der main FreeBSD Service Start /etc/rc.conf fehlt nur noch.

Nach den Änderungen der /etc/rc.conf sieht das so aus:

# cat /etc/rc.conf
# NETWORK
  hostname=bareos-server.getcom.de
  ifconfig_em0="inet 10.144.88.11/24 up"
  defaultrouter="10.144.88.1"

# DAEMONS
  zfs_enable=YES
  sshd_enable=YES
  nfs_client_enable=YES
  syslogd_flags="-ss"
  sendmail_enable=NONE

# OTHER
  clear_tmp_enable=YES
  dumpdev=NO

# BAREOS
  postgresql_enable=YES
  postgresql_class=pgsql
  bareos_dir_enable=YES
  bareos_sd_enable=YES
  bareos_fd_enable=YES
  php_fpm_enable=YES
  nginx_enable=YES

Der PostgreSQL läuft bereits:

# /usr/local/etc/rc.d/postgresql status
pg_ctl: server is running (PID: 28424)
/usr/local/bin/postgres "-D" "/usr/local/pgsql/data"

Wir starten nun den Rest von Bareos:

Zuerest den PHP php-fpm daemon:

# /usr/local/etc/rc.d/php-fpm start
Performing sanity check on php-fpm configuration:
[23-Feb-2019 02:57:09] NOTICE: configuration file /usr/local/etc/php-fpm.conf test is successful

Starting php_fpm.

Der Nginx webserver:

# /usr/local/etc/rc.d/nginx start
Performing sanity check on nginx configuration:
nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok
nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful
Starting nginx.

Bareos Storage Daemon:

# /usr/local/etc/rc.d/bareos-sd start
Starting bareos_sd.

Bareos File Daemon, bekannt als Bareos Client:

# /usr/local/etc/rc.d/bareos-fd start
Starting bareos_f

… und zuletzt der wichtigste daemon, der Bareos Director:

# /usr/local/etc/rc.d/bareos-dir start
Starting bareos_dir.

Wir prüfen noch, auf welchen Ports die Daemons lauschen:

# sockstat -l4
USER     COMMAND    PID   FD PROTO  LOCAL ADDRESS         FOREIGN ADDRESS      
bareos   bareos-dir 89823 4  tcp4   *:9101                *:*
root     bareos-fd  73066 3  tcp4   *:9102                *:*
www      nginx      33857 6  tcp4   *:9100                *:*
www      nginx      28675 6  tcp4   *:9100                *:*
www      nginx      20960 6  tcp4   *:9100                *:*
www      nginx      15881 6  tcp4   *:9100                *:*
root     nginx      14388 6  tcp4   *:9100                *:*
www      php-fpm    84047 0  tcp4   127.0.0.1:9000        *:*
www      php-fpm    82285 0  tcp4   127.0.0.1:9000        *:*
www      php-fpm    80688 0  tcp4   127.0.0.1:9000        *:*
www      php-fpm    74735 0  tcp4   127.0.0.1:9000        *:*
root     php-fpm    70518 8  tcp4   127.0.0.1:9000        *:*
bareos   bareos-sd  5151  3  tcp4   *:9103                *:*
pgsql    postgres   20009 4  tcp4   127.0.0.1:5432        *:*
root     sshd       49253 4  tcp4   *:22                  *:*

Um noch zu prüfen, in welcher Reihenfolge gestartet wurde, befragen wir das rc(8) Subsystem:

 # rcorder /etc/rc.d/* /usr/local/etc/rc.d/* | grep -E '(bareos|php-fpm|nginx|postgresql)'
/usr/local/etc/rc.d/postgresql
/usr/local/etc/rc.d/php-fpm
/usr/local/etc/rc.d/nginx
/usr/local/etc/rc.d/bareos-sd
/usr/local/etc/rc.d/bareos-fd
/usr/local/etc/rc.d/bareos-dir

Über die URL http://bareos-server.getcom.de:9100 erreichen wir den Webservice:

Wir können uns nun mit dem admin Benutzer und ADMIN-PASSWORD Anmelden.

Nach dem Login sehen wir ein leeres Bareos Dashboard.

Jobs

Hier kommt nun eine Skript-Sammlung, um Clients zum Bareos Server hinzu zu fügen.

Der BRONZE-job.sh und BRONZE-sched.sh generiert Bareos files für neue Jobs und Sicherungszeiten. Wir legen das nach /root/bin

# mkdir /root/bin

Die Basisskripte sind hier zu finden:

Nach dem Download benennen wir sie um:

# mv BRONZE-sched.sh.key BRONZE-sched.sh
# mv BRONZE-job.sh.key   BRONZE-job.sh

Wir machen das ausführbar:

# chmod +x /root/bin/BRONZE-sched.sh
# chmod +x /root/bin/BRONZE-job.sh

Die Hilfe:

# /root/bin/BRONZE-sched.sh 
usage: BRONZE-sched.sh GROUP TIME

example:
  BRONZE-sched.sh 01 21:00
# /root/bin/BRONZE-job.sh
usage: BRONZE-job.sh GROUP TIME CLIENT TYPE

  GROUP option: 01 | 02 | 03
   TIME option: 00:00 - 23:59
 CLIENT option: FQDN
   TYPE option: UNIX | Windows

example:
  BRONZE-job.sh 01 21:00 CLIENT.domain.com UNIX

 

Clients

Mögliche Firewall-Probleme auf Clients

Auf einem 3CX Server verhindert per default die Firewall einen Zugriff auf den Port 9002 (bacula-fd). Der entsprechende Job schlägt daher fehl mit einem timeout auf den bacula-fd service des zu sichernden Clients.

Abhilfe:

Identifizierung der iptables Regel-IDs der zuständigen Regeln:

  • iptables -L INPUT --line-numbers | grep -e 5060 -e 5090 | grep tcp
    2 ACCEPT tcp -- anywhere anywhere multiport dports http,https,sip,sip-tls,5090 tcp flags:FIN,SYN,RST,ACK/SYN ctstate NEW
    13 ACCEPT tcp -- anywhere anywhere multiport dports http,https,5000,5001,5015,sip,sip-tls,5090 tcp flags:FIN,SYN,RST,ACK/SYN ctstate NEW

Identifizierung der vollständigen Regeln:

  • iptables -S INPUT | grep -e 5060 -e 5090 | grep tcp
    -A INPUT -p tcp -m multiport --dports 80,443,5060,5061,5090,9101,9102,9103 -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -m conntrack --ctstate NEW -j ACCEPT
    -A INPUT -p tcp -m multiport --dports 80,443,5000,5001,5015,5060,5061,5090,9101,9102,9103 -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -m conntrack --ctstate NEW -j ACCEPT

Änderungen einspielen mit Angabe der obigen Regel-IDs:

  • /sbin/iptables -R INPUT 2 -p tcp -m multiport --dports 80,443,5060,5061,5090,9102 -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -m conntrack --ctstate NEW -j ACCEPT
    /sbin/iptables -R INPUT 13 -p tcp -m multiport --dports 80,443,5000,5001,5015,5060,5061,5090,9102 -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -m conntrack --ctstate NEW -j ACCEPT

Permanente Speicherung der Regelketten:

  • service netfilter-persistent save

 

Verwendete Quellen für diesen Beitrag:

 

Proxmox Updates ohne Subscription

Proxmox ohne Subscription produktiv zu nutzen ist nicht zu empfehlen, gerade weil die Kosten dafür sich wirklich im Rahmen halten.

Für Testsysteme jedoch wird der eine oder andere das anders sehen.

Ohne Subscription jedoch wird das System E-Mails versenden mit folgendem Inhalt:

command 'apt-get update' failed: exit code 100

Um das zu ändern, ist folgendes zu tun:

(mehr …)