diff -up smeserver-bugzilla-1.0/root/etc/e-smith/db/configuration/migrate/80bugzilla.adminpass smeserver-bugzilla-1.0/root/etc/e-smith/db/configuration/migrate/80bugzilla --- smeserver-bugzilla-1.0/root/etc/e-smith/db/configuration/migrate/80bugzilla.adminpass 2013-10-12 19:00:12.000000000 -0400 +++ smeserver-bugzilla-1.0/root/etc/e-smith/db/configuration/migrate/80bugzilla 2013-10-13 12:56:46.000000000 -0400 @@ -17,29 +17,64 @@ $rec = $DB->get($service) || $DB->new_record($service, {type => 'service'}); $pw = $rec->prop('DbPassword'); - return "" if $pw; +# return "" if $pw; - if ( open( RANDOM, "/dev/urandom" ) ) - { - my $buf; - # 57 bytes is a full line of Base64 coding, and contains - # 456 bits of randomness - given a perfectly random /dev/random - if ( read( RANDOM, $buf, 57 ) != 57 ) - { - warn("Short read from /dev/random: $!"); - } - else + $adminpw = $rec->prop('AdminPassword'); +# return "" if $pw; + + if (! $pw) + { + if ( open( RANDOM, "/dev/urandom" ) ) + { + my $buf; + # 57 bytes is a full line of Base64 coding, and contains + # 456 bits of randomness - given a perfectly random /dev/random + if ( read( RANDOM, $buf, 57 ) != 57 ) + { + warn("Short read from /dev/random: $!"); + } + else + { + $pw = encode_base64($buf); + chomp $pw; + } + close RANDOM; + } + else + { + warn "Could not open /dev/urandom: $!"; + } + + $rec->set_prop('DbPassword', $pw); + } + + if (! $adminpw) { - $pw = encode_base64($buf); - chomp $pw; + if ( open( RANDOM, "/dev/urandom" ) ) + { + my $buf; + # 57 bytes is a full line of Base64 coding, and contains + # 456 bits of randomness - given a perfectly random /dev/random + if ( read( RANDOM, $buf, 57 ) != 57 ) + { + warn("Short read from /dev/random: $!"); + } + else + { + $adminpw = encode_base64($buf); + chomp $adminpw; + $adminpw = substr $adminpw, 0, 16; + } + close RANDOM; + } + else + { + warn "Could not open /dev/urandom: $!"; + } + + $rec->set_prop('AdminPassword', $adminpw); } - close RANDOM; - } - else - { - warn "Could not open /dev/urandom: $!"; - } - $rec->set_prop('DbPassword', $pw); + } diff -up smeserver-bugzilla-1.0/root/etc/e-smith/templates/etc/bugzilla.conf/40adminpassword.adminpass smeserver-bugzilla-1.0/root/etc/e-smith/templates/etc/bugzilla.conf/40adminpassword --- smeserver-bugzilla-1.0/root/etc/e-smith/templates/etc/bugzilla.conf/40adminpassword.adminpass 2013-10-12 19:00:12.000000000 -0400 +++ smeserver-bugzilla-1.0/root/etc/e-smith/templates/etc/bugzilla.conf/40adminpassword 2013-10-13 12:58:59.000000000 -0400 @@ -1 +1 @@ -$answer\{'ADMIN_PASSWORD'\} = '{$bugzilla{'DbPassword'}}'; +$answer\{'ADMIN_PASSWORD'\} = '{$bugzilla{'AdminPassword'}}';