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

auth, rec: RSA-SHA1 broken on EL9 #12890

Closed
Habbie opened this issue Jun 6, 2023 · 11 comments · Fixed by #12893
Closed

auth, rec: RSA-SHA1 broken on EL9 #12890

Habbie opened this issue Jun 6, 2023 · 11 comments · Fixed by #12893

Comments

@Habbie
Copy link
Member

Habbie commented Jun 6, 2023

  • Program: Authoritative, Recursor
  • Issue type: Bug report
  • Affects: auth 4.8, rec 4.9

Short description

Red Hat has decided that RSASHA1 validation (and signing?) is, by default, forbidden in EL9, even for DNSSEC.

This breaks auth if a user has algo 5/7 keys:

# pdnsutil test-algorithms
Testing algorithm 5(RSASHA1): 'OpenSSL RSA' ->'OpenSSL RSA' -> 'OpenSSL RSA' (2048 bits) OpenSSL RSA: Could not initialize context for signing: 50331800:digital envelope routines::invalid digest - crypto/evp/m_sigver.c:343 - do_sigver_init
Testing algorithm 7(RSASHA1-NSEC3-SHA1): 'OpenSSL RSA' ->'OpenSSL RSA' -> 'OpenSSL RSA' (2048 bits) OpenSSL RSA: Could not initialize context for signing: 50331800:digital envelope routines::invalid digest - crypto/evp/m_sigver.c:343 - do_sigver_init

This breaks recursor - icann.org, which currently is signed with algo 7, is declared BOGUS.

Workaround

Running update-crypto-policies --set DEFAULT:SHA1 (and restarting affected daemons) makes the problem go away. LEGACY also works, but likely allows more things that users may not want. (you may need to dnf install crypto-policies-scripts)

Handling in other software

For BIND, update-crypto-policies generates a snippet (included from named.conf) that explicitly disables the affected algorithms, which changes the outcome from Bogus to Insecure.

Unbound handles the failure case explicitly: NLnetLabs/unbound@6cfcf21

cznic libdnssec (gnutls, not openssl): https://gitlab.nic.cz/knot/knot-dns/-/commit/b0c6f0709aeab#3b7edfb68fbd436c6b46dcbb2c7a8c0cc6d5fd92_264_266

Fixing this

Some proposals:

configurable DNSSEC policy

if we add support for a feature like disable-algorithms=5,7 to Recursor, users at least have a quick workaround to go insecure for such keys without changing the systemwide policy. Configuration of that feature could maybe be integrated into the systemwide policy like RHEL has done for BIND.

detect the situation/handle the error

Either during validation handle the specific error (like Unbound does), or do a check at startup and then automatically disable the algorithms.

document it

We could also decide to just document that everything will be broken until the user updates the systemwide policy so OpenSSL allows RSA-SHA1 validation.

@Habbie Habbie added this to the common-soon milestone Jun 6, 2023
@zeha
Copy link
Collaborator

zeha commented Jun 6, 2023

I guess pdns could also init openssl with an explicit policy, or at least openssl.cnf?

@omoerbeek
Copy link
Member

I did search for a way to configure openssl (either programmatically or via i'ts .cnf file), but did not find it

@omoerbeek
Copy link
Member

I think the steps ahead are:

  1. document how to change system wide policy for RHEL9 for now in upgrade guide
  2. Implement method to disable specific algos, so we get Insecure for zones affected
  3. Update docs to reflects the choices: either change system wide policy (so the zones affected can be validated), or disable to specific algos (with the consequence to zones become Insecure)

@Habbie
Copy link
Member Author

Habbie commented Jun 6, 2023

I guess pdns could also init openssl with an explicit policy, or at least openssl.cnf?

it is my understanding that it's not possible to influence or even query the policy from our end

@omoerbeek
Copy link
Member

A step 4. could be: a smart way to adapt. That would involve a test to see if the algos work and then disable the algos if not. That way the default RHEL9 config would “work” (go Insecure) and if the sysadmin enables a policy we adapt and start validating.

@Habbie
Copy link
Member Author

Habbie commented Jun 6, 2023

That would involve a test to see if the algos work and then disable the algos if not.

I have just learned that this is what BIND9 does (outside of RHELs automatic configuration).

@Habbie
Copy link
Member Author

Habbie commented Jun 6, 2023

for auth, Otto suggests teaching check-zone to warn about keys using unsupported algorithms.

@mnordhoff
Copy link
Contributor

Should Recursor use EDE? Code 1, "Unsupported DNSKEY Algorithm", perhaps?

@omoerbeek
Copy link
Member

omoerbeek commented Jun 6, 2023

Should Recursor use EDE? Code 1, "Unsupported DNSKEY Algorithm", perhaps?

I would not have been be surprised if that would work automatically if we modify the return value of DNSCryptoKeyEngine::isAlgorithmSupported()

But alas, I was wrong, DNSSEC related EDE is only added to an answer if it is Bogus, not when going Insecure

@Habbie
Copy link
Member Author

Habbie commented Jun 6, 2023

#12891 is the first step for documenting the problem for existing users. It points at this issue, because it is actively developing. Eventually we should update the docs once more to explain what we actually did to make it easy to deal with this issue.

@mortenstevens
Copy link
Contributor

A step 4. could be: a smart way to adapt. That would involve a test to see if the algos work and then disable the algos if not. That way the default RHEL9 config would “work” (go Insecure) and if the sysadmin enables a policy we adapt and start validating.

I believe that would be the best approach and would save us a lot of bug reports on both sides (Fedora/Red Hat) and PowerDNS.

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

Successfully merging a pull request may close this issue.

5 participants