Icinga / icingaweb2-module-director

The Director aims to be your new favourite Icinga config deployment tool. Director is designed for those who want to automate their configuration deployment and those who want to grant their “point & click” users easy access to the configuration.
https://icinga.com/docs/director/latest
GNU General Public License v2.0
413 stars 203 forks source link

icingadirector service fails with "DB configuration is not valid" #2103

Open jwilliams-shadowsoft opened 4 years ago

jwilliams-shadowsoft commented 4 years ago

Expected Behavior

icinga-director daemon should run with no errors.

Current Behavior

Possible Solution

It seems that the daemon process cannot find the connection information.

Steps to Reproduce (for bugs)

Your Environment

/etc/icingaweb2/resources.ini (partial, redacted)

[director-db]
type      = "db"
db        = "pgsql"
host      = "SEPARATE DB SERVER"
dbname    = "director"
username  = "director"
password  = "REDACTED"
charset   = "utf8"

/etc/icingaweb2/modules/director/config.ini

[db]
resource = "director-db"
Thomas-Gelf commented 4 years ago

@jwilliams-shadowsoft: please check whether the user icingadirector is able to read those files

jwilliams-shadowsoft commented 4 years ago

Thanks @Thomas-Gelf -- first thing I checked. Also turned off SELinux and behavior was the same.

jwilliams-shadowsoft commented 4 years ago

What else can I check @Thomas-Gelf ?

powelleb commented 4 years ago

not sure if postgres does not need it or applicable, but for mysql there is another flag in the resources.ini

use_ssl = "0" or use_ssl = "1"

the other thought is to force the port value for postgres. port = "5432"

drallgood commented 3 years ago

I bet you had the same issue as me: a special character in the resources.ini file that prevented it from being parsed

matejv commented 3 years ago

Had the same problem as described. The culprit were indeed "special" chars in resources.ini file.

I have a LDAP resource in my resources.ini, where root_dn, bind_dn contain commas (,) and bind_pw contains an exclamation mark (!). When I put those values in quotes, director service started fine. When any of them were unquoted, director failed with DB configuration is not valid.

Now, I use ansible module ini_file to write my resources.ini and ansible didn't put in quotes. I don't know enough about ini file format to say whether Ansible or icingadirector handles writing/parsing ini files wrong. But all other Icinga web2 components seem to work fine with those values without quotes, so I'd expect Director should as well.

Edit: (forgot to include version info):

Installed on CentOS 7, from RPM packages.

Loaded Libraries:

Loaded Modules:

jwilliams-shadowsoft commented 2 years ago

I just had a recurrence of this on director v1.9.1 and the tip about quoting funny strings in my resources.ini works. So thanks @drallgood !

jwilliams-shadowsoft commented 2 years ago

@matejv So do I, I think I can stick some extra quotes in my .j2 template to compensate for this.

Now, I use ansible module [ini_file]

alamp1360 commented 1 year ago

I ran into the same problem because my database password contained a "(". After enclosing the password with quotes, the daemon started to run. Afterwards i tried to change the ressource config using the icingaweb UI and suddenly all the config strings were enclosed with quotes.

lukasCoppens commented 1 year ago

I also ran into this problem, we use icinga in docker configured via env vars, those also do not render the quotes into the resources.ini file. In our case LDAP settings where also the cause.

Running icingacli director daemon run outputted the DB configuration is not valid without any indication about what is wrong. The web itself and all our modules (director, icingadb, reporting) all worked without any issue. Also running kickstart and migrations in the same container (from the cli) also worked like expected. Seems like a bug in the daemon.

Adding escaped quotes to the env var helped us. Thanks @matejv, @drallgood!