Hi colleagues,
I’m on RouterOS 7.16.2 and there is issue with DoH certificate verification.
Spoiler: /ip/dns/set verify-doh-cert=no|yes|yes-without-crl
Details:
The DNS configuration is the following:
servers: 1.1.1.1
dynamic-servers:
use-doh-server: https://cloudflare-dns.com/dns-query
verify-doh-cert: no
doh-max-server-connections: 5
doh-max-concurrent-queries: 50
doh-timeout: 5s
When there are no certificates installed, then using “/ip/dns/set verify-doh-cert=no” makes it working. This makes me thinking that “verify-doh-cert=no” completely disables all checks; such behaviour do not fit my case (equipment located in totally untrusted environment), so I want to avoid MITM and need to enable verification.
If I install certificates chain (intermediate and root for the cloudflare-dns.com) and enable verify-doh-cert, it still do not work, because it cannot verify certificate against learned from the certificate CRL with the following message in the log
17:32:08 dns,error DoH server connection error: SSL: ssl: crl not found for: "C=US, S=California, L=San Francisco, O=Cloudflare, Inc., CN=cloudflare-dns.com" (6)
The CRLs in the obtained certificate are the following and both are available online, while not present in /certificate/crl/print after importing intermediate/root certs on the previous step:
X509v3 CRL Distribution Points:
Full Name:
URI:http://crl3.digicert.com/DigiCertGlobalG2TLSRSASHA2562020CA1-1.crl
Full Name:
URI:http://crl4.digicert.com/DigiCertGlobalG2TLSRSASHA2562020CA1-1.crl
When I manually add these two URLs using /certificate/crl/add url=… , enabling verify-doh-cert starts to work.
And there I see the issue.
Manually adding CRL URLs from the end certificates is the way to the failure - remote site can change certificate without any notifications and if there will be another CRL URLs, then DNS resolution will stop work again. So, if I’m not missing something, this needs to be fixed and there are two ways to do this:
- like this done for /tool/fetch check-certificate=(no|yes|yes-without-crl), add ‘yes-without-crl’ to the verify-doh-cert parameter;
- dynamically learn from the learned CRL with the reasonable timeout, so first request will be delayed but subsequent requests will use cached data.
Personally me thinks the first option is easier to be implemented (the code is already available for /tool/fetch) and keeps things safe enough.
Will appreciate any comments on this. If I’m missing something - please, correct me. If this is really issue - are there chances to see it fixed?
Thank you.