From: ivan Date: Wed, 30 Jun 2004 10:02:45 +0000 (+0000) Subject: add option to pgp/gpg encrypt scp dumps X-Git-Tag: freeside_1_5_0beforepre6^2~112 X-Git-Url: http://git.freeside.biz/gitweb/?a=commitdiff_plain;h=6e606e4f3c8a27df62bb2f229a09fccca7bd4d6b;p=freeside.git add option to pgp/gpg encrypt scp dumps --- diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 6f7b2d6d8..d35b1ac3d 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -1177,6 +1177,13 @@ httemplate/docs/config.html 'type' => 'text', }, + { + 'key' => 'dump-pgpid', + 'section' => '', + 'description' => "Optional PGP public key user or key id for database dumps. The public key should exist on the freeside user's public keyring, and the gpg binary and GnuPG perl module should be installed.", + 'type' => 'text', + }, + { 'key' => 'users-allow_comp', 'section' => '', diff --git a/FS/bin/freeside-daily b/FS/bin/freeside-daily index 00de2987a..99d95d5d2 100755 --- a/FS/bin/freeside-daily +++ b/FS/bin/freeside-daily @@ -63,7 +63,6 @@ if ( driver_name eq 'Pg' ) { } } -#local hack my $conf = new FS::Conf; my $dest = $conf->config('dump-scpdest'); if ( $dest ) { @@ -75,7 +74,18 @@ if ( $dest ) { } else { die "database dumps not yet supported for ". driver_name; } - scp("/var/tmp/$database.sql", $dest); + if ( $conf->config('dump-pgpid') ) { + eval 'use GnuPG'; + my $gpg = new GnuPG; + $gpg->encrypt( plaintext => "/var/tmp/$database.sql", + output => "/var/tmp/$database.gpg", + recipient => $conf->config('dump-pgpid'), + ); + scp("/var/tmp/$database.gpg", $dest); + unlink "/var/tmp/$database.gpg" or die $!; + } else { + scp("/var/tmp/$database.sql", $dest); + } unlink "/var/tmp/$database.sql" or die $!; }