|
|
ace748 |
From 5ae8333947bb6a71232fbb99c626e08f177178e2 Mon Sep 17 00:00:00 2001
|
|
|
ace748 |
From: Tong Li <tonli@redhat.com>
|
|
|
ace748 |
Date: Wed, 30 Nov 2016 17:05:57 +0800
|
|
|
ace748 |
Subject: [PATCH] 95ssh-client: attempt to copy UserKnownHostsFile to kdump's
|
|
|
ace748 |
initramfs
|
|
|
ace748 |
|
|
|
ace748 |
Bug related to this issue: https://bugzilla.redhat.com/show_bug.cgi?id=1360131
|
|
|
ace748 |
Now dracut only attempts to copy GlobalKnownHostsFile while generating kdump's
|
|
|
ace748 |
initramfs. This method will cause kdump's failure if users set customized
|
|
|
ace748 |
UserKnownHostsFile in /etc/ssh/ssh_config. This patch simply attempts to copy
|
|
|
ace748 |
those files too while going through /etc/ssh/ssh_config. Note that we need to
|
|
|
ace748 |
make sure ~/foo will be copied as /root/foo in kdump's initramfs.
|
|
|
ace748 |
|
|
|
ace748 |
Cherry-picked from: 32f5af2f5e20ee982745262c444c50b20bfb4c01
|
|
|
ace748 |
Resolves: #1360131
|
|
|
ace748 |
---
|
|
|
ace748 |
modules.d/95ssh-client/module-setup.sh | 15 +++++++++++----
|
|
|
ace748 |
1 file changed, 11 insertions(+), 4 deletions(-)
|
|
|
ace748 |
|
|
|
ace748 |
diff --git a/modules.d/95ssh-client/module-setup.sh b/modules.d/95ssh-client/module-setup.sh
|
|
|
1755ca |
index 6b441075..743de988 100755
|
|
|
ace748 |
--- a/modules.d/95ssh-client/module-setup.sh
|
|
|
ace748 |
+++ b/modules.d/95ssh-client/module-setup.sh
|
|
|
ace748 |
@@ -44,10 +44,17 @@ inst_sshenv()
|
|
|
ace748 |
if [[ -f /etc/ssh/ssh_config ]]; then
|
|
|
ace748 |
inst_simple /etc/ssh/ssh_config
|
|
|
ace748 |
sed -i -e 's/\(^[[:space:]]*\)ProxyCommand/\1# ProxyCommand/' ${initdir}/etc/ssh/ssh_config
|
|
|
ace748 |
- while read key val; do
|
|
|
ace748 |
- [[ $key != "GlobalKnownHostsFile" ]] && continue
|
|
|
ace748 |
- inst_simple "$val"
|
|
|
ace748 |
- break
|
|
|
ace748 |
+ while read key val || [ -n "$key" ]; do
|
|
|
ace748 |
+ if [[ $key == "GlobalKnownHostsFile" ]]; then
|
|
|
ace748 |
+ inst_simple "$val"
|
|
|
ace748 |
+ # Copy customized UserKnowHostsFile
|
|
|
ace748 |
+ elif [[ $key == "UserKnownHostsFile" ]]; then
|
|
|
ace748 |
+ # Make sure that ~/foo will be copied as /root/foo in kdump's initramfs
|
|
|
ace748 |
+ if str_starts "$val" "~/"; then
|
|
|
ace748 |
+ val="/root/${val#"~/"}"
|
|
|
ace748 |
+ fi
|
|
|
ace748 |
+ inst_simple "$val"
|
|
|
ace748 |
+ fi
|
|
|
ace748 |
done < /etc/ssh/ssh_config
|
|
|
ace748 |
fi
|
|
|
ace748 |
|