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

pdnsutil import-zone-key silently fails on mixed bind+sql configuration #15045

Open
2 tasks done
miodvallat opened this issue Jan 16, 2025 · 0 comments
Open
2 tasks done

Comments

@miodvallat
Copy link
Contributor

Short description

While working on adding the "does the key really exist" checks adedd to pdnsutil add-zone-key to the similar import-zone-key and import-zone-key-pem, some tests started to fail due to this check.

It turns out that, on a bind + sql configuration, where the bind zones do not have any keys, adding (or importing) a zone key fails at the sql level, because the domain does not exist in the database.

This turns out to be a can of worms larger than expected, so I'm opening an issue to keep track of this until I can find a proper way to solve the problem (issueing pdns create-zone won't work as the zones are existing in the bind configuration which takes precedence).

Environment

Does not matter

Steps to reproduce

  • cd regression-tests.auth-py
  • Run one of the tests which uses bind + sql, e.g. ./runtests test_XFRIncomplete.py
  • Run ../pdns/pdnsutil --config-dir=configs/auth list-all-zones to confirm example.org exists
  • Run ../pdns/pdnsutil --config-dir=configs/auth list-keys example.org to confirm no key exists
  • Run ../pdns/pdnsutil --config-dir=configs/auth import-zone-key example.org configs/auth/dnssec.key, it outputs 0 which is not a valid key id.
  • Run ../pdns/pdnsutil --config-dir=configs/auth list-keys example.org to confirm no key exists.

Expected behaviour

The key is correctly inserted into the database, with a non-zero key id.

Actual behaviour

SQL INSERT request fails because the zone does not exist in the database. Because of this, the select LAST_INSERT_ID() request returns a value of 0 (no insertion took place), which is not handled as an error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant