#31 Enable nss-resolve
Closed 3 years ago by zbyszek. Opened 3 years ago by zbyszek.
rpms/ zbyszek/systemd resolved-enable  into  master

@@ -1,30 +0,0 @@ 

- From 0c670fec00f3d5c103d9b7415d4e0510c61ad006 Mon Sep 17 00:00:00 2001

- From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>

- Date: Fri, 11 Mar 2016 17:06:17 -0500

- Subject: [PATCH] resolved: create /etc/resolv.conf symlink at runtime

- 

- If the symlink exists, do nothing. In particular, if it is a broken symlink,

- we cannot really know if the administator configured it to point to

- a location used by some service that hasn't started yet, so we

- don't touch it in that case either.

- 

- https://bugzilla.redhat.com/show_bug.cgi?id=1313085

- ---

-  src/resolve/resolved.c | 4 ++++

-  tmpfiles.d/etc.conf.m4 | 3 ---

-  2 files changed, 4 insertions(+), 3 deletions(-)

- 

- diff --git a/tmpfiles.d/etc.conf.m4 b/tmpfiles.d/etc.conf.m4

- index f82e0b82ce..66a777bdb2 100644

- --- a/tmpfiles.d/etc.conf.m4

- +++ b/tmpfiles.d/etc.conf.m4

- @@ -12,9 +12,6 @@ L+ /etc/mtab - - - - ../proc/self/mounts

-  m4_ifdef(`HAVE_SMACK_RUN_LABEL',

-  t /etc/mtab - - - - security.SMACK64=_

-  )m4_dnl

- -m4_ifdef(`ENABLE_RESOLVE',

- -L! /etc/resolv.conf - - - - ../run/systemd/resolve/stub-resolv.conf

- -)m4_dnl

-  C! /etc/nsswitch.conf - - - -

-  m4_ifdef(`HAVE_PAM',

-  C! /etc/pam.d - - - -

file modified
+16 -12
@@ -20,7 +20,7 @@ 

  Name:           systemd

  Url:            https://www.freedesktop.org/wiki/Software/systemd

  Version:        246~rc1

- Release:        1%{?dist}

+ Release:        2%{?dist}

  # For a breakdown of the licensing, see README

  License:        LGPLv2+ and MIT and GPLv2+

  Summary:        System and Service Manager
@@ -70,8 +70,6 @@ 

  # https://bugzilla.redhat.com/show_bug.cgi?id=1738828

  Patch0001:      use-bfq-scheduler.patch

  

- Patch0998:      0998-resolved-create-etc-resolv.conf-symlink-at-runtime.patch

- 

  %ifarch %{ix86} x86_64 aarch64

  %global have_gnu_efi 1

  %endif
@@ -379,6 +377,9 @@ 

          -Dman=true

          -Dversion-tag=v%{version}-%{release}

          -Dfallback-hostname=fedora

+         -Ddefault-dnssec=no

+         -Ddefault-mdns=resolve

+         -Ddefault-llmnr=resolve

  )

  

  %meson "${CONFIGURE_OPTS[@]}"
@@ -623,18 +624,16 @@ 

  

  function mod_nss() {

      if [ -f "$1" ] ; then

-         # sed-fu to add myhostname to hosts line

-         grep -E -q '^hosts:.* myhostname' "$1" ||

-         sed -i.bak -e '

-                 /^hosts:/ !b

-                 /\<myhostname\>/ b

-                 s/[[:blank:]]*$/ myhostname/

-                 ' "$1" &>/dev/null || :

- 

          # Add nss-systemd to passwd and group

          grep -E -q '^(passwd|group):.* systemd' "$1" ||

          sed -i.bak -r -e '

-                 s/^(passwd|group):(.*)/\1: \2 systemd/

+                 s/^(passwd|group):(.*)/\1:\2 systemd/

+                 ' "$1" &>/dev/null || :

+ 

+         # Add nss-resolve to hosts

+         grep -E -q '^hosts:.* resolve' "$1" ||

+         sed -i.bak -r -e '

+                 s/^(hosts):(.*) files( mdns4_minimal .NOTFOUND=return.)? dns myhostname/\1:\2 resolve [!UNAVAIL=return] myhostname files\3 dns/

                  ' "$1" &>/dev/null || :

      fi

  }
@@ -773,6 +772,11 @@ 

  %files tests -f .file-list-tests

  

  %changelog

+ * Sun Jul 12 2020 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 246~rc1-2

+ - Enable systemd-resolved (with DNSSEC disabled by default, and LLMNR

+   and mDNS support in resolve-only mode by default).

+   See https://fedoraproject.org/wiki/Changes/systemd-resolved.

+ 

  * Thu Jul  9 2020 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 246~rc1-1

  - New upstream release, see

    https://raw.githubusercontent.com/systemd/systemd/v246-rc1/NEWS.

I don't pretend to understand sed or regexes, but with my fresh install of Workstation my hosts line looks like:

hosts: files mdns4_minimal [NOTFOUND=return] dns myhostname

It's not expecting "files dns myhostname" to be in literally that order, is it?

I didn't take the nss-mdns scriptlet into account.

4 new commits added

  • Update defaults to dnssec=no, mdns,llmnr=resolve
  • Add scriptlet to enable nss-resolve
  • Drop patch to avoid creation of /etc/resolv.conf symlink
  • Drop scriptlet for nss-myhostname
3 years ago

So you're intentionally removing nss-mdns because systemd-resrolved will handle that instead, right?

So you're intentionally removing nss-mdns because systemd-resrolved will handle that instead, right?

Hmm, no. I'm just moving it to the end. We still want both mdns and dns to be there to serve as a fallback path in case resolve is not functional.

This is what I was testing:

$ echo 'hosts: mymachines files mdns4_minimal [NOTFOUND=return] dns myhostname' | sed -r -e '
                s/^(hosts):(.*) files( mdns4_minimal .NOTFOUND=return.)? dns myhostname/\1:\2 resolve [!UNAVAIL=return] myhostname files\3 dns/
                ' -
hosts: mymachines resolve [!UNAVAIL=return] myhostname files mdns4_minimal [NOTFOUND=return] dns

4 new commits added

  • Add scriptlet to enable nss-resolve
  • Update defaults to dnssec=no, mdns,llmnr=resolve
  • Drop patch to avoid creation of /etc/resolv.conf symlink
  • Drop scriptlet for nss-myhostname
3 years ago

The build fails on some arches in unit tests, but this doesn't seem to be caused by changes in this PR. But it might be related to btrfs, if that already went in.

This was merged (in a slightly different form) to master/f33 a while ago.

Pull-Request has been closed by zbyszek

3 years ago