* [PATCH] 95ssh-client: attempt to copy UserKnownHostsFile to kdump's initramfs
@ 2016-11-25 2:11 Tong Li
[not found] ` <1480039895-20001-1-git-send-email-tonli-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 7+ messages in thread
From: Tong Li @ 2016-11-25 2:11 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Tong Li
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
^ permalink raw reply related [flat|nested] 7+ messages in thread[parent not found: <1480039895-20001-1-git-send-email-tonli-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH] 95ssh-client: attempt to copy UserKnownHostsFile to kdump's initramfs [not found] ` <1480039895-20001-1-git-send-email-tonli-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> @ 2016-11-25 3:04 ` Dracut GitHub Import Bot 2016-11-29 8:40 ` Xunlei Pang 2016-12-02 2:00 ` Dave Young 2 siblings, 0 replies; 7+ messages in thread From: Dracut GitHub Import Bot @ 2016-11-25 3:04 UTC (permalink / raw) To: initramfs-u79uwXL29TY76Z2rM5mHXA Patchset imported to github. Pull request: <https://github.com/dracutdevs/dracut/compare/master...dracut-mailing-devs:1480039895-20001-1-git-send-email-tonli%40redhat.com> ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] 95ssh-client: attempt to copy UserKnownHostsFile to kdump's initramfs [not found] ` <1480039895-20001-1-git-send-email-tonli-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> 2016-11-25 3:04 ` Dracut GitHub Import Bot @ 2016-11-29 8:40 ` Xunlei Pang [not found] ` <CAOAn1LPhyJ+gG=mAkM3EDZ2FiARG6PxffzKCfDWJigx97Svu1Q@mail.gmail.com> [not found] ` <583D3EF2.4050705-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> 2016-12-02 2:00 ` Dave Young 2 siblings, 2 replies; 7+ messages in thread From: Xunlei Pang @ 2016-11-29 8:40 UTC (permalink / raw) To: Tong Li, initramfs-u79uwXL29TY76Z2rM5mHXA On 2016/11/25 at 10:11, Tong Li wrote: > 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 Shouldn't it be "$key = "GlobalKnownHostsFile" instead of "!="? > + inst_simple "$val" > + # Copy customized UserKnowHostsFile > + elif [ $key != "UserKnownHostsFile" ]; then ditto > + # 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" Seems may have "UserKnownHostsFile no", so it will end up with "inst_simple no". Regards, Xunlei > + fi > + done < /etc/ssh/ssh_config > + fi > > return 0 > } ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <CAOAn1LPhyJ+gG=mAkM3EDZ2FiARG6PxffzKCfDWJigx97Svu1Q@mail.gmail.com>]
[parent not found: <CAOAn1LPhyJ+gG=mAkM3EDZ2FiARG6PxffzKCfDWJigx97Svu1Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH] 95ssh-client: attempt to copy UserKnownHostsFile to kdump's initramfs [not found] ` <CAOAn1LPhyJ+gG=mAkM3EDZ2FiARG6PxffzKCfDWJigx97Svu1Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2016-11-29 9:02 ` Xunlei Pang 0 siblings, 0 replies; 7+ messages in thread From: Xunlei Pang @ 2016-11-29 9:02 UTC (permalink / raw) To: Tong Li, Xunlei Pang; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA On 2016/11/29 at 16:51, Tong Li wrote: > Hi, > > On Tue, Nov 29, 2016 at 4:40 PM, Xunlei Pang <xpang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org <mailto:xpang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>> wrote: > > On 2016/11/25 at 10:11, Tong Li wrote: > > Bug related to this issue: https://bugzilla.redhat.com/show_bug.cgi?id=1360131 <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 <mailto: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 > > Shouldn't it be "$key = "GlobalKnownHostsFile" instead of "!="? > > Yes, you are right. That's a mistake made when I send the patch. I will reopen a pull request to correct it. > > > > + inst_simple "$val" > > + # Copy customized UserKnowHostsFile > > + elif [ $key != "UserKnownHostsFile" ]; then > > ditto > > > + # 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" > > Seems may have "UserKnownHostsFile no", so it will end up with "inst_simple no". > > According to posts I found, it's more common to set UserKnownHostsFile as /dev/null to disable key checking. Is "UserKnownHostsFile no" a correct usage? I am not sure, but "UserKnownHostsFile /dev/null" sounds more reasonable :-) > > > > Regards, > Xunlei > > > + fi > > + done < /etc/ssh/ssh_config > > + fi > > > > return 0 > > } > > > > Regards, > -- > Tong ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <583D3EF2.4050705-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH] 95ssh-client: attempt to copy UserKnownHostsFile to kdump's initramfs [not found] ` <583D3EF2.4050705-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> @ 2016-12-02 1:56 ` Dave Young 0 siblings, 0 replies; 7+ messages in thread From: Dave Young @ 2016-12-02 1:56 UTC (permalink / raw) To: xlpang-H+wXaHxf7aLQT0dZR+AlfA; +Cc: Tong Li, initramfs-u79uwXL29TY76Z2rM5mHXA On 11/29/16 at 04:40pm, Xunlei Pang wrote: > On 2016/11/25 at 10:11, Tong Li wrote: > > 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 > > Shouldn't it be "$key = "GlobalKnownHostsFile" instead of "!="? > > > + inst_simple "$val" > > + # Copy customized UserKnowHostsFile > > + elif [ $key != "UserKnownHostsFile" ]; then > > ditto > > > + # 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" > > Seems may have "UserKnownHostsFile no", so it will end up with "inst_simple no". If one use "no" as the filename, we should install it. We do not need to guess the wrong configuration.. > > Regards, > Xunlei > > > + fi > > + done < /etc/ssh/ssh_config > > + fi > > > > return 0 > > } > > -- > To unsubscribe from this list: send the line "unsubscribe initramfs" in > the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] 95ssh-client: attempt to copy UserKnownHostsFile to kdump's initramfs [not found] ` <1480039895-20001-1-git-send-email-tonli-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> 2016-11-25 3:04 ` Dracut GitHub Import Bot 2016-11-29 8:40 ` Xunlei Pang @ 2016-12-02 2:00 ` Dave Young [not found] ` <CAOAn1LMB9i3Sz-1Npgw0cVm1i-n6U0pymathNftMVu89RNt6JA@mail.gmail.com> 2 siblings, 1 reply; 7+ messages in thread From: Dave Young @ 2016-12-02 2:00 UTC (permalink / raw) To: Tong Li; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA On 11/25/16 at 10:11am, Tong Li wrote: > 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#"~/"}" This should be handled by inst_* automaticlly, really should not be here. > + fi > + inst_simple "$val" > + fi The if/else means we install either Global or User knownhostsfile. Actually both of them can coexist, should install them all if exist. > + done < /etc/ssh/ssh_config > + fi > > return 0 > } > -- > 2.7.4 > > -- > To unsubscribe from this list: send the line "unsubscribe initramfs" in > the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <CAOAn1LMB9i3Sz-1Npgw0cVm1i-n6U0pymathNftMVu89RNt6JA@mail.gmail.com>]
[parent not found: <CAOAn1LMB9i3Sz-1Npgw0cVm1i-n6U0pymathNftMVu89RNt6JA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH] 95ssh-client: attempt to copy UserKnownHostsFile to kdump's initramfs [not found] ` <CAOAn1LMB9i3Sz-1Npgw0cVm1i-n6U0pymathNftMVu89RNt6JA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2016-12-02 8:18 ` Dave Young 0 siblings, 0 replies; 7+ messages in thread From: Dave Young @ 2016-12-02 8:18 UTC (permalink / raw) To: Tong Li; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA On 12/02/16 at 12:56pm, Tong Li wrote: > Hi, > > On Fri, Dec 2, 2016 at 10:00 AM, Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote: > > > On 11/25/16 at 10:11am, Tong Li wrote: > > > 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#"~/"}" > > > > This should be handled by inst_* automaticlly, really should not be > > here. > > > > > + fi > > > + inst_simple "$val" > > > + fi > > > > The if/else means we install either Global or User knownhostsfile. > > Actually both of them can coexist, should install them all if exist. > > > > Both Global and User will be copied, just User may need a little tweak, > which is replacing "~" with ${HOME}. I think inst_simple is designed to > accept one or two absolute paths as arguments (didn't find comments in code > to prove that, just according to my tests). So we should handle the "~" > issue inside ssh-client module. > dracut_install supports relative path, so maybe inst_simple should do it as well. If so just add if !globalknownhost or !userknownhost; then continue the loop, otherwise inst the file of "$val" will be enough. > > > > > > + done < /etc/ssh/ssh_config > > > + fi > > > > > > return 0 > > > } > > > -- > > > 2.7.4 > > > > > > -- > > > To unsubscribe from this list: send the line "unsubscribe initramfs" in > > > the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > > > More majordomo info at http://vger.kernel.org/majordomo-info.html > > > > > > -- > Regards, > Tong ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-12-02 8:18 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-25 2:11 [PATCH] 95ssh-client: attempt to copy UserKnownHostsFile to kdump's initramfs Tong Li
[not found] ` <1480039895-20001-1-git-send-email-tonli-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-11-25 3:04 ` 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
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox