Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknown value for tls field for server configuration in pgagroal.conf #459

Closed
ashu3103 opened this issue Aug 27, 2024 · 3 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@ashu3103
Copy link
Contributor

Bug Description

For the configuration

[pgagroal]
host = localhost
port = 2345

log_type = console
log_level = info
log_path = 

max_connections = 100
idle_timeout = 600
validation = off
unix_socket_dir = /tmp/

[primary]
host = localhost
port = 5432
tls = on
tls_ca_file = </path/to/ca/root.crt>

Warning is emitted :- "Unknown key <tls> with value <on> in section [primry] (line %d of file <17>)"

Possible reasons

In _apply_main_configuration function, unknown is well defined.
so for primary section

else if (key_in_section("tls", section, key, true, &unknown))
   {
      if (as_bool(value, &config->common.tls))
      {
         unknown = true;
      }
   }
   else if (key_in_section("tls", section, key, false, &unknown))
   {
      if (as_bool(value, &srv->tls))
      {
         unknown = true;
      }
   }

the first call to key_in_section will return false but will make unknown = true because in key_in_section function (for the first call) --

if (global && (!strncmp(section, PGAGROAL_MAIN_INI_SECTION, MISC_LENGTH) || !strncmp(section, PGAGROAL_VAULT_INI_SECTION, MISC_LENGTH)))
   {
      return true;
   }
   else if (!global && strlen(section) > 0)
   {
      return true;
   }
   else
   {
      if (unknown)
      {
         *unknown = true;
      }
      return false;
   }

global will be true so code will go to else block and since unknown will always be true (well-defined), *unknown will be set true.

Solution

The last argument of key_in_section function should be NULL where global is true i.e. if the section is either [pgagroal] or [pgagroal-vault]

@jesperpedersen
Copy link
Collaborator

Shouldn't the check be against vault ?

@ashu3103
Copy link
Contributor Author

Shouldn't the check be against vault ?

Hmm, I am not sure how it is related to vault.

Cause I'm facing this issue with the main

@ashu3103
Copy link
Contributor Author

ashu3103 commented Sep 7, 2024

@jesperpedersen, Shall we close this issue?

Working fine according to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants