From 68c0e65c5859351e7b6e2f851e211a99333c5046 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Wed, 20 Nov 2013 12:56:18 +0100 Subject: [PATCH] Add missing files --- .../db/configuration/defaults/dl/DbName | 1 + .../db/configuration/defaults/dl/DbUser | 1 + .../db/configuration/migrate/dl-database | 27 +++++++++++++++++++ .../etc/e-smith/sql/init/dl | 1 + 4 files changed, 30 insertions(+) create mode 100644 root/etc/e-smith/db/configuration/defaults/dl/DbName create mode 100644 root/etc/e-smith/db/configuration/defaults/dl/DbUser create mode 100644 root/etc/e-smith/db/configuration/migrate/dl-database create mode 100644 root/etc/e-smith/templates.metadata/etc/e-smith/sql/init/dl diff --git a/root/etc/e-smith/db/configuration/defaults/dl/DbName b/root/etc/e-smith/db/configuration/defaults/dl/DbName new file mode 100644 index 0000000..5c48862 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/dl/DbName @@ -0,0 +1 @@ +dl diff --git a/root/etc/e-smith/db/configuration/defaults/dl/DbUser b/root/etc/e-smith/db/configuration/defaults/dl/DbUser new file mode 100644 index 0000000..5c48862 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/dl/DbUser @@ -0,0 +1 @@ +dl diff --git a/root/etc/e-smith/db/configuration/migrate/dl-database b/root/etc/e-smith/db/configuration/migrate/dl-database new file mode 100644 index 0000000..c4de2f6 --- /dev/null +++ b/root/etc/e-smith/db/configuration/migrate/dl-database @@ -0,0 +1,27 @@ +{ + my $rec = $DB->get('dl') + || $DB->new_record('dl', {type => 'webapp'}); + my $pw = $rec->prop('DbPassword'); + if (not $pw or length($pw) < 57){ + use MIME::Base64 qw(encode_base64); + + $pw = "not set due to error"; + if ( open( RANDOM, "/dev/urandom" ) ){ + my $buf; + # 57 bytes is a full line of Base64 coding, and contains + # 456 bits of randomness - given a perfectly random /dev/random + if ( read( RANDOM, $buf, 57 ) != 57 ){ + warn("Short read from /dev/random: $!"); + } + else{ + $pw = encode_base64($buf); + chomp $pw; + } + close RANDOM; + } + else{ + warn "Could not open /dev/urandom: $!"; + } + $rec->set_prop('DbPassword', $pw); + } +} diff --git a/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init/dl b/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init/dl new file mode 100644 index 0000000..940dcf3 --- /dev/null +++ b/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init/dl @@ -0,0 +1 @@ +PERMS=0750