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"
+ 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