1 |
unnilennium |
1.1 |
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 |
2 |
|
|
--- smeserver-bugzilla-1.0/root/etc/e-smith/db/configuration/migrate/80bugzilla.adminpass 2013-10-12 19:00:12.000000000 -0400 |
3 |
|
|
+++ smeserver-bugzilla-1.0/root/etc/e-smith/db/configuration/migrate/80bugzilla 2013-10-13 12:56:46.000000000 -0400 |
4 |
|
|
@@ -17,29 +17,64 @@ |
5 |
|
|
$rec = $DB->get($service) || $DB->new_record($service, {type => 'service'}); |
6 |
|
|
|
7 |
|
|
$pw = $rec->prop('DbPassword'); |
8 |
|
|
- return "" if $pw; |
9 |
|
|
+# return "" if $pw; |
10 |
|
|
|
11 |
|
|
- if ( open( RANDOM, "/dev/urandom" ) ) |
12 |
|
|
- { |
13 |
|
|
- my $buf; |
14 |
|
|
- # 57 bytes is a full line of Base64 coding, and contains |
15 |
|
|
- # 456 bits of randomness - given a perfectly random /dev/random |
16 |
|
|
- if ( read( RANDOM, $buf, 57 ) != 57 ) |
17 |
|
|
- { |
18 |
|
|
- warn("Short read from /dev/random: $!"); |
19 |
|
|
- } |
20 |
|
|
- else |
21 |
|
|
+ $adminpw = $rec->prop('AdminPassword'); |
22 |
|
|
+# return "" if $pw; |
23 |
|
|
+ |
24 |
|
|
+ if (! $pw) |
25 |
|
|
+ { |
26 |
|
|
+ if ( open( RANDOM, "/dev/urandom" ) ) |
27 |
|
|
+ { |
28 |
|
|
+ my $buf; |
29 |
|
|
+ # 57 bytes is a full line of Base64 coding, and contains |
30 |
|
|
+ # 456 bits of randomness - given a perfectly random /dev/random |
31 |
|
|
+ if ( read( RANDOM, $buf, 57 ) != 57 ) |
32 |
|
|
+ { |
33 |
|
|
+ warn("Short read from /dev/random: $!"); |
34 |
|
|
+ } |
35 |
|
|
+ else |
36 |
|
|
+ { |
37 |
|
|
+ $pw = encode_base64($buf); |
38 |
|
|
+ chomp $pw; |
39 |
|
|
+ } |
40 |
|
|
+ close RANDOM; |
41 |
|
|
+ } |
42 |
|
|
+ else |
43 |
|
|
+ { |
44 |
|
|
+ warn "Could not open /dev/urandom: $!"; |
45 |
|
|
+ } |
46 |
|
|
+ |
47 |
|
|
+ $rec->set_prop('DbPassword', $pw); |
48 |
|
|
+ } |
49 |
|
|
+ |
50 |
|
|
+ if (! $adminpw) |
51 |
|
|
{ |
52 |
|
|
- $pw = encode_base64($buf); |
53 |
|
|
- chomp $pw; |
54 |
|
|
+ if ( open( RANDOM, "/dev/urandom" ) ) |
55 |
|
|
+ { |
56 |
|
|
+ my $buf; |
57 |
|
|
+ # 57 bytes is a full line of Base64 coding, and contains |
58 |
|
|
+ # 456 bits of randomness - given a perfectly random /dev/random |
59 |
|
|
+ if ( read( RANDOM, $buf, 57 ) != 57 ) |
60 |
|
|
+ { |
61 |
|
|
+ warn("Short read from /dev/random: $!"); |
62 |
|
|
+ } |
63 |
|
|
+ else |
64 |
|
|
+ { |
65 |
|
|
+ $adminpw = encode_base64($buf); |
66 |
|
|
+ chomp $adminpw; |
67 |
|
|
+ $adminpw = substr $adminpw, 0, 16; |
68 |
|
|
+ } |
69 |
|
|
+ close RANDOM; |
70 |
|
|
+ } |
71 |
|
|
+ else |
72 |
|
|
+ { |
73 |
|
|
+ warn "Could not open /dev/urandom: $!"; |
74 |
|
|
+ } |
75 |
|
|
+ |
76 |
|
|
+ $rec->set_prop('AdminPassword', $adminpw); |
77 |
|
|
} |
78 |
|
|
- close RANDOM; |
79 |
|
|
- } |
80 |
|
|
- else |
81 |
|
|
- { |
82 |
|
|
- warn "Could not open /dev/urandom: $!"; |
83 |
|
|
- } |
84 |
|
|
|
85 |
|
|
- $rec->set_prop('DbPassword', $pw); |
86 |
|
|
+ |
87 |
|
|
|
88 |
|
|
} |
89 |
|
|
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 |
90 |
|
|
--- smeserver-bugzilla-1.0/root/etc/e-smith/templates/etc/bugzilla.conf/40adminpassword.adminpass 2013-10-12 19:00:12.000000000 -0400 |
91 |
|
|
+++ smeserver-bugzilla-1.0/root/etc/e-smith/templates/etc/bugzilla.conf/40adminpassword 2013-10-13 12:58:59.000000000 -0400 |
92 |
|
|
@@ -1 +1 @@ |
93 |
|
|
-$answer\{'ADMIN_PASSWORD'\} = '{$bugzilla{'DbPassword'}}'; |
94 |
|
|
+$answer\{'ADMIN_PASSWORD'\} = '{$bugzilla{'AdminPassword'}}'; |