Welcome! Log In Create A New Profile

Advanced

resolvers default nameservers ?

Posted by Jim Freeman 
Jim Freeman
resolvers default nameservers ?
April 14, 2017 05:10PM
The "resolvers" section doc discusses default values for all its
paramaters except "nameservers".

If I have a on-line "resolvers" eg;

"resolvers default"

with no parameters listed, are the system (or context eg; chroot)
/etc/resolv.conf nameservers used? [ this would be a boon to cfg
automation ]

Thanks,
....jfree
Aleksandar Lazic
Re: resolvers default nameservers ?
April 15, 2017 12:10AM
Hi,

Am 14-04-2017 16:58, schrieb Jim Freeman:
> The "resolvers" section doc discusses default values for all its
> paramaters except "nameservers".
>
> If I have a on-line "resolvers" eg;
>
> "resolvers default"
>
> with no parameters listed, are the system (or context eg; chroot)
> /etc/resolv.conf nameservers used? [ this would be a boon to cfg
> automation ]

As I have understand the doc the /etc/resolv.conf will be used by
default.

http://cbonte.github.io/haproxy-dconv/1.7/configuration.html#5.3.1

When you add a resolver then the config in this section will be used.

I think that the "resolvers default" is not yet implemented as I have
seen in the code.

http://git.haproxy.org/?p=haproxy-1.7.git;a=blob;f=src/cfgparse.c;hb=239d8e69019c0046b383c5a05c935c74b4e0e9c6#l2288

> Thanks,
> ...jfree

Regards
aleks
Baptiste
Re: resolvers default nameservers ?
April 18, 2017 09:10AM
On Fri, Apr 14, 2017 at 4:58 PM, Jim Freeman <[email protected]> wrote:

> The "resolvers" section doc discusses default values for all its
> paramaters except "nameservers".
>
> If I have a on-line "resolvers" eg;
>
> "resolvers default"
>
> with no parameters listed, are the system (or context eg; chroot)
> /etc/resolv.conf nameservers used? [ this would be a boon to cfg
> automation ]
>
> Thanks,
> ...jfree
>

Hi Jim,

Name resolution performed at runtime is not the same as the one performed
when parsing the configuration file.
At runtime, HAProxy uses the IP addresses provided by the nameserver
directives. At configuration parsing time, HAProxy uses the libc, hence
resolv.conf.
The runtime resolver don't read the resolv.conf file. As a workaround, your
init script may be able to update the cfg file quite easily.

This gave me an idea, since you speak about automation :)
We could improve the "resolvers" section parser with a couple of new
features:
- parsing a 'resolv.conf' file style (you provide a path to the file) to
read the nameserver directives only (for now)
- using environment variables

Baptiste
Jim Freeman
Re: resolvers default nameservers ?
April 18, 2017 03:00PM
Bingo - that's exactly what I'd hope for. The default default could
be /etc/resolv.conf's nameservers (or eg; chroot context's
equivalent),

I grok that the runtime is different than parsetime, which makes
parsetime the right time to get at the system's info as default.
Dunno if there are any system/resolver calls that could be exploited
that report the default nameservers (looked a bit, didn't find) to
save parsing or possible resolvconf/... complexities - what the system
"knows" (and will tell) is handiest.

My preference is to use the stock init file, and have other machinery
for auto- tweaking/configuring, so sensible inherent default cfg
mechanisms rock.

World class system software - thanks, and thanks, and thanks again !

On Tue, Apr 18, 2017 at 1:03 AM, Baptiste <[email protected]> wrote:
>
>
> On Fri, Apr 14, 2017 at 4:58 PM, Jim Freeman <[email protected]> wrote:
>>
>> The "resolvers" section doc discusses default values for all its
>> paramaters except "nameservers".
>>
>> If I have a on-line "resolvers" eg;
>>
>> "resolvers default"
>>
>> with no parameters listed, are the system (or context eg; chroot)
>> /etc/resolv.conf nameservers used? [ this would be a boon to cfg
>> automation ]
>>
>> Thanks,
>> ...jfree
>
>
> Hi Jim,
>
> Name resolution performed at runtime is not the same as the one performed
> when parsing the configuration file.
> At runtime, HAProxy uses the IP addresses provided by the nameserver
> directives. At configuration parsing time, HAProxy uses the libc, hence
> resolv.conf.
> The runtime resolver don't read the resolv.conf file. As a workaround, your
> init script may be able to update the cfg file quite easily.
>
> This gave me an idea, since you speak about automation :)
> We could improve the "resolvers" section parser with a couple of new
> features:
> - parsing a 'resolv.conf' file style (you provide a path to the file) to
> read the nameserver directives only (for now)
> - using environment variables
>
> Baptiste
Sorry, only registered users may post in this forum.

Click here to login