Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We are using beaglebone based custom board.

In one of the init script we are generating ssh keys but it takes around 7 seconds to generate the ssh-keys. How do we speedup the process of generating ssh keys ?

From ssh tutorial we came to know that ssh-keygen waits for enough entropy to generate the ssh keys.

How do we create enough entropy before generating ssh keys ?

Any suggestions/pointer will help

share|improve this question
How large is the key itself ( bits )? You might not be able to speed it up depending on the size of the key. – Ramhound Jun 6 '14 at 12:45
iirc pressing keys and moving mouse helps – LatinSuD Jun 6 '14 at 12:46
How are you generating the entropy exactly? Are you doing it through hardware or through softwarE? – Ramhound Jun 6 '14 at 12:51
@Ramhound: i think its 2048bits, we are not generating entropy by hardware/software explicitly. – AnkurTank Jun 6 '14 at 12:57
@AnkurTank - Go verify what it is exactly then update the question. You need to generate entropy otherwise its very possible the key you generate won't be secure. – Ramhound Jun 6 '14 at 13:01

I am not sure if this will work on a Beaglebone, but it does work on virtual machines without a proper random source, so your mileage may vary

On Linux, /dev/random uses the entropy pool maintained by the kernel to generate randomness. There are two ways to speed up the entropy generation:

  • Generate lots of IO, you can use dd if=/dev/hda1 of=/dev/null (replace hda1 with your disk)
  • Write extra data into /dev/random, like dd if=/dev/hda1 of=/dev/random. However, this decreases the randomness in the pool. It might be better to use an audio source to write to /dev/random.
share|improve this answer
Nice answer, but the second dd seems identical to the first one... – MariusMatutiae Jun 6 '14 at 13:11
Typo :) I updated my answer. – mtak Jun 6 '14 at 13:21
@mtak:thank you for answer, I think randomness is the key right? instead of /dev/hda1 i will test with /dev/mtd1. meanwhile we don't have audio source in board, is there other alternative to increase entropy? – AnkurTank Jun 7 '14 at 2:18
I am not sure, but reading from any (hardware) device should give you more entropy. You could try starting more sessions of dd for different devices. Keep in mind that OpenSSL also does a lot of crypto, so you might also want to check your CPU usage. If you're running at 100% CPU, there's not much more you can do to speed up key generation. If you still need more entropy, you might want to look into a hardware random number generator, they come as USB sticks and you should be able to find one for under EUR 50. – mtak Jun 7 '14 at 7:53
@AnkurTank Did you get positive results with this method? – mtak Jun 12 '14 at 9:13

From your comment,

when i generate the key i get "+--[RSA1 2048]----+" so i suppose its 2048 right ?

it sounds like your boot process generates SSHv1 keys in addition to SSHv2. So you end up generating at least two RSA keys (and probably a DSA key and an ECDSA key).

If you turn off SSHv1 key generation, it might cut the time by half. (Version 1 of the SSH protocol has some serious problems and should never be used, anyway.)

share|improve this answer
:Thank you for answer, yes you are right, we are generting rsa1, dsa,rsa,ecdsa keys. I will have to ask seniors and check if they really need to generate rsa1 key or not. – AnkurTank Jun 7 '14 at 2:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .