2024-09-02 06:01:36 +02:00
|
|
|
{
|
|
|
|
use MIME::Base64 qw(encode_base64);
|
|
|
|
|
|
|
|
my $rec = $DB->get('roundcube') || $DB->new_record('roundcube', {type => 'service'});
|
|
|
|
|
|
|
|
# migrate PublicAccess to access
|
|
|
|
if ( my $PublicAccess = $DB->get_prop_and_delete('roundcube','PublicAccess') ) {
|
|
|
|
$DB->set_prop('roundcube','access', "private");
|
|
|
|
$DB->set_prop('roundcube','access', "public") if ($PublicAccess =~ /global/);
|
|
|
|
$DB->set_prop('roundcube','status', "disabled") if ($PublicAccess == "none");
|
2025-02-17 06:53:59 +01:00
|
|
|
}
|
2024-09-02 06:01:36 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
my $pw = $rec->prop('DbPassword');
|
|
|
|
|
2025-02-17 06:53:59 +01:00
|
|
|
$rec->set_prop('DbPassword', sprintf("%15.0f", int( (1000000000000000) * rand() ))) unless $pw;
|
|
|
|
|
|
|
|
my $pwd = $rec->prop('des_key');
|
|
|
|
unless ($pwd) {
|
|
|
|
open( RANDOM, "/dev/urandom" );
|
|
|
|
my $buf;
|
|
|
|
read( RANDOM, $buf, 17);
|
|
|
|
$pwd = encode_base64($buf);
|
|
|
|
chomp $pwd;
|
|
|
|
close RANDOM;
|
|
|
|
$rec->set_prop('des_key', $pwd);
|
|
|
|
}
|
2024-09-02 06:01:36 +02:00
|
|
|
|
|
|
|
}
|