barcus/bareos

env DB_NAME and DB_USER aren't replaced

Closed this issue · 0 comments

Hi Barcus,

thanks for you wonderful work!
I noticed an issue with replacing the DB_NAME and DB_USER values in the Director config.

In the docker-entrypoint.sh it is hardcoded:

DB_NAME = "bareos"
DB_USER = "root"

It is not always the case (e.g. when Barios database shares MySQL with other services). Giving Bareos service the root access is not a secure method for production environments.
Furthermore, database naming may be configured to use prefixes, therefore "bareos" will not always fit.

Both could be easily fixed:
sed -i 's#dbuser =.*#dbuser = '\""${DB_USER}"\"'#' \ /etc/bareos/bareos-dir.d/catalog/MyCatalog.conf
sed -i 's#dbname =.*#dbname = '\""${DB_NAME}"\"'\n dbaddress = '\""${DB_HOST}"\"'\n dbport = '\""${DB_PORT}"\"'#' \ /etc/bareos/bareos-dir.d/catalog/MyCatalog.conf

Best,
Farrad