Search code examples
phpdnslets-encryptcaadns-get-record

Check hostname has CAA record in php 5.6


Good morning,

I'm currently facing a small problem. To create some automated process, I need to be able to check If a hostname has a CAA record.

CAA record are needed by letsencrypt to generate certificate. I wanted to use dns_get_record to check my DNS, but unfortunately for me, we are using PHP 5.6 and dns_get_record in php 5.6 does not fetch those record.

So I was wondering if anyone had any idea in php, on how I could check if an hostname has a CAA record.

Thanks in adavance


Solution

  • Unfortunately, PHP doesn't provide any other tools for this. You'll have to settle with one of the following:

    • Upgrade PHP (just do it, you'll have to anyway and it's not as painful as you may think)
    • Find a user-space DNS-resolver library that works on PHP 5.6 (there are some, but I don't know of any with CAA support)
    • Use something like exec('dig caa <domainNameHere>') to hack around it
    • Do this outside of PHP