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

Off by one in Unbound 1.16.0 verbosity setting. #705

Closed
buggysolid opened this issue Jun 23, 2022 · 3 comments
Closed

Off by one in Unbound 1.16.0 verbosity setting. #705

buggysolid opened this issue Jun 23, 2022 · 3 comments

Comments

@buggysolid
Copy link

buggysolid commented Jun 23, 2022

Describe the bug
The verbosity option in unbound.conf for controlling the log level information is being incremented plus one of what is defined in the config. .e.g. verbosity: -1 will result in a verbosity: 0 at runtime.

To reproduce
Steps to reproduce the behavior:

  1. Follow build from source instructions here https://unbound.docs.nlnetlabs.nl/en/latest/getting-started/installation.html#building-from-source-compiling on Ubuntu 20.04.1 LTS
  2. Use the unbound.conf as suggested here https://unbound.docs.nlnetlabs.nl/en/latest/getting-started/configuration.html
  3. Append a verbosity: -1 option to the unbound.conf
  4. sudo useradd unbound
  5. sudo chown -R unbound /usr/local/etc/unbound
  6. sudo ldconfig
  7. sudo -u unbound unbound-anchor
  8. sudo -u unbound unbound-control-setup
  9. Enable remote-control in unbound.conf
  10. sudo systemctl stop systemd-resolved
  11. sudo unbound -v
  12. unbound-control status

Expected behavior
Unbound fails to run due to attempting to start with an invalid verbosity level configuration of -1.

System:

  • Unbound version: 1.16.0
  • OS: Ubuntu 20.04.1 LTS
  • unbound -V output:
root@ubuntu-s-1vcpu-1gb-ams3-01:~# unbound -V
Version 1.16.0

Configure line:
Linked libs: mini-event internal (it uses select), OpenSSL 1.1.1f  31 Mar 2020
Linked modules: dns64 respip validator iterator

BSD licensed, see LICENSE in source package for details.
Report bugs to unbound-bugs@nlnetlabs.nl or https://github.com/NLnetLabs/unbound/issues
root@ubuntu-s-1vcpu-1gb-ams3-01:~#

Additional information

You can see that unbound-checkconf correctly identifies the invalid option of verbosity: -1 which if it is invalid should cause Unbound to not start when you attempt to execute Unbound but something is incrementing the verbosity statement at runtime.

root@ubuntu-s-1vcpu-1gb-ams3-01:~# sudo unbound -v
[1655978380] unbound[28024:0] notice: Start of unbound 1.16.0.
root@ubuntu-s-1vcpu-1gb-ams3-01:~# unbound-control status
version: 1.16.0
verbosity: 0
threads: 1
modules: 2 [ validator iterator ]
uptime: 9 seconds
options: reuseport control(ssl)
unbound (pid 28026) is running...
root@ubuntu-s-1vcpu-1gb-ams3-01:~# unbound-checkconf
[1655978446] unbound-checkconf[28028:0] fatal error: verbosity value < 0
root@ubuntu-s-1vcpu-1gb-ams3-01:~#

I haven't dug much more into this issue re: where in the code is causing this, but it is clearly a bug.

@TCY16
Copy link
Contributor

TCY16 commented Jun 23, 2022

Hi @buggysolid, thanks for the in depth bug report!
You're correct that the verbosity is incremented when unbound is started. This is due to the command you use to start unbound: unbound -v, which increments the config verbosity with 1.
Unbound currently accepts verbosity levels under 0 and treats these as 0. Unless this causes any big errors, we don't see a reason to change this behaviour. I'll see if i can make the manpage a little clearer though!

@buggysolid
Copy link
Author

Unbound currently accepts verbosity levels under 0 and treats these as 0. Unless this causes any big errors, we don't see a reason to change this behaviour.

It hasn't caused me any errors but I can think of a case in which someone runs unbound-checkconf before starting Unbound during a provisioning process to validate there config. If that utility borks AFAIK it will set a non-zero exit code.

I'll see if i can make the manpage a little clearer though!

That would be good, I wouldn't exactly describe it as a bug either but it wasn't clear from the documentation.

TCY16 added a commit that referenced this issue Jun 23, 2022
@TCY16
Copy link
Contributor

TCY16 commented Jun 23, 2022

Closing this issue in the hope that the clarification in the manpage is enough

@TCY16 TCY16 closed this as completed Jun 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants