summaryrefslogtreecommitdiff
path: root/install
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2013-04-13 18:24:27 +0400
committerAndrew Dolgov <[email protected]>2013-04-13 18:24:41 +0400
commit044cff2d74ece46256201695346d1a0d1d66c746 (patch)
treef8c4c039e69bde071b74ca27f35839f0a3a55eb7 /install
parent5b27cb05a8af1bcf741a3885b17fc7d03d456c5f (diff)
implement basic feed authentication parameter encryption in the database (FEED_CRYPT_KEY)
Diffstat (limited to 'install')
-rw-r--r--install/index.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/install/index.php b/install/index.php
index 3b6a1f544..1aae5da83 100644
--- a/install/index.php
+++ b/install/index.php
@@ -10,6 +10,25 @@
<body>
<?php
+ function make_password($length = 8) {
+
+ $password = "";
+ $possible = "0123456789abcdfghjkmnpqrstvwxyzABCDFGHJKMNPQRSTVWXYZ*%+^";
+
+ $i = 0;
+
+ while ($i < $length) {
+ $char = substr($possible, mt_rand(0, strlen($possible)-1), 1);
+
+ if (!strstr($password, $char)) {
+ $password .= $char;
+ $i++;
+ }
+ }
+ return $password;
+ }
+
+
function sanity_check($db_type) {
$errors = array();
@@ -108,6 +127,12 @@
$finished = false;
+ if (function_exists("mcrypt_decrypt")) {
+ $crypt_key = make_password(24);
+ } else {
+ $crypt_key = "";
+ }
+
foreach ($data as $line) {
if (preg_match("/define\('DB_TYPE'/", $line)) {
$rv .= "\tdefine('DB_TYPE', '$DB_TYPE');\n";
@@ -123,6 +148,8 @@
$rv .= "\tdefine('DB_PORT', '$DB_PORT');\n";
} else if (preg_match("/define\('SELF_URL_PATH'/", $line)) {
$rv .= "\tdefine('SELF_URL_PATH', '$SELF_URL_PATH');\n";
+ } else if (preg_match("/define\('FEED_CRYPT_KEY'/", $line)) {
+ $rv .= "\tdefine('FEED_CRYPT_KEY', '$crypt_key');\n";
} else if (!$finished) {
$rv .= "$line\n";
}