2017-05-16 13:35:29 +02:00
|
|
|
Date: Tue May 16 13:23:49 2017 +0200
|
|
|
|
From: Petr Tesarik <ptesarik@suse.com>
|
|
|
|
Subject: Add KDUMP_SSH_IDENTITY config option
|
|
|
|
References: FATE#321583
|
|
|
|
Git-commit: 3e7e5f020024eed5c6d944e0ff9554772cbdb896
|
2017-06-14 15:00:33 +02:00
|
|
|
Git-commit: d7e6f45461bf0f899cfedf564d985cf5cd41f331
|
|
|
|
Git-commit: f0a43757c99635ece304fc9c011c0b82acd86f64
|
2017-05-16 13:35:29 +02:00
|
|
|
Upstream: v0.8.17
|
|
|
|
|
|
|
|
Make the SSH private file configurable.
|
|
|
|
|
|
|
|
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
|
|
|
|
|
|
|
|
---
|
2017-06-14 15:00:33 +02:00
|
|
|
doc/man/kdump.5.txt.in | 10 ++++++++++
|
|
|
|
init/setup-kdump.functions | 39 ++++++++++++++++++++++++++++-----------
|
2017-05-16 13:35:29 +02:00
|
|
|
kdumptool/define_opt.h | 1 +
|
2017-06-14 15:00:33 +02:00
|
|
|
3 files changed, 39 insertions(+), 11 deletions(-)
|
2017-05-16 13:35:29 +02:00
|
|
|
|
|
|
|
--- a/doc/man/kdump.5.txt.in
|
|
|
|
+++ b/doc/man/kdump.5.txt.in
|
2017-06-14 15:00:33 +02:00
|
|
|
@@ -643,7 +643,17 @@ Example (broken into lines for readabili
|
2017-05-16 13:35:29 +02:00
|
|
|
|
|
|
|
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,
|
2017-06-14 15:00:33 +02:00
|
|
|
+ecdsa, ed25519, in this order). The path to every identity file is relative
|
|
|
|
+to +~root/.ssh+, or an absolute path can be given.
|
2017-05-16 13:35:29 +02:00
|
|
|
+
|
|
|
|
+Example: "/root/.ssh/id_kdump_rsa"
|
|
|
|
+
|
|
|
|
+Default: ""
|
|
|
|
|
|
|
|
URL FORMAT
|
|
|
|
----------
|
|
|
|
--- a/init/setup-kdump.functions
|
|
|
|
+++ b/init/setup-kdump.functions
|
2017-06-14 15:00:33 +02:00
|
|
|
@@ -935,6 +935,29 @@ function kdump_modify_multipath()
|
2017-05-16 13:35:29 +02:00
|
|
|
} # }}}
|
|
|
|
|
|
|
|
#
|
|
|
|
+# Copy SSH identity file(s) and update the target config file
|
|
|
|
+# Parameters:
|
|
|
|
+# 1) dest: root of the temporary area
|
|
|
|
+function kdump_copy_ssh_ident() # {{{
|
|
|
|
+{
|
2017-06-14 15:00:33 +02:00
|
|
|
+ local sshdir="$1/kdump/.ssh"
|
|
|
|
+ local ssh_conf="$sshdir/config"
|
2017-05-16 13:35:29 +02:00
|
|
|
+ local f
|
|
|
|
+
|
|
|
|
+ shift
|
|
|
|
+ for f in "$@"; do
|
2017-06-14 15:00:33 +02:00
|
|
|
+ test "${f:0:1}" = "/" || f=~root/".ssh/$f"
|
2017-05-16 13:35:29 +02:00
|
|
|
+ test -f "$f" || continue
|
|
|
|
+
|
2017-06-14 15:00:33 +02:00
|
|
|
+ cp "$f" "$sshdir/"
|
|
|
|
+ test -f "${f}.pub" && cp "${f}.pub" "$sshdir/"
|
|
|
|
+ test -f "${f}-cert.pub" && cp "${f}-cert.pub" "$sshdir/"
|
|
|
|
+ f=$( basename $f )
|
|
|
|
+ echo "IdentityFile /kdump/.ssh/${f}" >> "$ssh_conf"
|
2017-05-16 13:35:29 +02:00
|
|
|
+ done
|
|
|
|
+} # }}}
|
|
|
|
+
|
|
|
|
+#
|
|
|
|
# Copy SSH keys and create a config file in the target
|
|
|
|
# Parameters:
|
|
|
|
# 1) dest: root of the temporary area
|
2017-06-14 15:00:33 +02:00
|
|
|
@@ -952,17 +975,11 @@ function kdump_init_ssh() # {{{
|
2017-05-16 13:35:29 +02:00
|
|
|
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
|
2017-06-14 15:00:33 +02:00
|
|
|
+ kdump_copy_ssh_ident "$dest" id_{rsa,dsa,ecdsa,ed25519}
|
2017-05-16 13:35:29 +02:00
|
|
|
+ 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)
|