RE: openSSL Key generation

From: Simon Thornton (simon.thornton@swift.com)
Date: 02/10/03

  • Next message: Zow: "Re: LKM Trojan installed"
    Date: Mon, 10 Feb 2003 11:36:55 +0100
    From: Simon Thornton <simon.thornton@swift.com>
    To: "'Leland T. Snyder'" <ltsnyder@x3ci.com>, focus-linux@securityfocus.com
    
    
    

    Hi Leland,

    > nohup time /usr/bin/openssl genrsa -rand /dev/urandom
    > 1024 > /tmp/server.key &

    Two things occur to me; it's waiting for you to enter a password to
    protect the key, as the process is bg it's blocked. The other thing that
    can occur (very rarely) on linux is that the urandom system is not
    getting enough entropy to generate random numbers needed by OpenSSL.
    This can be tested by using:

            dd if=/dev/urandom of=/tmp/rand bs=2k count=1

    This should return almost immediately and generate a 2k file
    /tmp/urandom.bin, if it does not return but blocks, then you have an
    entropy gathering problem. I doubt it will be a prob. but this is the
    way to check.

    Several suggestions:

    1. remove the '-rand /dev/urandom' statement, it reads this by default
    (under Linux). On SUN machines there is no /dev/urandom, PRNGd is used
    instead. Unless you need an alternate random source, you don't to
    specify and scripts transport easily between OS's.

    2. Use '-out /tmp/server.key' instead of piping the key, it's easier to
    separate the key from any errors.

    3. The keygen process requires you to enter a passwd for the key, which
    is why it is never completes. if you 'fg' the process and then type in
    the passwd+ENTER, repeated twice, the process will complete.

    4. If you are unsure of the syntax, run openssl in interactive mode and
    use '?' to get help:

            # openssl
            OpenSSL> ?
            OpenSSL> genrsa ?

    The docs are often outdated, this is the only sure way to know what is
    compiled in.
      

    Rgds,
      

    Simon Thornton
    ---------------------------------------------------------------
    BTW, FWIW, IMHO, AFAIK, yes. OTOH, AAMOF, maybe not. YMMV