Re: Wildcard Subdomain

"Felipe Neuwald" <[email protected]>
Newsgroups gmane.network.dns.bind9.dlz
Message-ID <[email protected]>
Graham,

bind9-dlz+mysql-9.3.2+0.7.0 running on FreeBSD 6.3-STABLE.

Here is a part of my named.conf:
dlz "Mysql zone" {
   database "mysql
   {host=127.0.0.1 dbname=autovhost user=autovhost pass=dvmrMJaKWzxZyKsx}
   {SELECT zone FROM dns_records WHERE zone = '%zone%'}
   {SELECT ttl, type, mx_priority, IF(type = 'TXT',
CONCAT('\"',data,'\"'), data) AS data
    FROM dns_records
    WHERE zone = '%zone%' AND host = '%record%' AND type <> 'SOA' AND
type <> 'NS'}
   {SELECT ttl, type, data, primary_ns, resp_contact, serial, refresh,
retry, expire, minimum
    FROM dns_records
    WHERE zone = '%zone%' AND (type = 'SOA' OR type='NS')}
   {SELECT ttl, type, host, mx_priority, IF(type = 'TXT',
CONCAT('\"',data,'\"'), data) AS data, resp_contact, serial, refresh,
retry, expire, minimum
    FROM dns_records
    WHERE zone = '%zone%' AND type <> 'SOA' AND type <> 'NS'}
   {SELECT zone FROM xfr where zone='%zone%' AND client = '%client%'}";
};

And here, SQL:

 SELECT *
FROM `dns_records`
WHERE `zone` LIKE CONVERT( _utf8 'mydomain.com'
USING latin1 )
COLLATE latin1_swedish_ci
LIMIT 0 , 30

+-----+---------+--------------+-------+------+------+-------------+------------------------+---------------+--------------------------+--------+---------+-------+--------+---------+
| id  | info_id | zone         | ttl   | type | host | mx_priority |
data                   | primary_ns    | resp_contact             |
serial | refresh | retry | expire | minimum |
+-----+---------+--------------+-------+------+------+-------------+------------------------+---------------+--------------------------+--------+---------+-------+--------+---------+
| 406 |      68 | mydomain.com | 86400 | SOA  | @    |        NULL |
                     | mydomain.com. | sysadm.xxxxxx. |      1 |
10800 |  7200 | 604800 |   86400 |
| 407 |      68 | mydomain.com | 86400 | NS   | @    |        NULL |
ns1.xxxxxxx.com.br.  |               |                          |
NULL |    NULL |  NULL |   NULL |    NULL |
| 408 |      68 | mydomain.com | 86400 | NS   | @    |        NULL |
ns2.xxxxxxx.com.br.  |               |                          |
NULL |    NULL |  NULL |   NULL |    NULL |
| 409 |      68 | mydomain.com | 86400 | MX   | @    |           1 |
mail.xxxxxxx.com.br. |               |                          |
NULL |    NULL |  NULL |   NULL |    NULL |
| 410 |      68 | mydomain.com | 86400 | A    | www  |        NULL |
200.200.200.32         |               |                          |
NULL |    NULL |  NULL |   NULL |    NULL |
| 411 |      68 | mydomain.com | 86400 | A    | mail |        NULL |
200.200.200.32         |               |                          |
NULL |    NULL |  NULL |   NULL |    NULL |
| 412 |      68 | mydomain.com | 86400 | A    | *    |        NULL |
200.200.200.200        |               |                          |
NULL |    NULL |  NULL |   NULL |    NULL |
+-----+---------+--------------+-------+------+------+-------------+------------------------+---------------+--------------------------+--------+---------+-------+--------+---------+
7 rows in set (0.00 sec)

mysql> describe dns_records;
+--------------+--------------+------+-----+---------+----------------+
| Field        | Type         | Null | Key | Default | Extra          |
+--------------+--------------+------+-----+---------+----------------+
| id           | int(10)      | NO   | PRI | NULL    | auto_increment |
| info_id      | int(10)      | NO   | PRI | NULL    |                |
| zone         | varchar(255) | YES  |     | NULL    |                |
| ttl          | int(11)      | YES  |     | NULL    |                |
| type         | varchar(255) | YES  |     | NULL    |                |
| host         | varchar(255) | YES  |     | NULL    |                |
| mx_priority  | int(11)      | YES  |     | NULL    |                |
| data         | text         | NO   |     | NULL    |                |
| primary_ns   | varchar(255) | NO   |     | NULL    |                |
| resp_contact | varchar(255) | NO   |     | NULL    |                |
| serial       | bigint(20)   | YES  |     | NULL    |                |
| refresh      | int(11)      | YES  |     | NULL    |                |
| retry        | int(11)      | YES  |     | NULL    |                |
| expire       | int(11)      | YES  |     | NULL    |                |
| minimum      | int(11)      | YES  |     | NULL    |                |
+--------------+--------------+------+-----+---------+----------------+
15 rows in set (0.00 sec)

mysql> describe xfr;
+--------+--------------+------+-----+---------+----------------+
| Field  | Type         | Null | Key | Default | Extra          |
+--------+--------------+------+-----+---------+----------------+
| id     | int(10)      | NO   | PRI | NULL    | auto_increment |
| zone   | varchar(255) | YES  |     | NULL    |                |
| client | varchar(255) | YES  |     | NULL    |                |
+--------+--------------+------+-----+---------+----------------+
3 rows in set (0.00 sec)

mysql> select * from xfr;
+----+-------------------+-----------+
| id | zone              | client    |
+----+-------------------+-----------+
|  1 | myhost.com.br | 127.0.0.1 |
+----+-------------------+-----------+
1 row in set (0.00 sec)

The result:

[root@myhost /]# ping thisisasimpletest.mydomain.com
PING thisisasimpletest.mydomain.com (200.200.200.200): 56 data bytes

Felipe Neuwald.

2008/7/1 Graham Weldon <[email protected]>:
> Can you post up an example of what you are using, including the queries
> being used in your conf?
> Also, what version of DLZ are you using?
> Thanks Felipe!
>
> Cheers,
> Graham Weldon
>
> Fluid Lino
> (02) 4927 5337
> (0407) 017 293
> [email protected]
> www.fluidlino.com.au
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of
> Felipe Neuwald
> Sent: Wednesday, 2 July 2008 8:47 AM
> To: [email protected]
> Subject: Re: [Bind-dlz-testers] Wildcard Subdomain
>
> Graham,
>
> It works ok for me. * and @.
>
> Felipe Neuwald.
>
> 2008/7/1 Graham Weldon <[email protected]>:
>>
>> Hi all,
>> I've tried adding a wildcard subdomain to one of my zones with a
>> simple asterisk entry as an A record.
>> This doesn't seem to resolve correctly once entered.
>>
>> Can Bind-DLZ handle wildcard subdomains?
>> If so, what is the method required to achieve this?
>> Thanks!
>>
>>
>> Cheers,
>> Graham Weldon
>>
>> Fluid Lino
>> (02) 4927 5337
>> (0407) 017 293
>> [email protected]
>> www.fluidlino.com.au
>>
>> ----------------------------------------------------------------------
>> --- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
>> Studies have shown that voting for your favorite open source project,
>> along with a healthy diet, reduces your potential for chronic lameness
>
>> and boredom. Vote Now at http://www.sourceforge.net/community/cca08
>> _______________________________________________
>> Bind-dlz-testers mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/bind-dlz-testers
>>
>
> ------------------------------------------------------------------------
> -
> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
> Studies have shown that voting for your favorite open source project,
> along with a healthy diet, reduces your potential for chronic lameness
> and boredom. Vote Now at http://www.sourceforge.net/community/cca08
> _______________________________________________
> Bind-dlz-testers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bind-dlz-testers
>
> -------------------------------------------------------------------------
> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
> Studies have shown that voting for your favorite open source project,
> along with a healthy diet, reduces your potential for chronic lameness
> and boredom. Vote Now at http://www.sourceforge.net/community/cca08
> _______________________________________________
> Bind-dlz-testers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bind-dlz-testers
>

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.