Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 134254 - resolvconf and automatical pdnsd interaction
Summary: resolvconf and automatical pdnsd interaction
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High enhancement
Assignee: Gentoo Dialup Developers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-24 12:30 UTC by Oldrich Jedlicka
Modified: 2006-06-25 11:55 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
PDNSD interaction from resolvconf configurator (pdnsd,1.01 KB, text/plain)
2006-05-24 12:32 UTC, Oldrich Jedlicka
Details
pdnsd interaction with resolvconf (pdnsd,1.98 KB, text/plain)
2006-05-25 09:23 UTC, Oldrich Jedlicka
Details
pdnsd interaction with resolvconf (pdnsd,12.54 KB, text/plain)
2006-05-26 05:50 UTC, Oldrich Jedlicka
Details
pdnsd interaction with resolvconf (pdnsd,13.22 KB, text/plain)
2006-05-26 07:38 UTC, Oldrich Jedlicka
Details
pdnsd interaction with resolvconf (pdnsd,12.78 KB, text/plain)
2006-06-06 11:36 UTC, Oldrich Jedlicka
Details
pdnsd interaction with resolvconf (pdnsd,12.91 KB, text/plain)
2006-06-08 11:50 UTC, Oldrich Jedlicka
Details
pdnsd interaction with resolvconf, version 2006-06-25 (pdnsd,16.96 KB, text/plain)
2006-06-25 06:55 UTC, Oldrich Jedlicka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Oldrich Jedlicka 2006-05-24 12:30:44 UTC
I have created a file that interacts from /etc/resolvconf/update.d with pdnsd. It reads nameservers as it is done with the libc script, filters out 127.* and the rest is sent to pdnsd with pdnsd-ctl.
Comment 1 Oldrich Jedlicka 2006-05-24 12:32:42 UTC
Created attachment 87432 [details]
PDNSD interaction from resolvconf configurator

Should be placed under /etc/resolvconf/update.d/ directory.
Comment 2 Oldrich Jedlicka 2006-05-25 00:49:56 UTC
I think that the script /etc/init.d/pdnsd also needs an update, because it could happen that the network card had been configured, when the pdnsd started. So my proposal is to add

  ...
  eend $?
  if [[ $? == 0 && -x /sbin/resolvconf ]] ; then
    eindent
    ebegin "Updating resolvconf database"
    /sbin/resolvconf -u
    eend $?
    eoutdent
  fi

into start() function of /etc/init.d/pdnsd. That works fine for me.

There is no need to make network card initialization scripts dependent on resolvconf or pdnsd.
Comment 3 Roy Marples (RETIRED) gentoo-dev 2006-05-25 01:30:31 UTC
No, the idea is the resolvconf stuff is separate from the main init scripts.

I have scripts for dnsmasq and bind written by myself and one for djbdns written by a fellow dev (kiaowas) here - http://dev.gentoo.org/~uberlord/resolvconf-gentoo

Any script for pdns should try and emulate those. They are a bit more involved than libc as they provide nameservers for specific domains so that openvpn gets full DNS on both public and private networks which is something that libc cannot provide.
Comment 4 Oldrich Jedlicka 2006-05-25 02:08:50 UTC
(In reply to comment #3)
> No, the idea is the resolvconf stuff is separate from the main init scripts.

Sorry, I do not understand. How do you want to make automatical pdnsd configuration, if the configuration cannot be activated after the pdnsd is loaded? I copied the idea from Debian's /etc/init.d/pdnsd (comment #2) and /etc/resolvconf/update.d/pdnsd (comment #1). What is wrong?

If the network card is configured first (it boot runlevel), then the pdnsd is started (in default runlevel), there will be no configuration in pdnsd. I have to call "resolvconf -u" manually to update it (from pdnsd init script for example - see the Debian's way to do it). If I now start wifi or ppp0 interface, it will automatically update the configuration with "resolvconf -a" (from /etc/resolvconf/update.d/pdnsd). Where is the problem?

I downloaded mentioned scripts and I will have a look at them later today (hopefully).
Comment 5 Roy Marples (RETIRED) gentoo-dev 2006-05-25 02:18:44 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > No, the idea is the resolvconf stuff is separate from the main init scripts.
> 
> Sorry, I do not understand. How do you want to make automatical pdnsd
> configuration, if the configuration cannot be activated after the pdnsd is
> loaded? I copied the idea from Debian's /etc/init.d/pdnsd (comment #2) and
> /etc/resolvconf/update.d/pdnsd (comment #1). What is wrong?

Well, we don't use Debians init scripts and the referenced examples restart the dns resolver only if required. So the Gentoo init scripts for the dns resolvers should not need any modification.

> 
> If the network card is configured first (it boot runlevel), then the pdnsd is
> started (in default runlevel), there will be no configuration in pdnsd. I have
> to call "resolvconf -u" manually to update it (from pdnsd init script for
> example - see the Debian's way to do it). If I now start wifi or ppp0
> interface, it will automatically update the configuration with "resolvconf -a"
> (from /etc/resolvconf/update.d/pdnsd). Where is the problem?

Our resolvconf only shares the same design as Debians - the underlying code is vastly different for starters. Our design makes writing helper scripts much easier for starters :)

However, it is the job of resolvconf to update and restart the dns resolvers when dns information has changed, thus there is no need for the dns resolver init script to be resovconf aware. If it needs to be then the error is elsewhere.

Let's just say that using the dnsmasq and bind scripts my network cards are configured in the boot runlevel by udev/coldplug and dnsmasq is started in the default runlevel. Everything works as advertised without the need for the dnsmasq init script to be aware of resovlconf. This works as we save all needed information to files that the user needs to include in their config - you will probably need todo this as well.
Comment 6 Oldrich Jedlicka 2006-05-25 09:23:34 UTC
Created attachment 87496 [details]
pdnsd interaction with resolvconf

Description of how to activate the pdnsd is written in detail in the file. Now there is no need to change the /etc/init.d/pdnsd :-)
Comment 7 Oldrich Jedlicka 2006-05-25 09:26:54 UTC
(In reply to comment #5)
> Our resolvconf only shares the same design as Debians - the underlying code is
> vastly different for starters. Our design makes writing helper scripts much
> easier for starters :)

It was really easy to do so, I looked at dnsmasq and it was done in a few minutes :)

> However, it is the job of resolvconf to update and restart the dns resolvers
> when dns information has changed, thus there is no need for the dns resolver
> init script to be resovconf aware. If it needs to be then the error is
> elsewhere.

Now it works as wanted - no need to edit init scripts. The pdnsd is able to reload configuration files, so I use this oportunity to do so.
Comment 8 Roy Marples (RETIRED) gentoo-dev 2006-05-25 09:32:04 UTC
OK, looking better now :)

Last thing todo is to implement the split of domain and search options to make vpn users happy. Again, see the referenced dnsmasq and bind files for how this is done.
Comment 9 Oldrich Jedlicka 2006-05-25 10:04:39 UTC
(In reply to comment #8)
> Last thing todo is to implement the split of domain and search options to make
> vpn users happy. Again, see the referenced dnsmasq and bind files for how this
> is done.

Thanks for a hint. I think I understand it. The problem is to ask the correct server for the particular domain/search. I will test it also, because I have both ppp0 and openvpn running. I will think about this issue the whole night and morning :-) There will be maybe some "sed" magic that will operate on a standard configuration file.
Comment 10 Oldrich Jedlicka 2006-05-25 10:54:28 UTC
It has to be written as a bash script, or perl/python can be used?
Comment 11 Roy Marples (RETIRED) gentoo-dev 2006-05-25 11:08:51 UTC
(In reply to comment #10)
> It has to be written as a bash script, or perl/python can be used?

Any language can be used really. However, bash would be preferable for scripts in /etc.
Comment 12 Oldrich Jedlicka 2006-05-26 05:50:49 UTC
Created attachment 87552 [details]
pdnsd interaction with resolvconf

As promissed, here is the little-bit-hard-core(TM) bash/sed script to edit the configuration. Each unique NEWDOMAIN part is created as a separate server section. Other settings - NEWSEARCH and NEWNS - are combined together and put into one server section.

User can customize the created sections, only few options are always recreated (so changes to them will be lost). Details are in the attached file.

The description of a sed script is also included in the file.

Enjoy :-)
Comment 13 Roy Marples (RETIRED) gentoo-dev 2006-05-26 06:29:46 UTC
That's incredibly hardcore - much more complex than my scripts, but heh, if it works. Looks like it has the required features though :)

net-dialup - your baby now (according to the meta data)
Comment 14 Oldrich Jedlicka 2006-05-26 06:50:44 UTC
I'm now adding some sanity checks for some rare situations (mistakes in configuration files) - like missing closing brackets. I will post the result later today.

Then it needs to be tested in the real world, because I would miss something :-)
Comment 15 Oldrich Jedlicka 2006-05-26 07:38:02 UTC
Created attachment 87560 [details]
pdnsd interaction with resolvconf

Now I'm happy with the script. Sanity checks should ensure that the file will not get corrupted. The backup suffix is now ".backup" and not the ugly ".old".

It is complex, because everything has to be in one file and it would be good for the user to be able to customize new server sections - like timeouts and caching.
Comment 16 Alin Năstac (RETIRED) gentoo-dev 2006-06-06 10:54:43 UTC
@Oldrich : Can you get rid of all that debug stuff? Also, "Implementation notes" ends unexpectedly.

@Roy : I'm puzzled about net-dialup's job in this bug. What exactly do you want me to do? Install this script in /etc/resolvconf/update.d? I don't see dnsmasq doing it. 
Also, don't you think resolvconf-gentoo should be moved in net-dns category? According to metadata.xml, "net-dns category contains DNS (Domain Name Service) related software".
Comment 17 Oldrich Jedlicka 2006-06-06 11:36:01 UTC
Created attachment 88552 [details]
pdnsd interaction with resolvconf

(In reply to comment #16)
> @Oldrich : Can you get rid of all that debug stuff? Also, "Implementation
> notes" ends unexpectedly.

Done. DEBUG is gone. The implementation notes are fixed (originally it was copied from bind/dnsmasq scripts and I missed one line - how this could happen?).
Comment 18 Roy Marples (RETIRED) gentoo-dev 2006-06-06 14:00:27 UTC
(In reply to comment #16)
> @Roy : I'm puzzled about net-dialup's job in this bug. What exactly do you want
> me to do? Install this script in /etc/resolvconf/update.d? I don't see dnsmasq
> doing it.

They will be doing it - the maintainers of dnsmasq and bind have said they would include similar scripts for them soon.

> Also, don't you think resolvconf-gentoo should be moved in net-dns category?
> According to metadata.xml, "net-dns category contains DNS (Domain Name Service)
> related software".

Possibly :)
Comment 19 Oldrich Jedlicka 2006-06-08 11:50:55 UTC
Created attachment 88705 [details]
pdnsd interaction with resolvconf

Update with fixed policy for VPN users. The line "policy=excluded" is added every time now, without it the pdnsd ignores "include=" statement (so it searched all addresses).
Comment 20 Alin Năstac (RETIRED) gentoo-dev 2006-06-11 04:29:41 UTC
fixed in pdnsd-1.2.4-r2.

too bad I cannot use this for my IPSec VPN connection :( 
btw, I had to exclude my VPN domains manually, since otherwise the resolvconf entry was also used for these domains:
server {
        label="resolvconf";
        preset=on;
        ip="a.b.c.d";
        exclude=".tsr",".tss",".tus",".tde";
        exclude=".168.192.in-addr.arpa";
}

thanks for your contribution!
Comment 21 Oldrich Jedlicka 2006-06-11 05:08:21 UTC
(In reply to comment #20)
> fixed in pdnsd-1.2.4-r2.
> 
> too bad I cannot use this for my IPSec VPN connection :( 

Everything can be fixed and I would like to improve the script, I just need some information, but currently I do not know, where is the best place to discuss all resolvconf+pdnsd stuff - forums.gentoo.org (Networking&Security), or somewhere else?

> btw, I had to exclude my VPN domains manually, since otherwise the resolvconf
> entry was also used for these domains:
> server {
>         label="resolvconf";
>         preset=on;
>         ip="a.b.c.d";
>         exclude=".tsr",".tss",".tus",".tde";
>         exclude=".168.192.in-addr.arpa";
> }

I was thinking about this (exclude= in "resolvconf" server), also about keeping the configuration and changing only preset=off/on for "resolvconf-<domain>" servers.

Thanks for your feedback, I would like to move the discussion to a better place (with possibly more people). Where?
Comment 22 Alin Năstac (RETIRED) gentoo-dev 2006-06-11 05:24:37 UTC
(In reply to comment #21)
> > too bad I cannot use this for my IPSec VPN connection :( 
> 
> Everything can be fixed and I would like to improve the script, I just need
> some information, but currently I do not know, where is the best place to
> discuss all resolvconf+pdnsd stuff - forums.gentoo.org (Networking&Security),
> or somewhere else?

nah... You could set a {left,right}updown script in /etc/ipsec/ipsec.conf, but if you set it, it is the script's job to set/reset the routes. Beside, openswan don't know anything about internal DNS domains/servers.

> Thanks for your feedback, I would like to move the discussion to a better place
> (with possibly more people). Where?

If you have more resolvconf related ideas, you should talk with Roy about them. 
Comment 23 Roy Marples (RETIRED) gentoo-dev 2006-06-12 03:54:03 UTC
(In reply to comment #16)
> Also, don't you think resolvconf-gentoo should be moved in net-dns category?

Moved :)
Comment 24 Oldrich Jedlicka 2006-06-12 07:43:46 UTC
(In reply to comment #22)
> nah... You could set a {left,right}updown script in /etc/ipsec/ipsec.conf, but
> if you set it, it is the script's job to set/reset the routes. Beside, openswan
> don't know anything about internal DNS domains/servers.

From the documentation (I do not have ipsec/openswan) you can execute /lib/ipsec/*updown manually from your *updown script. Then you can

* think about a server configuration in pdnsd and starting it with "pdnsd-ctl server <name> up" and shutting-down it with "pdnsd-ctl server <name> down, or
* you can use "resolvconf -a <interface>" and "resolvconf -d <interface>" from your *updown scripts to simulate DNS updates. Maybe the DNS configuration can be somewhere in /etc/conf.d/net.ipsec*? Just one stupid idea :-)
Comment 25 Oldrich Jedlicka 2006-06-12 08:20:20 UTC
(In reply to comment #22)
> If you have more resolvconf related ideas, you should talk with Roy about them. 

No, I do not have more ideas about resolvconf, but I would like to discuss pdnsd interaction - generation of config files. There is already the thing with exclude= in server "resolvconf" - it can be generated automatically, but it would be better to probably keep some user modifications. I will think about it and provide an update.

BTW: Where to send updates? Reopen this bug, or create new one, or...?
Comment 26 Alin Năstac (RETIRED) gentoo-dev 2006-06-12 08:29:06 UTC
Since openswan don't know anything about DNS configurations, I think we shouldn't stress ourselves with adding resolvconf functionality. I already solved it by adding a different server in pdnsd.conf and filtering my internal domain from the "resolvconf" server through exclude parameters.

If you have updates to pdnsd resolvconf update script, you could reopen this bug, but please make it final. I don't want to hassle gentoo users with endless updates. Better to experiment with it several weeks, until you are happy with the result.
Comment 27 Oldrich Jedlicka 2006-06-12 08:49:40 UTC
(In reply to comment #26)
> Better to experiment with it several weeks, until you are happy with
> the result.

The last thing I have in mind is this "exclude=" and then I would be happy. I can experiment several months, but what is good to me, need not be good for you (for example I didn't miss "exclude=" in my configuration file, but it is logical to have it there).

Anyway, if anybody has any feedback/ideas for changing pdnsd configuration by my script in some nice way, my e-mail is opened to everybody.
Comment 28 Oldrich Jedlicka 2006-06-25 06:49:42 UTC
Finally I made a time for exclude directive in pdnsd. It automatically handles it's servers (those in format .<domain> or .<domain>., with and without double-quotes). Other things behaves the same.
Comment 29 Oldrich Jedlicka 2006-06-25 06:55:38 UTC
Created attachment 90109 [details]
pdnsd interaction with resolvconf, version 2006-06-25

Enjoy :-)

Please test, if it works as expected also for you.
Comment 30 Alin Năstac (RETIRED) gentoo-dev 2006-06-25 11:55:51 UTC
fixed in -r3. thanks!