On 12/02/16 at 12:56pm, Tong Li wrote: > Hi, > > On Fri, Dec 2, 2016 at 10:00 AM, Dave Young <dyoung@xxxxxxxxxx> 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@xxxxxxxxxx> > > > --- > > > 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@xxxxxxxxxxxxxxx > > > More majordomo info at http://vger.kernel.org/majordomo-info.html > > > > > > -- > Regards, > Tong -- To unsubscribe from this list: send the line "unsubscribe initramfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html