Skip to content

How to customize the dns validation resolution address? #91

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

Open
jiayisheji opened this issue Aug 1, 2024 · 2 comments
Open

How to customize the dns validation resolution address? #91

jiayisheji opened this issue Aug 1, 2024 · 2 comments

Comments

@jiayisheji
Copy link

I need to apply for two certificates for example.com and *.example.com. example.com can pass DNS resolution authentication successfully, but *.example.com always gets the error Authorization not found in DNS TXT record: _acme-challenge.example.com. When I debug the code, the recordValues ​​array value in the verify.js#verifyDnsChallenge function is always the keyAuthorization of example.com. The reason for the failure is that I cannot modify the DNS server resolution by myself using the dns.setServers method. If I want to customize the DNS server address, how can I do it?

@wmantly
Copy link

wmantly commented Aug 6, 2024

I just delt with doing wildcards, if you log what TXT records are requested to be added, they both will be _acme-challenge.example.com with 2 different keys to be added. Both need to be added to _acme-challenge.example.com

Are you using the sample code from https://github.com/publishlab/node-acme-client/blob/master/examples/dns-01/dns-01.js ? This works perfectly.

@jiayisheji
Copy link
Author

@wmantly I useing https://github.com/publishlab/node-acme-client/blob/master/examples/api.js.

I add useNameserversResolveDnsRecord() method,execute it first.

async useNameserversResolveDnsRecord(domain: string, nameservers: string[], logger: AcmeClientLogger) {
      const originalServers = getServers();
      logger.info(`[${domain}] Original Servers: ${originalServers.join(', ')}`);
      
      setServers(nameservers);
      logger.info(`[${domain}] Restart Servers: ${getServers().join(', ')}`);
      
      return () => {
        setServers(originalServers);
        logger.info(`[${domain}] Restore Servers: ${getServers().join(', ')}`);
      }
}

I look at the source code, you use nodejs dns module resolution, so I'm simple and rough implementation.

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