[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 07:20:18PM +0100, Wichert Akkerman wrote:
> The problem is this: when creating a new directory slapd asks
> for the admin password and creates a admin entry with that
> password. However when running non-interactively we can not
> ask for a password so the config script aborts.
> 
> Does anyone have any opinions on what to do? I'm tempted to implement
> the third option.
I did a similar thing for horde2 when creating a database user and password.
The password is generated randomly if the user doesn't supply one.

BTW: This is the script I use, are there comments available from security
experts? Does anybody know a version that uses sh only and does not rely on
perl?


--------------------------------snip----------------------------------
#!/usr/bin/perl
$allowed="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./";

if (!open(R,"/dev/random")) {
	printf STDERR "Warning, no random device found, password might be insecure\n";
	$rndstring=`(ps axwv;ifconfig;w)|md5sum`;
	foreach $i (0..7) {
		$RVAL[$i]=hex(substr($rndstring,2*$i,2));
	}
} else {
	foreach $i (0..7) {
		$RVAL[$i]=ord(getc(R));
	}
	close(R);
}

$pw="";
foreach $i (0..7) {
	$pw .= substr($allowed,$RVAL[$i] % 64,1);
}
print $pw;
--------------------------------snap----------------------------------



Nils

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

Attachment: pgptrbbh2k_F3.pgp
Description: PGP signature


Reply to: