Skip to contentSkip to conversation

two ssh-client module fixes

PATCH In review [email protected] 3 participants 10 messages Oct 11, 2012 – Oct 13, 2012 6 messages not in the archive

lore
Share & tools
lore
#0 lore raw

cover two ssh-client module fixes

1/2: remove cttyhack checking
2/2: add random feeding code

---
 modules.d/95ssh-client/module-setup.sh   |   10 ++--------
 modules.d/95ssh-client/random-seeding.sh |    7 +++++++
 2 files changed, 9 insertions(+), 8 deletions(-)
#1 lore raw

PATCH 1/2 ssh-client: remove ctty related check

cttyhack was removed and ctty is supported by default, so no need to check it in ssh-client module any more.

---
 modules.d/95ssh-client/module-setup.sh |    8 --------
 1 file changed, 8 deletions(-)
modules.d/95ssh-client/module-setup.sh +0 -8
@@ -15,9 +15,6 @@ check() {
             derror "ssh key: $sshkey is not found!"
             return 1
         }
-        [[ ! $cttyhack = yes ]] && {
-            dinfo "--ctty is not used, you should make sure the machine is a knownhost and copy the sshkey to remote machine!"
-        }
     fi
 
     return 255
@@ -50,11 +47,6 @@ inst_sshenv()
 }
 
 install() {
-    [[ ! $cttyhack = yes && ! $sshkey ]] && {
-        derror "ssh-client needs option --ctty or --sshkey!"
-        return 1
-    }
-
     dracut_install ssh scp
     inst_sshenv
 }
#2 lore raw

PATCH 2/2 ssh-client: add urandom seeding

In reply to [email protected]

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.

---
 modules.d/95ssh-client/module-setup.sh   |    2 ++
 modules.d/95ssh-client/random-seeding.sh |    7 +++++++
 2 files changed, 9 insertions(+)
modules.d/95ssh-client/module-setup.sh +2 -0
@@ -48,6 +48,8 @@ inst_sshenv()
 
 install() {
     dracut_install ssh scp
+    dracut_install /var/lib/random-seed
+    inst_hook cmdline 01 "$moddir/random-seeding.sh"
     inst_sshenv
 }
 
modules.d/95ssh-client/random-seeding.sh new file +7 -0
@@ -0,0 +1,7 @@
+#!/bin/sh
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+if [ -f /var/lib/random-seed ]; then
+    cat /var/lib/random-seed > /dev/urandom 2>/dev/null
+fi

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

Re: [patch 2/2] ssh-client: add urandom seeding

Hmm, wouldn't that mean, that the generator is seeded with the _same_ seed on every reboot?
How is this different from booting with no seed at all?

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#6 lore raw

Re: [patch 2/2] ssh-client: add urandom seeding

Quoted 3 lines · Harald Hoyer

Hmm, wouldn't that mean, that the generator is seeded with the _same_ seed on every reboot?
How is this different from booting with no seed at all?

This is intend to resolve the no-sufficient-entropy issue during ssh connection. But, yes it's same across reboot if the initrd is not regenerated.

In old kdump code we originally copy bytes from /dev/mem, but that is not good because /dev/mem is access denied, also it's not so random as well.

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
Thanks
Dave

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#8 lore raw

Re: [patch 2/2] ssh-client: add urandom seeding

Quoted 7 lines · Dave Young
Quoted 3 lines · Harald Hoyer

Hmm, wouldn't that mean, that the generator is seeded with the _same_ seed on every reboot?
How is this different from booting with no seed at all?

Quoted 6 lines

This is intend to resolve the no-sufficient-entropy issue during ssh connection. But, yes it's same across reboot if the initrd is not regenerated.

In old kdump code we originally copy bytes from /dev/mem, but that is not good because /dev/mem is access denied,

BTW, the access denying problem is only limited to s390 arch

Quoted 9 lines

also it's not so random as well.

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
Thanks
Dave
#9 lore raw

Re: [patch 2/2] ssh-client: add urandom seeding

In reply to a message not in the archive
Quoted 3 lines · Harald Hoyer

Hmm, wouldn't that mean, that the generator is seeded with the _same_ seed on every reboot?
How is this different from booting with no seed at all?

Atleast it can help with kdump where we might regenerate the initramfs upon user config change and capture the new seed.

Also kdump does not happen often on the machine. So I guess for once in a while operation it is still better to use random-seed then not using anything at all.

Thanks
Vivek

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#11 lore raw

Re: [patch 2/2] ssh-client: add urandom seeding

Quoted 11 lines · Vivek Goyal
Quoted 3 lines · Harald Hoyer

Hmm, wouldn't that mean, that the generator is seeded with the _same_ seed on every reboot?
How is this different from booting with no seed at all?

Atleast it can help with kdump where we might regenerate the initramfs upon user config change and capture the new seed.

Also kdump does not happen often on the machine. So I guess for once in a while operation it is still better to use random-seed then not using anything at all.

For normal boot case, I think something like systemd-random-seed-load.service is fine because rootfs is always mounted in initramfs. But I'm not sure how to handle the mount issue if /var/lib if mounted to another partition.

Or simply add below to pre-pivot hook:

if [ -f /proc/vmcore ]; then
cat /var/lib/random-seed > /dev/urandom
else
if [ -f /sysroot/var/lib/random-seed ]; then
cat /sysroot/var/lib/random-seed > /dev/urandom
fi
fi

Harald, what do you think?

Quoted 3 lines

Thanks
Vivek

Signature · 2 lines
Thanks
Dave

A message that is not in the archive (sent off-list or not yet received): [email protected]

#13 lore raw

Re: [patch 2/2] ssh-client: add urandom seeding

Quoted 22 lines · Dave Young
Quoted 11 lines · Vivek Goyal
Quoted 3 lines · Harald Hoyer

Hmm, wouldn't that mean, that the generator is seeded with the _same_ seed on every reboot?
How is this different from booting with no seed at all?

Atleast it can help with kdump where we might regenerate the initramfs upon user config change and capture the new seed.

Also kdump does not happen often on the machine. So I guess for once in a while operation it is still better to use random-seed then not using anything at all.

For normal boot case, I think something like systemd-random-seed-load.service is fine because rootfs is always mounted in initramfs. But I'm not sure how to handle the mount issue if /var/lib if mounted to another partition.

Or simply add below to pre-pivot hook:

Quoted 8 lines

if [ -f /proc/vmcore ]; then
cat /var/lib/random-seed > /dev/urandom
else
if [ -f /sysroot/var/lib/random-seed ]; then
cat /sysroot/var/lib/random-seed > /dev/urandom
fi
fi

Or how about doing it rhel6 way. Let kdump module pack in /var/lib/random-seed in kdump initramfs and if this file is present, feed it to /dev/urandom.

Thanks
Vivek

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#15 lore raw

Re: [patch 2/2] ssh-client: add urandom seeding

Quoted 32 lines · Vivek Goyal
Quoted 22 lines · Dave Young
Quoted 11 lines · Vivek Goyal
Quoted 3 lines · Harald Hoyer

Hmm, wouldn't that mean, that the generator is seeded with the _same_ seed on every reboot?
How is this different from booting with no seed at all?

Atleast it can help with kdump where we might regenerate the initramfs upon user config change and capture the new seed.

Also kdump does not happen often on the machine. So I guess for once in a while operation it is still better to use random-seed then not using anything at all.

For normal boot case, I think something like systemd-random-seed-load.service is fine because rootfs is always mounted in initramfs. But I'm not sure how to handle the mount issue if /var/lib if mounted to another partition.

Or simply add below to pre-pivot hook:

Quoted 8 lines

if [ -f /proc/vmcore ]; then
cat /var/lib/random-seed > /dev/urandom
else
if [ -f /sysroot/var/lib/random-seed ]; then
cat /sysroot/var/lib/random-seed > /dev/urandom
fi
fi

Quoted 3 lines

Or how about doing it rhel6 way. Let kdump module pack in /var/lib/random-seed in kdump initramfs and if this file is present, feed it to /dev/urandom.

Ok, will add this in kdump module instead.

Harald, please ignore patch 2/2 then.

Quoted 3 lines

Thanks
Vivek

Signature · 2 lines
Thanks
Dave