add random feeding code for ssh dump

ssh: add random feeding code

openssh usually depends on /dev/urandom to seeding PRNG (pseudo-random number
generator). To ensure there's sufficient entropy just feed /dev/urandom with
saved /var/lib/random-seed which is saved in installing phase.

dracut_install will print error message, so just exit and do not print error
again.

Todo: other dracut_install fail and exit, such as dd, makedumpfile.

[v2->v3]: use [[:blank:]] for whitespace checking.

Signed-off-by: Dave Young <dyoung@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
This commit is contained in:
Dave Young 2012-11-14 13:58:37 +08:00
parent f3914a98a6
commit c5c4a7b8b0
2 changed files with 9 additions and 0 deletions

View File

@ -102,6 +102,7 @@ dump_ssh()
local _opt="-i $1 -o BatchMode=yes -o StrictHostKeyChecking=yes"
local _dir="$KDUMP_PATH/$DATEDIR"
cat /var/lib/random-seed > /dev/urandom
ssh -q $_opt $2 mkdir -p $_dir || return 1
if [ "${CORE_COLLECTOR%% *}" = "scp" ]; then

View File

@ -17,6 +17,11 @@ depends() {
return 0
}
is_ssh_dump_target()
{
grep -q "^ssh[[:blank:]].*@" /etc/kdump.conf
}
kdump_to_udev_name() {
local dev="$1"
@ -339,6 +344,9 @@ kdump_check_iscsi_targets () {
install() {
kdump_install_conf
if is_ssh_dump_target; then
dracut_install /var/lib/random-seed || exit $?
fi
inst "$moddir/monitor_dd_progress" "/kdumpscripts/monitor_dd_progress"
chmod +x ${initdir}/kdumpscripts/monitor_dd_progress
inst "/bin/dd" "/bin/dd"