kdump/kdump-nss-modules.patch
Petr Tesařík 8c4cc920f8 Accepting request 757490 from home:ptesarik:branches:Kernel:kdump
- kdump-calibrate-Update-values.patch: calibrate: Update values.
- kdump-prefer-by-path-and-device-mapper.patch: Prefer by-path and
  device-mapper aliases over kernel device names (bsc#1101149,
  LTC#168532).
- kdump-powerpc-no-reload-on-CPU-removal.patch: powerpc: Do not
  reload on CPU hot removal (bsc#1133407, LTC#176111).
- kdump-Add-force-option-to-KDUMP_NETCONFIG.patch: Add ":force"
  option to KDUMP_NETCONFIG (bsc#1108919).
- kdump-Add-fence_kdump_send-when-fence-agents-installed.patch: Add
  fence_kdump_send when fence-agents installed (bsc#1108919).
- kdump-FENCE_KDUMP_SEND-variable.patch: Use var for path of
  fence_kdump_send and remove the unnecessary PRESCRIPT check
  (bsc#1108919).
- kdump-Document-fence_kdump_send.patch: Document kdump behaviour
  for fence_kdump_send (bsc#1108919).
- kdump-nss-modules.patch: Improve the handling of NSS
  (bsc#1021846).
- kdump-skip-mounts-if-no-proc-vmcore.patch: Skip kdump-related
  mounts if there is no /proc/vmcore (bsc#1102252, bsc#1125011).
- kdump-clean-up-kdump-mount-points.patch: Make sure that kdump
  mount points are cleaned up (bsc#1102252, bsc#1125011).
- kdump-Clean-up-the-use-of-current-vs-boot-network-iface.patch:
  Clean up the use of current vs. boot network interface names
  (bsc#1094444, bsc#1116463, bsc#1141064).
- kdump-Use-a-custom-namespace-for-physical-NICs.patch: Use a
  custom namespace for physical NICs (bsc#1094444, bsc#1116463,
  bsc#1141064).
- kdump-preserve-white-space.patch: Preserve white space when
  removing kernel command line options (bsc#1117652).

OBS-URL: https://build.opensuse.org/request/show/757490
OBS-URL: https://build.opensuse.org/package/show/Kernel:kdump/kdump?expand=0&rev=188
2019-12-17 10:11:52 +00:00

68 lines
2.4 KiB
Diff

From: Petr Tesarik <ptesarik@suse.com>
Date: Thu, 14 Nov 2019 19:13:39 +0100
Subject: Improve the handling of NSS
References: bsc#1021846
Upstream: merged
Git-commit 598d7517ccbbf29dc51e0a9c14146722d2324731
The current code mostly works, but can be improved in two ways:
1. Only the 'hosts' database is really needed in the kdump
environment, and its settings should be copied from the running
system. The openSSH client also needs 'passwd' (and maybe
'group'), but it is not necessary to handle fancy setups (such
as NIS or AD). The client merely requires that UID 0 can be
translated to a user name. The 'file' service is more than
sufficient for that purpose.
2. The NSS configuration file may not contain configuration of all
categories. If configuration for a given category is missing,
glibc will use a default setting, but kdump will not install
the corresponding modules. Fix it by adding the glibc default
to the configuration file explicitly if needed.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/setup-kdump.functions | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -892,8 +892,6 @@ function kdump_modify_config() #
KDUMP_SAVEDIR="${KDUMP_SAVEDIR}file://${kdump_Realpath[i]}"
elif [ "$protocol" != "srcfile" ] ; then
KDUMP_SAVEDIR="${KDUMP_SAVEDIR}${kdump_URL[i]}"
- cp /etc/hosts "${dest}/etc"
- grep '^hosts:' /etc/nsswitch.conf > "${dest}/etc/nsswitch.conf"
fi
#
@@ -919,6 +917,26 @@ function kdump_modify_config() #
KDUMP_REQUIRED_PROGRAMS="$KDUMP_REQUIRED_PROGRAMS ssh"
fi
+ # make sure NSS works somehow
+ cp /etc/hosts "${dest}/etc"
+ { cat <<-EOF
+ passwd: files
+ shadow: files
+ group: files
+EOF
+ grep '^[[:space:]]*hosts:' /etc/nsswitch.conf \
+ || echo 'hosts: dns [!UNAVAIL=return] files'
+ } > "${dest}/etc/nsswitch.conf"
+
+ # install necessary NSS modules
+ local _nssmods=$(
+ sed -e 's/#.*//; s/^[^:]*://; s/\[[^]]*\]//' \
+ "${dest}/etc/nsswitch.conf" \
+ | tr -s '[:space:]' '\n' | sort -u | tr '\n' '|' )
+ _nssmods=${_nssmods#|}
+ _nssmods=${_nssmods%|}
+ inst_libdir_file -n "/libnss_($_nssmods)" 'libnss_*.so*'
+
#
# dump the configuration file, modifying:
# KDUMP_SAVEDIR -> resolved path