[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Aliased names.
From: |
GERMA Denis |
Subject: |
Re: Aliased names. |
Date: |
Tue, 17 Apr 2001 17:47:05 +0200 |
Hi,
You seem to be using gethostbyname in Version 1.6.3 to try to get the aliases
in the GetNameInfo
function
which declare the classes for hostname, system, .....
I tested the gethostbyname (on Linux), and I confirme that the h_aliases only
contains Info
when you call the gethostbyname with an aliased name. (The one we are looking
for).
h_named then contains the canonical name and h_aliases contains the alias
fully qualified name.
The solutions to add the aliased names in class, seems to be either call the
gethostbyname (and
or a cache)
each time there is a miss in the class search (Ronan KERYELL proposal),
or try to list the domain.
The solution may then be (I did not yet traducted in C.) :
echo 'lserver autoritative_dns_server
ls -a domain_name' | nslookup | grep hostname
This in fact produce the CNAME table.
and then grep the hostname in it.
Draw backs are then :
It does not seems to work on non autoritative dns server (Not a general
method). (Consider
Ronan KERYELL explanation)
It implicitely list all machines (network traffic)
It may be difficult to get the name for the autoritative DNS server in a
complex DNS
hierarchie.
The autoritative DNS server may forbid listing the domain.
For the Ronan KERYELL proposal, draw backs may be :
It does not fit with the actual architecture.
A DNS query is issued each time a miss is issued and has not allready been
seen.
A cache containing "class miss" may have to be maintained and is memory
consuming.
Thanks for all.
D.Germa
Ronan KERYELL a écrit :
> >>>>> On Thu, 12 Apr 2001 16:33:35 +0200 (MET DST), address@hidden said:
>
> >> It sounds to me that what we are interested in is a map "name or
> >> IP -> aliases" but the DNS CNAME tables are "aliases -> name" map.
> >>
> >> The only way I can figure out is to test the DNS for every new
> >> cfengine class is met to see if we can find out one of our IP
> >> adresses again.
> >>
> >> That would also solve the multiple name -> same IP case by the
> >> way...
> >>
>
> Mark> It is supposedly possible to extract all names and aliases for
> Mark> an IP address from the C structures, but when I tried it did not
> Mark> work as expected.
>
> Sure, if they are in the C structures...
>
> I've not been clear enough :
>
> DNS CNAME, A or MX RR represent a mathematical function "name -> real name
> or IP"
>
> DNS PTR represent a mathematical function "IP -> name"
>
> It is what you get in the C structures, but *for a given* left element.
>
> But when cfengine is lauched, as for any command, you know the IP adresses of
> the machine and
> also the hostname or nodename. Unfortunately you cannot know all the names
> that would target the same IPs because you cannot invert the DNS CNAME or
> A function and because the DNS PTR database give you only the main
> name... :-(
>
> So, what I propose is a lazy solution with a cache system : every time you
> encounter a new class, just do a DNS CNAME + A with recursion enabled to
> test whether it is an other name for the machine. If yes, put the class as
> true in the cache. Well, I guess that during the cfengine run the DNS
> table will not change... :-)
>
> It is the reason of the sendmail.cw file for example that states all the
> names the names sendmail is responsible for because she cannot figure it
> out...
>
> --
> Ronan KERYELL |\/
> Labo Informatique Télécom |/) Tel: (+33|0) 2.29.00.14.15
> ENST Bretagne, BP832 K Fax: (+33|0) 2.29.00.12.82
> 29285 BREST CEDEX |\ E-mail: address@hidden
> FRANCE | \ http://www-info.enst-bretagne.fr/~keryell