4

I'm trying to see if it's possible to check whether wildcard DNS (or wildcard vhosts?) is enabled on the domain a script is running on and have come up blank so far.

I've tried reading the DNS records for the domain in order to look for a "*.domain.com" type entry, but I don't believe that would work for domains running on shared hosting (or it certainly hasn't in the record I checked anyway).

Is there any way to check using PHP?

I'm hoping there is rather as if not it leaves the pretty hackish feeling method of attempting to cUrl a gibberish subdomain to see what message gets returned.

Thanks in advance Martin

Martin P
  • 41
  • 2
  • If I understand your problem you're tring to build some kind of dns digger. I've been trying to build this kind of tool in PERL (Net::DNS) and was stuck with the same problem. And I fear that the only solution is to check via Curl (or other) the content of every HTTP answer. However what you can do, is doing something a bit trickier where you would set some kind of limit and if it's reached, you skip the digging or do some custom processing. – Geoffrey Brier Jan 30 '13 at 12:48
  • I'm not trying to dig very far to be honest - just need to know whether the domain is configured to handle wildcard sub-domains and if it is then the script will run one way, if not it will fall-back to another mechanism. If it helps, the script will be running on the domain I need to check rather than trying to check "external" sites. – Martin P Jan 30 '13 at 12:59
  • You may want to use the php [dns_get_record function](http://www.php.net/manual/en/function.dns-get-record.php) to check for any CNAME/A/AAAA records with a wildcard in it but I think that most of the time people prefer configuring (virtual) hosts which is much more easier and which cannot be detected easily. – Geoffrey Brier Jan 30 '13 at 16:55
  • Nothing? This is a very interesting question. Maybe some sketches of php code? Ideas? :). I thought of checking server back requests for some... Unbelievable subdomains. For example if server return 200 OK header for address: asdpoiqweuioasdfpoijdfsdfooweidl.domain.com, then there is a huge probability that wildcard is on :). – Jacek Kowalewski Apr 21 '14 at 20:26

0 Answers0