From 1ba39540c5575513c504a32bab497bf792fb09d2849890fabaf1e00ab1cd4d31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Tesa=C5=99=C3=ADk?= Date: Tue, 16 May 2017 11:35:29 +0000 Subject: [PATCH] Accepting request 495233 from home:ptesarik:branches:Kernel:kdump Implement FATE#321583 OBS-URL: https://build.opensuse.org/request/show/495233 OBS-URL: https://build.opensuse.org/package/show/Kernel:kdump/kdump?expand=0&rev=126 --- kdump-KDUMP_SSH_IDENTITY-cfg.patch | 32 ++++++++++ kdump-KDUMP_SSH_IDENTITY.patch | 96 ++++++++++++++++++++++++++++++ kdump.changes | 8 +++ kdump.spec | 4 ++ 4 files changed, 140 insertions(+) create mode 100644 kdump-KDUMP_SSH_IDENTITY-cfg.patch create mode 100644 kdump-KDUMP_SSH_IDENTITY.patch diff --git a/kdump-KDUMP_SSH_IDENTITY-cfg.patch b/kdump-KDUMP_SSH_IDENTITY-cfg.patch new file mode 100644 index 0000000..2772da1 --- /dev/null +++ b/kdump-KDUMP_SSH_IDENTITY-cfg.patch @@ -0,0 +1,32 @@ +Date: Tue May 16 13:30:14 2017 +0200 +From: Petr Tesarik +Subject: Add KDUMP_SSH_IDENTITY to the config file template +References: FATE#321583 +Git-commit: c257bdb31fa65133fe3a380b09e61566fefef4fe +Upstream: v0.8.17 + +Also put the new option to the config file template, so it can be +modified using the standard /etc/sysconfig editor. + +Signed-off-by: Petr Tesarik + +--- + sysconfig.kdump.in | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/sysconfig.kdump.in ++++ b/sysconfig.kdump.in +@@ -383,3 +383,13 @@ KDUMP_NOTIFICATION_CC="" + # + # See also: kdump(5) + KDUMP_HOST_KEY="" ++ ++## Type: string ++## Default: "" ++## ServiceRestart: kdump ++# ++# List of SSH identity files for public key authentication. If empty, kdump ++# will try all standard OpenSSH identities for the 'root' user. ++# ++# See also: kdump(5) ++KDUMP_SSH_IDENTITY="" diff --git a/kdump-KDUMP_SSH_IDENTITY.patch b/kdump-KDUMP_SSH_IDENTITY.patch new file mode 100644 index 0000000..d342055 --- /dev/null +++ b/kdump-KDUMP_SSH_IDENTITY.patch @@ -0,0 +1,96 @@ +Date: Tue May 16 13:23:49 2017 +0200 +From: Petr Tesarik +Subject: Add KDUMP_SSH_IDENTITY config option +References: FATE#321583 +Git-commit: 3e7e5f020024eed5c6d944e0ff9554772cbdb896 +Upstream: v0.8.17 + +Make the SSH private file configurable. + +Signed-off-by: Petr Tesarik + +--- + doc/man/kdump.5.txt.in | 9 +++++++++ + init/setup-kdump.functions | 37 ++++++++++++++++++++++++++----------- + kdumptool/define_opt.h | 1 + + 3 files changed, 36 insertions(+), 11 deletions(-) + +--- a/doc/man/kdump.5.txt.in ++++ b/doc/man/kdump.5.txt.in +@@ -643,7 +643,16 @@ Example (broken into lines for readabili + + Default: "" + ++KDUMP_SSH_IDENTITY ++~~~~~~~~~~~~~~~~~~ + ++List of SSH identity files for public key authentication. If empty, kdump ++will try all standard OpenSSH identities for the 'root' user (rsa, dsa, ++ecdsa, ed25519, in this order). ++ ++Example: "/root/.ssh/id_kdump_rsa" ++ ++Default: "" + + URL FORMAT + ---------- +--- a/init/setup-kdump.functions ++++ b/init/setup-kdump.functions +@@ -935,6 +935,27 @@ function kdump_modify_multipath() + } # }}} + + # ++# Copy SSH identity file(s) and update the target config file ++# Parameters: ++# 1) dest: root of the temporary area ++function kdump_copy_ssh_ident() # {{{ ++{ ++ local dest="$1" ++ local ssh_conf="$dest/kdump/.ssh/config" ++ local f ++ ++ shift ++ for f in "$@"; do ++ test -f "$f" || continue ++ ++ cp "$f" "${dest}/kdump/.ssh/" ++ test -f "${f}.pub" && cp "${f}.pub" "${dest}/kdump/.ssh/" ++ test -f "${f}-cert.pub" && cp "${f}-cert.pub" "${dest}/kdump/.ssh/" ++ echo "IdentityFile ${f}" >> "$ssh_conf" ++ done ++} # }}} ++ ++# + # Copy SSH keys and create a config file in the target + # Parameters: + # 1) dest: root of the temporary area +@@ -952,17 +973,11 @@ function kdump_init_ssh() # {{{ + echo "StrictHostKeyChecking yes" >> "$ssh_conf" + echo "UserKnownHostsFile /kdump/.ssh/known_hosts" >> "$ssh_conf" + +- local type +- for type in rsa dsa ecdsa ed25519 +- do +- if [ -f /root/.ssh/id_${type} -a -f /root/.ssh/id_${type}.pub ] ; then +- cp /root/.ssh/id_${type}{,.pub} "${dest}/kdump/.ssh/" +- if [ -f /root/.ssh/id_${type}-cert.pub ] ; then +- cp /root/.ssh/id_${type}-cert.pub "${dest}/kdump/.ssh/" +- fi +- echo "IdentityFile /kdump/.ssh/id_${type}" >> "$ssh_conf" +- fi +- done ++ if [ -n "$KDUMP_SSH_IDENTITY" ] ; then ++ kdump_copy_ssh_ident "$dest" $KDUMP_SSH_IDENTITY ++ else ++ kdump_copy_ssh_ident "$dest" /root/.ssh/id_{rsa,dsa,ecdsa,ed25519} ++ fi + } # }}} + + # +--- a/kdumptool/define_opt.h ++++ b/kdumptool/define_opt.h +@@ -41,3 +41,4 @@ DEFINE_OPT(KDUMP_SMTP_PASSWORD, String, + DEFINE_OPT(KDUMP_NOTIFICATION_TO, String, "", DUMP) + DEFINE_OPT(KDUMP_NOTIFICATION_CC, String, "", DUMP) + DEFINE_OPT(KDUMP_HOST_KEY, String, "", DUMP) ++DEFINE_OPT(KDUMP_SSH_IDENTITY, String, "", MKINITRD) diff --git a/kdump.changes b/kdump.changes index a15ffe6..c77b25b 100644 --- a/kdump.changes +++ b/kdump.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Tue May 16 11:31:53 UTC 2017 - ptesarik@suse.com + +- kdump-KDUMP_SSH_IDENTITY.patch: Add KDUMP_SSH_IDENTITY config + option (FATE#321583). +- kdump-KDUMP_SSH_IDENTITY-cfg.patch: Add KDUMP_SSH_IDENTITY to the + config file template (FATE#321583). + ------------------------------------------------------------------- Sat Feb 18 14:38:57 CET 2017 - kukuk@suse.de diff --git a/kdump.spec b/kdump.spec index bcb81c7..98ac342 100644 --- a/kdump.spec +++ b/kdump.spec @@ -42,6 +42,8 @@ Url: https://github.com/ptesarik/kdump Source: %{name}-%{version}.tar.bz2 Source2: %{name}-rpmlintrc Patch1: %{name}-cmake-compat.patch +Patch2: %{name}-KDUMP_SSH_IDENTITY.patch +Patch3: %{name}-KDUMP_SSH_IDENTITY-cfg.patch BuildRequires: asciidoc BuildRequires: cmake BuildRequires: gcc-c++ @@ -102,6 +104,8 @@ after a crash dump has occured. %prep %setup -q %patch1 -p1 +%patch2 -p1 +%patch3 -p1 %build export CFLAGS="%{optflags}"