Skip to content

bareos-dir crash when required QueryFile is missing in configuration #2228

@bruno-at-bareos

Description

@bruno-at-bareos

Bareos component version

master 25.0.0~pre327.749f274a2

Steps to reproduce

use any of the existing systemtest and remove the line in etc/bareos/bareos-dir.d/director/bareos-dir.conf

QueryFile = "/usr/lib/bareos/scripts/query.sql"

Run the director (start correctly),
issue command query

Expected results

  • QueryFile is required (as documented) bareos-dir -t should emit an error, and bareos-dir shouldn't be able to start.
  • In case Queryfile is missing and can't be read: file disappear after bareos-dir has been started: query command should return an error, not crashing the daemon.
  • bareos-dir should also check on start if queryfile exist and is readable immediately (can it be kept in memory ? and reload do a refresh ?

Actual results

bareos-dir segv

Environment

- OS: `openSUSE Tumbleweed`
- component: bareos-dir

Relevant log output

bareos-dir --xc 

./bareos_dir_config.txt
Director {
  Name = "bareos-dir"
  Messages = "Daemon"
  DirAddresses = {
    ipv4 = {
      addr = 0.0.0.0
      port = 30491
    }
    ipv6 = {
      addr = ::
      port = 30491
    }
  }
  WorkingDirectory = "/ioda/bareos/git/build/test/systemtests/tests/py3plug-fd-mariabackup/working"
  MaximumConcurrentJobs = 10
  Password = "[md5]19c05ce71554a186e052ee6bfadcde4a"
  Auditing = Yes
}

Client {
  Name = "bareos-fd"
  Description = "Client resource of the Director itself."
  Address = "XXX_REPLACE_WITH_LOCAL_HOSTNAME_XXX"
  Port = 30492
  Password = "[md5]1f06c479e5a4153436f11fa3a96eaca9"
}

JobDefs {
  Name = "DefaultJob"
  Type = Backup
  Level = Incremental
  Messages = "Standard"
  Storage = "File"
  Pool = "Incremental"
  FullBackupPool = "Full"
  IncrementalBackupPool = "Incremental"
  DifferentialBackupPool = "Differential"
  Client = "bareos-fd"
  FileSet = "SelfTest"
  WriteBootstrap = "/ioda/bareos/git/build/test/systemtests/tests/py3plug-fd-mariabackup/working/%c.bsr"
}

Job {
  Name = "backup-bareos-fd"
  Client = "bareos-fd"
  FileSet = "MariabackupTest"
  JobDefs = "DefaultJob"
}

Job {
  Name = "RestoreFiles"
  Description = "Standard Restore template. Only one such job is needed for all standard Jobs/Clients/Storage ..."
  Type = Restore
  Messages = "Standard"
  Storage = "File"
  Pool = "Incremental"
  Client = "bareos-fd"
  FileSet = "SelfTest"
  Where = "/ioda/bareos/git/build/test/systemtests/tests/py3plug-fd-mariabackup/tmp/bareos-restores"
}

Storage {
  Name = "File"
  Address = "XXX_REPLACE_WITH_LOCAL_HOSTNAME_XXX"
  Port = 30493
  Password = "[md5]519001602a0e85b0fe7dbead5d95d710"
  Device = "FileStorage"
  MediaType = "File"
}

Catalog {
  Name = "MyCatalog"
  DbPassword = ""
  DbUser = "regress"
  DbName = "regress_py3plug_fd_mariabackup"
}

FileSet {
  Name = "SelfTest"
  Description = "fileset just to backup some files for selftest"
  Include {
    Options {
      Signature = "XXH128"
      HardLinks = No
      AclSupport = Yes
      XattrSupport = Yes
    }
    File = "\</ioda/bareos/git/build/test/systemtests/tests/py3plug-fd-mariabackup/tmp/file-list"
  }
}

FileSet {
  Name = "MariabackupTest"
  Description = "Test the Plugin functionality of the Percona Plugin."
  Include {
    Options {
      Signature = "XXH128"
      HardLinks = No
      AclSupport = Yes
      XattrSupport = Yes
    }
    Plugin = "python3:module_path=/ioda/bareos/git/build/test/systemtests/tests/py3plug-fd-mariabackup/python-modules:module_name=bareos-fd-mariabackup:mycnf=my.cnf:dumpbinary=/usr/bin/mariadb-backup --defaults-file=mysqldefaults:extradumpoptions=--user=build:mysqlcmd=/usr/bin/mariadb --defaults-file=mysqldefaults --user=build --raw"
  }
}

FileSet {
  Name = "Catalog"
  Description = "Backup the catalog dump and Bareos configuration files."
  Include {
    Options {
      Signature = "XXH128"
      HardLinks = No
      AclSupport = Yes
      XattrSupport = Yes
    }
    File = "/ioda/bareos/git/build/test/systemtests/tests/py3plug-fd-mariabackup/working/regress_py3plug_fd_mariabackup.sql"
    File = "/ioda/bareos/git/build/test/systemtests/tests/py3plug-fd-mariabackup/etc/bareos"
  }
}

Pool {
  Name = "Scratch"
  PoolType = Scratch
}

Pool {
  Name = "Incremental"
  LabelFormat = "Incremental-"
  MaximumVolumes = 100
  MaximumVolumeBytes = 1 g
  VolumeRetention = 1 months
}

Pool {
  Name = "Full"
  LabelFormat = "Full-"
  MaximumVolumes = 100
  MaximumVolumeBytes = 50 g
}

Pool {
  Name = "Differential"
  LabelFormat = "Differential-"
  MaximumVolumes = 100
  MaximumVolumeBytes = 10 g
  VolumeRetention = 3 months
}

Messages {
  Name = "Standard"
  console = all,!saved,!skipped,!audit
  append = /ioda/bareos/git/build/test/systemtests/tests/py3plug-fd-mariabackup/log/bareos.log = all,!saved,!skipped,!audit
  catalog = all,!saved,!skipped,!audit
}

Messages {
  Name = "Daemon"
  console = all,!saved,!skipped,!audit
  append = /ioda/bareos/git/build/test/systemtests/tests/py3plug-fd-mariabackup/log/bareos.log = all,!skipped,!audit
  append = /ioda/bareos/git/build/test/systemtests/tests/py3plug-fd-mariabackup/log/bareos-audit.log = audit
}

Profile {
  Name = "operator"
  Description = "Profile allowing normal Bareos operations."
  JobAcl = "*all*"
  ClientAcl = "*all*"
  StorageAcl = "*all*"
  ScheduleAcl = "*all*"
  PoolAcl = "*all*"
  CommandAcl = "!.bvfs_clear_cache", "!.exit", "!.sql", "!configure", "!create", "!delete", "!purge", "!prune", "!sqlquery", "!umount", "!unmount", "*all*"
  FileSetAcl = "*all*"
  CatalogAcl = "*all*"
  WhereAcl = "*all*"
  PluginOptionsAcl = "*all*"
}

Relevant traces output

Anything else?

bareos-audit.log

bareos-dir.trace.txt
bareos.377911.traceback.txt

Metadata

Metadata

Labels

bugThis addresses a bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions