Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide resolvconf(8)-compatible interface for systemd-resolved #7202

Closed
zx2c4 opened this issue Oct 28, 2017 · 15 comments

Comments

6 participants
@zx2c4
Copy link
Contributor

commented Oct 28, 2017

The standard way for various programs to manage DNS in an ad-hoc non-centralized way -- such as when separate programs are not centrally managed, like VPNs -- is resolvconf(8). The best implementation of resolvconf is openresolv, which provides numerous useful options such as -x for exclusive, -m for metric, Here's a man page for it. A resolvconf is available in all distributions, except the RPM ones, and it's in the BSDs too. It appears to be the "de facto" standard for ad-hoc programs contributing to the pool of nameserver knowledge that eventually results in a resolv.conf.

systemd-resolved has a dbus API, but no command line interface for accessing it (AFAIK). In the same way that systemd reimplemented shutdown, halt, and so forth, to retain the same well-known interface, but under the hood talk dbus to systemd's pid 1, I'd like to propose that systemd-resolved provides a "resolvconf" -- something with the same options as openresolv, but that translates these to systemd-resolved dbus commands.

This would lead to easy adoption of systemd-resolved, as well as conformity across distributions, whether they're using a Debian resolvconf, an openresolv resolvconf, or a systemd-resolved resolvconf. In Redhat-world, now that NetworkManager has a systemd-resolved plugin, it would also be a simple way for interacting with that too.

Is this idea interesting to the systemd-resolved developers?

@dkg

This comment has been minimized.

Copy link
Contributor

commented Oct 28, 2017

I like this idea, though i'm not sure that systemd would need to implement the full complement of the resolvconf interface. At any rate, a simple command-line interface that knows how to speak to systemd-resolved to perform the most common basic operations (adding a resolver, removing a resolver) would be useful.

@zx2c4

This comment has been minimized.

Copy link
Contributor Author

commented Oct 28, 2017

@yuwata

This comment has been minimized.

Copy link
Member

commented Oct 30, 2017

C.f. #7014.

@yuwata

This comment has been minimized.

Copy link
Member

commented Oct 30, 2017

Especially #7014 (comment).

@poettering

This comment has been minimized.

Copy link
Member

commented Dec 6, 2017

hmm, I think this would be OK to have actually, maybe as a multi-call overloading of the existing systemd-resolve tool.

@poettering

This comment has been minimized.

Copy link
Member

commented Dec 6, 2017

so what's precisely the minimal options we'd have to support? I figure only "resolvconf -a IFACE." matters really, the rest can be NOPs, including "resolvconf -d", as we notice on our own when interfaces go away...

@zx2c4

This comment has been minimized.

Copy link
Contributor Author

commented Dec 6, 2017

-m and -x are the biggies.

http://nxmnpg.lemoda.net/8/resolvconf

@poettering

This comment has been minimized.

Copy link
Member

commented Dec 6, 2017

"-m" doesn't really translate. Note sure I fully grok "-x", but it doesn't really translate either...

poettering added a commit to poettering/systemd that referenced this issue Dec 7, 2017

resolve: extend systemd-resolve so that it can push per-interface DNS…
… configuration into systemd-resolved

This is useful to debug things, but also to hook up external post-up
scripts with resolved.

Eventually this code might be useful to implement a
resolvconf(8)-compatible interface for compatibility purposes. Since the
semantics don't map entirely cleanly as first step we add a native
interface for pushing DNS configuration into resolved, that exposes the
correct semantics, before adding any compatibility interface.

See: systemd#7202
@poettering

This comment has been minimized.

Copy link
Member

commented Dec 7, 2017

as first step i prepped #7576 now. It doesn't add a compatible interface, but we can add that later building on this new code. Since the semantics don't map 1:1 i'd rather have a native interface first, exposing the right semantics, before we add compat kludges to provide debian/ubunti semantics too

@zx2c4

This comment has been minimized.

Copy link
Contributor Author

commented Dec 9, 2017

The -x means that the given name server becomes the exclusive one for the machine. This is important if people don't want DNS requests "leaking" through a different nameserver when bringing up VPN devices.

@tixxdz

This comment has been minimized.

Copy link
Member

commented Dec 9, 2017

@poettering FWIW I also think that we should support this.

poettering added a commit to poettering/systemd that referenced this issue Dec 11, 2017

resolve: extend systemd-resolve so that it can push per-interface DNS…
… configuration into systemd-resolved

This is useful to debug things, but also to hook up external post-up
scripts with resolved.

Eventually this code might be useful to implement a
resolvconf(8)-compatible interface for compatibility purposes. Since the
semantics don't map entirely cleanly as first step we add a native
interface for pushing DNS configuration into resolved, that exposes the
correct semantics, before adding any compatibility interface.

See: systemd#7202
@poettering

This comment has been minimized.

Copy link
Member

commented Dec 13, 2017

I figure "-x" could be translated to "add '.' to the list of routing domains for the interface". In resolved doing that means that DNS traffic for domains that aren't listed as search/routing domains otherwise is directed to that interface. It wouldn't have quite the same semantics, as a more specific domain-routing rule would still win, but in the big picture the difference shouldn't be too bad...

The "-m" metric stuff doesn't translate at all though: resolved doesn't priorize DNS configuration over each other, it doesn't have to, as it can route traffic to multiple servers on multiple interfaces simultaneously and take the first positive answer (or last negative one). To which interfaces traffic goes is purely decided on search/routing domains, which is a lot more fine-grained and expressive than priority based systems. Most likely we should just ignor the value.

@zx2c4

This comment has been minimized.

Copy link
Contributor Author

commented Dec 13, 2017

Most likely we should just ignor the value.

Perhaps ignore and spit a warning? Or ignore silently like debian's resolvconf does. Your call.

poettering added a commit to poettering/systemd that referenced this issue Dec 13, 2017

resolve: extend systemd-resolve so that it can push per-interface DNS…
… configuration into systemd-resolved

This is useful to debug things, but also to hook up external post-up
scripts with resolved.

Eventually this code might be useful to implement a
resolvconf(8)-compatible interface for compatibility purposes. Since the
semantics don't map entirely cleanly as first step we add a native
interface for pushing DNS configuration into resolved, that exposes the
correct semantics, before adding any compatibility interface.

See: systemd#7202

poettering added a commit to poettering/systemd that referenced this issue Dec 14, 2017

resolve: extend systemd-resolve so that it can push per-interface DNS…
… configuration into systemd-resolved

This is useful to debug things, but also to hook up external post-up
scripts with resolved.

Eventually this code might be useful to implement a
resolvconf(8)-compatible interface for compatibility purposes. Since the
semantics don't map entirely cleanly as first step we add a native
interface for pushing DNS configuration into resolved, that exposes the
correct semantics, before adding any compatibility interface.

See: systemd#7202

poettering added a commit to poettering/systemd that referenced this issue Dec 14, 2017

resolve: extend systemd-resolve so that it can push per-interface DNS…
… configuration into systemd-resolved

This is useful to debug things, but also to hook up external post-up
scripts with resolved.

Eventually this code might be useful to implement a
resolvconf(8)-compatible interface for compatibility purposes. Since the
semantics don't map entirely cleanly as first step we add a native
interface for pushing DNS configuration into resolved, that exposes the
correct semantics, before adding any compatibility interface.

See: systemd#7202

poettering added a commit that referenced this issue Dec 14, 2017

resolve: extend systemd-resolve so that it can push per-interface DNS…
… configuration into systemd-resolved (#7576)

This is useful to debug things, but also to hook up external post-up
scripts with resolved.

Eventually this code might be useful to implement a
resolvconf(8)-compatible interface for compatibility purposes. Since the
semantics don't map entirely cleanly as first step we add a native
interface for pushing DNS configuration into resolved, that exposes the
correct semantics, before adding any compatibility interface.

See: #7202
@bl33pbl0p

This comment has been minimized.

Copy link
Contributor

commented Feb 3, 2018

+1 for this.

poettering added a commit to poettering/systemd that referenced this issue Feb 27, 2018

resolve-tool: provide resolvconf(8) compatibility
This turns resolve-tool into a multi-call binary. When invoked as
"resolvconf" it provides minimal compatibility with the resolvconf(8)
tool of various distributions (and FreeBSD as it appears).

This new interface understands to varying degrees features of the two
major implementations of resolvconf(8): Debian's original one and
"openresolv". Specifically:

Fully supported:

        -a -d (supported by all implementations)
        -f    (introduced by openresolv)

Somewhat supported:

        -x    (introduced by openresolv, mapped to a '~.' domain entry)

Unsupported and ignored:

        -m -p (introduced by openresolv, not really necessary for us)

Unsupported and resulting in failure:
        -u    (supported by all other implementations)
        -I -i -l -R -r -v -V
              (all introduced by openresolv)
        --enable-updates --disable-updates --updates-are-enabled
              (specific to Debian's implementation)

Of course, resolvconf(8) is a tool with multiple backends, in our
implementation systemd-resolved is the only backend.

Fixes: systemd#7202
@poettering

This comment has been minimized.

Copy link
Member

commented Feb 28, 2018

A PR implementing this is waiting in #8296

poettering added a commit to poettering/systemd that referenced this issue Feb 28, 2018

resolve-tool: provide resolvconf(8) compatibility
This turns resolve-tool into a multi-call binary. When invoked as
"resolvconf" it provides minimal compatibility with the resolvconf(8)
tool of various distributions (and FreeBSD as it appears).

This new interface understands to varying degrees features of the two
major implementations of resolvconf(8): Debian's original one and
"openresolv". Specifically:

Fully supported:

        -a -d (supported by all implementations)
        -f    (introduced by openresolv)

Somewhat supported:

        -x    (introduced by openresolv, mapped to a '~.' domain entry)

Unsupported and ignored:

        -m -p (introduced by openresolv, not really necessary for us)

Unsupported and resulting in failure:
        -u    (supported by all other implementations)
        -I -i -l -R -r -v -V
              (all introduced by openresolv)
        --enable-updates --disable-updates --updates-are-enabled
              (specific to Debian's implementation)

Of course, resolvconf(8) is a tool with multiple backends, in our
implementation systemd-resolved is the only backend.

Fixes: systemd#7202

poettering added a commit to poettering/systemd that referenced this issue Feb 28, 2018

resolve-tool: provide resolvconf(8) compatibility
This turns resolve-tool into a multi-call binary. When invoked as
"resolvconf" it provides minimal compatibility with the resolvconf(8)
tool of various distributions (and FreeBSD as it appears).

This new interface understands to varying degrees features of the two
major implementations of resolvconf(8): Debian's original one and
"openresolv". Specifically:

Fully supported:

        -a -d (supported by all implementations)
        -f    (introduced by openresolv)

Somewhat supported:

        -x    (introduced by openresolv, mapped to a '~.' domain entry)

Unsupported and ignored:

        -m -p (introduced by openresolv, not really necessary for us)

Unsupported and resulting in failure:
        -u    (supported by all other implementations)
        -I -i -l -R -r -v -V
              (all introduced by openresolv)
        --enable-updates --disable-updates --updates-are-enabled
              (specific to Debian's implementation)

Of course, resolvconf(8) is a tool with multiple backends, in our
implementation systemd-resolved is the only backend.

Fixes: systemd#7202

poettering added a commit to poettering/systemd that referenced this issue Mar 2, 2018

resolve-tool: provide resolvconf(8) compatibility
This turns resolve-tool into a multi-call binary. When invoked as
"resolvconf" it provides minimal compatibility with the resolvconf(8)
tool of various distributions (and FreeBSD as it appears).

This new interface understands to varying degrees features of the two
major implementations of resolvconf(8): Debian's original one and
"openresolv". Specifically:

Fully supported:

        -a -d (supported by all implementations)
        -f    (introduced by openresolv)

Somewhat supported:

        -x    (introduced by openresolv, mapped to a '~.' domain entry)

Unsupported and ignored:

        -m -p (introduced by openresolv, not really necessary for us)

Unsupported and resulting in failure:
        -u    (supported by all other implementations)
        -I -i -l -R -r -v -V
              (all introduced by openresolv)
        --enable-updates --disable-updates --updates-are-enabled
              (specific to Debian's implementation)

Of course, resolvconf(8) is a tool with multiple backends, in our
implementation systemd-resolved is the only backend.

Fixes: systemd#7202
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.