@dev_team I’m still looking to wildcard and dnsmasq.
For a self wildcard.domain.tld, I figured that you can have just one IP definition for a *.domain.tld. My concern is of course when several green networks are set on the server. For example if I wrote to /etc/dnsmasq.conf (two green nics)
address=/toto.ca/192.168.12.170
address=/toto.ca/192.168.14.10
Only the last entry is taken by dnsmasq
[lsd@leo ~]$ dig any plop.toto.ca @192.168.12.170
..
;; QUESTION SECTION:
;plop.toto.ca. IN ANY
..
;; ANSWER SECTION:
plop.toto.ca. 0 IN A 192.168.14.10
I don’t know if it is really important because we can retrieve the first green IP, and use it, but for the second green network I don’t know if we can create an Issue if the wildcard.domain.tld is referred to the first green network. I mean about computers on the other green lan if they will be able to resolve the dns entry and reach the server services.
For a remote host definition we have no problem to create a wildcard.domain.tld
this is the template fragment I used : /etc/e-smith/templates/etc/dnsmasq.conf/90WildCardDomain
#
# WildCard for hosts
#
{
use esmith::HostsDB;
use esmith::NetworksDB;
my $ndb = esmith::NetworksDB->open_ro() || die '# network DB is not available';
my $hdb = esmith::HostsDB->open_ro() || die '# hosts DB is not available';
my $LocalIP = $ndb->green()->prop('ipaddr') || die 'cannot retrieve the green IP';
foreach $host ($hdb->get_all_by_prop('type', 'remote')) {
my $IpAddress = $host->prop('IpAddress') || '';
my $wildcard = $host->prop('AllSubDomains') || '';
if ($wildcard ne 'enabled') {
next;
}
$OUT .= "\n# redirect all subdomains to :".$host->key;
$OUT .= "\naddress=/".$host->key."/".$IpAddress;
}
foreach $host ($hdb->get_all_by_prop('type', 'self')) {
my $wildcard = $host->prop('AllSubDomains') || '';
if ($wildcard ne 'enabled') {
next;
}
$OUT .= "\n# redirect all subdomains to :".$host->key;
$OUT .= "\naddress=/".$host->key."/$LocalIP\n";
}
}