On 08/10/17 at 03:27pm, Ziyue Yang wrote:
This commit makes dump_ssh
1) add 'kdump-' prefix to ipv6 hosts with 'eth*' like
interfaces before dumping to the host;
2) cancel 'StrictHostKeyChecking' for link local ipv6
address with 'eth*' like interface names, for it's not
possible to add 'kdump-' variants in hased known_hosts
Signed-off-by: Ziyue Yang <ziyang(a)redhat.com>
---
dracut-kdump.sh | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh
index b75c2a5..d0674b3 100755
--- a/dracut-kdump.sh
+++ b/dracut-kdump.sh
@@ -71,10 +71,27 @@ dump_raw()
dump_ssh()
{
- local _opt="-i $1 -o BatchMode=yes -o StrictHostKeyChecking=yes"
+ local _opt="-i $1 -o BatchMode=yes"
local _dir="$KDUMP_PATH/$HOST_IP-$DATEDIR"
local _host=$2
+ # add "kdump-" prefix to network interface name for
+ # link-local ipv6 address, and cancel HostKeyChecking
+ # for it's not possible to add "kdump-" variants
+ # to hashed known_hosts
+ if [[ $_host == *":"* ]]; then
+ local _host_prefix=${_host%\%*}
+ local _ifname=${_host##*\%}
+ if [[ $_ifname == "eth"* ]]; then
+ _host="$_host_prefix%kdump-$_ifname"
+ _opt+=" -o StrictHostKeyChecking=no"
Previously comments are not addressed, again, add prefix to ifname
should be handled in kdump_setup_ifname, or we will hide the "eth*"
assumption in different places it will be harder to notice when we need
change it later. If we make them in one place, it will be easier..
Also can you create a is_ipv6_link_local function? at least use
is_ipv6_address instead of check [[ $_host == *":"* ]] directly.
+ else
+ _opt+=" -o StrictHostKeyChecking=yes"
+ fi
+ else
+ _opt+=" -o StrictHostKeyChecking=yes"
+ fi
+
echo "kdump: saving to $_host:$_dir"
cat /var/lib/random-seed > /dev/urandom
--
2.9.3
_______________________________________________
kexec mailing list -- kexec(a)lists.fedoraproject.org
To unsubscribe send an email to kexec-leave(a)lists.fedoraproject.org
Thanks
Dave