[kexec-tools/f18: 3/7] add random feeding code for ssh dump

Dave Young yangrr at fedoraproject.org
Fri Nov 16 06:24:49 UTC 2012


commit c5c4a7b8b0b15923db6649a5ab14981d90801772
Author: Dave Young <dyoung at redhat.com>
Date:   Wed Nov 14 13:58:37 2012 +0800

    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 at redhat.com>
    Acked-by: Vivek Goyal <vgoyal at redhat.com>

 dracut-kdump.sh        |    1 +
 dracut-module-setup.sh |    8 ++++++++
 2 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/dracut-kdump.sh b/dracut-kdump.sh
index faeb7c5..2ae746e 100755
--- a/dracut-kdump.sh
+++ b/dracut-kdump.sh
@@ -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
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 4795d8c..79b3766 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -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"


More information about the scm-commits mailing list