1 |
unnilennium |
1.1 |
diff -Nur -x '*.orig' -x '*.rej' smeserver-BackupPC-0.1/createlinks mezzanine_patched_smeserver-BackupPC-0.1/createlinks |
2 |
|
|
--- smeserver-BackupPC-0.1/createlinks 2009-05-13 02:05:27.000000000 +0200 |
3 |
|
|
+++ mezzanine_patched_smeserver-BackupPC-0.1/createlinks 2009-05-13 02:03:41.000000000 +0200 |
4 |
|
|
@@ -31,8 +31,10 @@ |
5 |
|
|
templates2events("/etc/sudoers", $event); |
6 |
|
|
templates2events("/etc/httpd/bkpc-conf/httpd.conf", qw(backuppc-update bootstrap-console-save)); |
7 |
|
|
|
8 |
|
|
-event_link("backuppc-checkupgrade", $event, "10"); |
9 |
|
|
-event_link("backuppc-checkupgrade", "post-upgrade", "90"); |
10 |
|
|
+event_link("backuppc-checkupgrade", $event, "20"); |
11 |
|
|
+event_link("backuppc-genkey", $event, "10"); |
12 |
|
|
+event_link("backuppc-checkupgrade", "post-upgrade", "91"); |
13 |
|
|
+event_link("backuppc-genkey", "post-upgrade", "90"); |
14 |
|
|
|
15 |
|
|
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/backuppc"); |
16 |
|
|
safe_symlink("sigusr1", "root/etc/e-smith/events/$event/services2adjust/httpd-e-smith"); |
17 |
|
|
diff -Nur -x '*.orig' -x '*.rej' smeserver-BackupPC-0.1/root/etc/e-smith/events/actions/backuppc-genkey mezzanine_patched_smeserver-BackupPC-0.1/root/etc/e-smith/events/actions/backuppc-genkey |
18 |
|
|
--- smeserver-BackupPC-0.1/root/etc/e-smith/events/actions/backuppc-genkey 1970-01-01 01:00:00.000000000 +0100 |
19 |
|
|
+++ mezzanine_patched_smeserver-BackupPC-0.1/root/etc/e-smith/events/actions/backuppc-genkey 2009-05-13 02:03:05.000000000 +0200 |
20 |
|
|
@@ -0,0 +1,33 @@ |
21 |
|
|
+#!/usr/bin/perl -w |
22 |
|
|
+ |
23 |
|
|
+# Generate a keyfile for archives encryption |
24 |
|
|
+ |
25 |
|
|
+my $keyfile = '/etc/BackupPC/archive.key'; |
26 |
|
|
+ |
27 |
|
|
+if (! -e $keyfile){ |
28 |
|
|
+ use MIME::Base64 qw(encode_base64); |
29 |
|
|
+ |
30 |
|
|
+ my $key = "not set due to error"; |
31 |
|
|
+ if ( open( RANDOM, "/dev/urandom" ) ){ |
32 |
|
|
+ my $buf; |
33 |
|
|
+ # 57 bytes is a full line of Base64 coding, and contains |
34 |
|
|
+ # 456 bits of randomness - given a perfectly random /dev/random |
35 |
|
|
+ if ( read( RANDOM, $buf, 57 ) != 57 ) |
36 |
|
|
+ { |
37 |
|
|
+ warn("Short read from /dev/random: $!"); |
38 |
|
|
+ } |
39 |
|
|
+ else |
40 |
|
|
+ { |
41 |
|
|
+ $key = encode_base64($buf); |
42 |
|
|
+ chomp $key; |
43 |
|
|
+ } |
44 |
|
|
+ close RANDOM; |
45 |
|
|
+ } |
46 |
|
|
+ else |
47 |
|
|
+ { |
48 |
|
|
+ warn "Could not open /dev/urandom: $!"; |
49 |
|
|
+ } |
50 |
|
|
+ open( KEYFILE, ">$keyfile") || warn "Could not open $keyfile: $!"; |
51 |
|
|
+ print KEYFILE $key; |
52 |
|
|
+ close KEYFILE; |
53 |
|
|
+} |