[freeside-commits] freeside/FS/FS Setup.pm,1.26,1.26.2.1
Ivan,,,
ivan at wavetail.420.am
Wed Oct 26 14:59:54 PDT 2011
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv2626/FS/FS
Modified Files:
Tag: FREESIDE_2_3_BRANCH
Setup.pm
Log Message:
add easier bin/enable-encryption
Index: Setup.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Setup.pm,v
retrieving revision 1.26
retrieving revision 1.26.2.1
diff -u -w -d -r1.26 -r1.26.2.1
--- Setup.pm 12 May 2011 22:30:34 -0000 1.26
+++ Setup.pm 26 Oct 2011 21:59:52 -0000 1.26.2.1
@@ -5,6 +5,7 @@
use Exporter;
#use Tie::DxHash;
use Tie::IxHash;
+use Crypt::OpenSSL::RSA;
use FS::UID qw( dbh driver_name );
use FS::Record;
@@ -13,7 +14,7 @@
$FS::svc_domain::whois_hack = 1;
@ISA = qw( Exporter );
- at EXPORT_OK = qw( create_initial_data );
+ at EXPORT_OK = qw( create_initial_data enable_encryption );
=head1 NAME
@@ -62,6 +63,27 @@
}
+sub enable_encryption {
+
+ eval "use FS::Conf";
+ die $@ if $@;
+
+ my $conf = new FS::Conf;
+
+ die "encryption key(s) already in place"
+ if $conf->exists('encryptionpublickey')
+ || $conf->exists('encryptionprivatekey');
+
+ my $length = 2048;
+ my $rsa = Crypt::OpenSSL::RSA->generate_key($length);
+
+ $conf->set('encryption', 1);
+ $conf->set('encryptionmodule', 'Crypt::OpenSSL::RSA');
+ $conf->set('encryptionpublickey', $rsa->get_public_key_string );
+ $conf->set('encryptionprivatekey', $rsa->get_private_key_string );
+
+}
+
sub populate_numbering {
eval "use FS::lata_Data;"; # this automatically populates the lata table, if unpopulated
eval "use FS::msa_Data;"; # this automatically populates the msa table, if unpopulated
More information about the freeside-commits
mailing list