public inbox for initramfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Tong Li <tonli-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Tong Li <tonli-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Subject: [PATCH] 95ssh-client: attempt to copy UserKnownHostsFile to kdump's initramfs
Date: Fri, 25 Nov 2016 10:11:35 +0800	[thread overview]
Message-ID: <1480039895-20001-1-git-send-email-tonli@redhat.com> (raw)

Bug related to this issue: https://bugzilla.redhat.com/show_bug.cgi?id=1360131
Now dracut only attempts to copy GlobalKnownHostsFile while generating kdump's
initramfs. This method will cause kdump's failure if users set customized
UserKnownHostsFile in /etc/ssh/ssh_config. This patch simply attempts to copy
those files too while going through /etc/ssh/ssh_config. Note that we need to
make sure ~/foo will be copied as /root/foo in kdump's initramfs.

Signed-off-by: Tong Li <tonli-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 modules.d/95ssh-client/module-setup.sh | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/modules.d/95ssh-client/module-setup.sh b/modules.d/95ssh-client/module-setup.sh
index 0a0e80c..bebcae5 100755
--- a/modules.d/95ssh-client/module-setup.sh
+++ b/modules.d/95ssh-client/module-setup.sh
@@ -45,11 +45,18 @@ inst_sshenv()
         inst_simple /etc/ssh/ssh_config
         sed -i -e 's/\(^[[:space:]]*\)ProxyCommand/\1# ProxyCommand/' ${initdir}/etc/ssh/ssh_config
         while read key val || [ -n "$key" ]; do
-            [[ $key != "GlobalKnownHostsFile" ]] && continue
-            inst_simple "$val"
-            break
-        done < /etc/ssh/ssh_config
-    fi
+            if [ $key != "GlobalKnownHostsFile" ]; then
+                inst_simple "$val"
+            # Copy customized UserKnowHostsFile
+            elif [ $key != "UserKnownHostsFile" ]; then
+                # Make sure that ~/foo will be copied as /root/foo in kdump's initramfs
+                if str_starts "$val" "~/"; then
+                    val="/root/${val#"~/"}"
+                fi
+                inst_simple "$val"
+            fi
+         done < /etc/ssh/ssh_config
+     fi
 
     return 0
 }
-- 
2.7.4

             reply	other threads:[~2016-11-25  2:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-25  2:11 Tong Li [this message]
     [not found] ` <1480039895-20001-1-git-send-email-tonli-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-11-25  3:04   ` [PATCH] 95ssh-client: attempt to copy UserKnownHostsFile to kdump's initramfs Dracut GitHub Import Bot
2016-11-29  8:40   ` Xunlei Pang
     [not found]     ` <CAOAn1LPhyJ+gG=mAkM3EDZ2FiARG6PxffzKCfDWJigx97Svu1Q@mail.gmail.com>
     [not found]       ` <CAOAn1LPhyJ+gG=mAkM3EDZ2FiARG6PxffzKCfDWJigx97Svu1Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-11-29  9:02         ` Xunlei Pang
     [not found]     ` <583D3EF2.4050705-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-12-02  1:56       ` Dave Young
2016-12-02  2:00   ` Dave Young
     [not found]     ` <CAOAn1LMB9i3Sz-1Npgw0cVm1i-n6U0pymathNftMVu89RNt6JA@mail.gmail.com>
     [not found]       ` <CAOAn1LMB9i3Sz-1Npgw0cVm1i-n6U0pymathNftMVu89RNt6JA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-12-02  8:18         ` Dave Young

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1480039895-20001-1-git-send-email-tonli@redhat.com \
    --to=tonli-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox