[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#134774: slapd: fails to install



On Thu, Feb 21, 2002 at 06:02:52PM -0600, John Hasler wrote:
> Steve writes:
> > ...I can't think of a sane way to do this in plain POSIX sh.
> 
>     until [ `expr "$PASSWORD" : ".*"` -ge 8 ]
>     do
>         PASSWORD=`head -c 100 /dev/urandom | tr -dc '[:alnum:]' | tail -c 8`
>     done
Or even better because it always uses only 8 bytes of /dev/random:

$PASSWORD=`dd if=/dev/random bs=1 count=8 2>/dev/null | \
        tr "\000-\377" "a-zA-Z0-9./a-zA-Z0-9./a-zA-Z0-9./a-zA-Z0-9./"`

That discards 2 of 8 bits of every byte, giving 48 bits, but increasing
count should take care of that. Needs MD5 passwords though.


Nils

--
                                     ______
                                    (Muuuhh)
Global Village Sau  ==>        ^..^ |/¯¯¯¯¯
(Kann Fremdsprache) ==>        (oo)

Attachment: pgp5JDOWTuTZ0.pgp
Description: PGP signature


Reply to: