/[smecontribs]/rpms/smeserver-BackupPC/contribs7/smeserver-BackupPC-0.1-generate_key_file.patch
ViewVC logotype

Contents of /rpms/smeserver-BackupPC/contribs7/smeserver-BackupPC-0.1-generate_key_file.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Wed May 13 21:19:41 2009 UTC (15 years, 6 months ago) by vip-ire
Branch: MAIN
CVS Tags: smeserver-BackupPC-0_1-12_el4_sme, smeserver-BackupPC-0_1-9_el4_sme, smeserver-BackupPC-0_1-11_el4_sme, smeserver-BackupPC-0_1-10_el4_sme, HEAD
Add encryption support

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 +}

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed