Configure and Setup Postfixadmin
This page helps you setup PostfixAdmin. For further help see the documentation.
Warning: connection not secure, switch to https if possible";
} ?>
-
config.local.php file";
}
?>
-
One you have logged in with the setup_password, this page will ...
- run some simple hosting/environment checks which may help identify problems with your
environment
- create/update your database of choice,
- allow you to list / add super user accounts
For a new installation, you must generate a 'setup_password' to go into your config.local.php file.
You can use the form below, or run something like the following in a shell - php -r 'echo password_hash("password", PASSWORD_DEFAULT);'
EOF;
}
if ($old_setup_password) {
echo '
Your setup_password is in an obsolete format. As of PostfixAdmin 3.3 it needs regenerating.';
}
if (!$authenticated || !$configSetupDone) { ?>
Generate setup_password
If you want to use the password you entered as setup password, edit config.inc.php or config.local.php and set';
$result .= "
\$CONF['setup_password'] = '$hash';
After adding, refresh this page and log in using it.
";
} else {
$form_error = 'has-error';
$errors['setup_password'] = implode(', ', $msgs);
}
}
}
?>
= $result ?>
Hosting Environment Check
Information
";
foreach ($check['info'] as $msg) {
echo "- {$tick} {$msg}
";
}
echo "
";
}
if (!empty($check['warn'])) {
echo "
Warnings
";
foreach ($check['warn'] as $msg) {
echo "- ⚠ {$msg}
";
}
echo "
";
}
if (!empty($check['error'])) {
echo "
Errors (MUST be fixed)
";
foreach ($check['error'] as $msg) {
echo "- ⛔{$msg}
";
}
echo "
";
}
$php_error_log = ini_get('error_log');
} else {
if (!empty($check['error'])) {
echo '
Hosting Environment errors found. Login to see details.
';
}
if (!empty($check['warn'])) {
echo '
Hosting Environment warnings found. Login to see details.
';
}
}
?>
";
# "create admin" form submitted, make sure the correct setup password was specified.
// XXX need to ensure domains table includes an 'ALL' entry.
$table_domain = table_by_key('domain');
$rows = db_query_all("SELECT * FROM $table_domain WHERE domain = 'ALL'");
if (empty($rows)) {
// all other fields should default through the schema.
db_insert('domain', array('domain' => 'ALL', 'description' => '', 'transport' => ''));
}
$values = array(
'username' => safepost('username'),
'password' => safepost('password'),
'password2' => safepost('password2'),
'superadmin' => 1,
'domains' => array(),
'active' => 1,
);
list($error, $setupMessage, $errors) = create_admin($values);
if ($error == 1) {
$tUsername = htmlentities($values['username']);
error_log("failed to add admin - " . json_encode([$error, $setupMessage, $errors]));
echo "
Admin addition failed; check field error messages or server logs.
";
} else {
// all good!.
$setupMessage .= "
You are done with your basic setup. You can now login to PostfixAdmin using the account you just created.
";
}
echo "
";
}
$table_admin = table_by_key('admin');
$bool = db_get_boolean(true);
$admins = db_query_all("SELECT * FROM $table_admin WHERE superadmin = '$bool' AND active = '$bool'");
if (!empty($admins)) { ?>