Problem with PostfixAdmin

Everything is very good when php5.3 and origin mail domain:mail.xxx.xxx.xxx but after an upgrade of 9.0 to 9.1, that is php5.4 and change mail.xxx.xxx.xxx to be mail2.xxx.xxx.xxx for some reason. Everything quite different.

Postfixadmin can set up virtual domains without any error message. But it shows

Code:
Notice: Undefined index: maildir_name_hook in /usr/local
/www/postfixadmin/create-mailbox.php on line 162
for a new mail box.
When running ls /usr/local/virtual
there's nothing.

What's wrong and how to fix this issue?

Thanks!
 
Hi,

Paste your PostfixAdmin configuration,the rights of the folder /usr/local/virtual and VDA related directives from /usr/local/etc/postfix/main.cf.
 
quintessence said:
Hi,

Paste your PostfixAdmin configuration,the rights of the folder /usr/local/virtual and VDA related directives from /usr/local/etc/postfix/main.cf.

Thanks very much for your help. VDA related of main.cf is
Code:
#======= BASE ==============
#myhostname =
#mydomain = example.com
home_mailbox = maildir/
#mydestination = $myhostname
#local_recipient_maps =
#======= MYSQL =============
virtual_gid_maps = static:80
virtual_mailbox_base = /usr/local/virtual/
virtual_uid_maps = static:80
virtual_minimum_uid = 80
virtual_alias_maps = mysql:/usr/local/etc/postfix/mysql/virtual_alias_maps.cf
virtual_mailbox_domains = mysql:/usr/local/etc/postfix/mysql/virtual_domains_maps.cf
virtual_mailbox_maps = mysql:/usr/local/etc/postfix/mysql/virtual_mailbox_maps.cf
#======= Quota ============
message_size_limit = 5242880
virtual_mailbox_limit_inbox = no
virtual_mailbox_limit_override = yes
virtual_maildir_extended = yes
virtual_create_maildirsize = yes
virtual_mailbox_limit_maps = mysql:/usr/local/etc/postfix/mysql/virtual_mailbox_limit_maps.cf
virtual_mailbox_limit = 52428800
#======== SASL ================
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients=yes
smtpd_recipient_restrictions = permit_sasl_authenticated permit_auth_destination reject
#smtpd_sasl_local_domain = $mydomain
smtpd_client_restrictions = permit_sasl_authenticated
#============AMVISD=============
content_filter = smtp-amavis:[127.0.0.1]:10024
inet_protocols = ipv4

Part of config.inc.php for PostfixAdmin.
Code:
<?php
/**
 * Postfix Admin
 *
 * LICENSE
 * This source file is subject to the GPL license that is bundled with
 * this package in the file LICENSE.TXT.
 *
 * Further details on the project are available at :
 *     http://www.postfixadmin.com or http://postfixadmin.sf.net
 *
 * @version $Id: config.inc.php 935 2011-01-02 21:33:13Z christian_boltz $
 * @license GNU GPL v2 or later.
 *
 * File: config.inc.php
 * Contains configuration options.
 */

/*****************************************************************
 *  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 * You have to set $CONF['configured'] = true; before the
 * application will run!
 * Doing this implies you have changed this file as required.
 * i.e. configuring database etc; specifying setup.php password etc.
 */
$CONF['configured'] = true;

// In order to setup Postfixadmin, you MUST specify a hashed password here.
// To create the hash, visit setup.php in a browser and type a password into the field,
// on submission it will be echoed out to you as a hashed value.
$CONF['setup_password'] = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';

// Postfix Admin Path
// Set the location of your Postfix Admin installation here.
// YOU MUST ENTER THE COMPLETE URL e.g. http://domain.tld/postfixadmin
$CONF['postfix_admin_url'] = '';

// shouldn't need changing.
$CONF['postfix_admin_path'] = dirname(__FILE__);

// Language config
// Language files are located in './languages', change as required..
$CONF['default_language'] = 'en';

// Database Config
// mysql = MySQL 3.23 and 4.0, 4.1 or 5
// mysqli = MySQL 4.1+
// pgsql = PostgreSQL
$CONF['database_type'] = 'mysqli';
$CONF['database_host'] = 'localhost';
$CONF['database_user'] = 'postfix';
$CONF['database_password'] = 'postfix';
$CONF['database_name'] = 'postfix';
// If you need to specify a different port for a MYSQL database connection, use e.g.
//   $CONF['database_host'] = '172.30.33.66:3308';
// If you need to specify a different port for POSTGRESQL database connection
//   uncomment and change the following
// $CONF['database_port'] = '5432';
 
Hi,

The other two (rights of the folder and PostfixAdmin configuration)?

BTW, why are you using 80 (www) for GID/UID? Better, create a different user like vmail whose home directory is your virtual mailbox base, with password, instead of changing a "system" user like www.
 
Yes, Postfixadmin in /usr/local/www, and the GID/UID is www.

Everything is very good when php5.3 and orgin mail domain:mail.xxx.xxx.xxx.
but after upgrade 9.0 to be 9.1, that is php5.4 and change mail.xxx.xxx.xxx to be mail2.xxx.xxx.xxx for some reason. Everything quite different.
 
Hi,

I wanted to see the Mailboxes part from your PostfixAdmin configuration, like:

Code:
$CONF['domain_path'] = 'YES';
$CONF['domain_in_mailbox'] = 'NO';

Also your mailbox base /usr/local/virtual/ should be owned to www:www.
However, check (and/or paste here) your http://your_postfix_admin/setup.php for dependencies and if everything is OK with the PostfixAdmin setup. For example if you don't have imap extention in your PHP, you will not able to create folders (unless you are not using pure shell scripts from the ADDITIONS folder which uses maildirmake for creating folders structure).
 
quintessence said:
Hi,

I wanted to see the Mailboxes part from your PostfixAdmin configuration, like:

Code:
$CONF['domain_path'] = 'YES';
$CONF['domain_in_mailbox'] = 'NO';

Also your mailbox base /usr/local/virtual/ should be owned to www:www.
However, check (and/or paste here) your http://your_postfix_admin/setup.php for dependencies and if everything is OK with the PostfixAdmin setup. For example if you don't have imap extention in your PHP, you will not able to create folders (unless you are not using pure shell scripts from the ADDITIONS folder which uses maildirmake for creating folders structure).

Thanks! The part is:

Code:
// Mailboxes
// If you want to store the mailboxes per domain set this to 'YES'.
// Examples:
//   YES: /usr/local/virtual/domain.tld/username@domain.tld
//   NO:  /usr/local/virtual/username@domain.tld
$CONF['domain_path'] = 'YES';
// If you don't want to have the domain in your mailbox set this to 'NO'.
// Examples:
//   YES: /usr/local/virtual/domain.tld/username@domain.tld
//   NO:  /usr/local/virtual/domain.tld/username
// Note: If $CONF['domain_path'] is set to NO, this setting will be forced to YE
S.
$CONF['domain_in_mailbox'] = 'NO';
// If you want to define your own function to generate a maildir path set this t
o the name of the function.
// Notes:
//   - this configuration directive will override both domain_path and domain_in
_mailbox
//   - the maildir_name_hook() function example is present below, commented out
//   - if the function does not exist the program will default to the above doma
in_path and domain_in_mailbox settings
$CONF['maildir_name_hook'] = 'NO';

and cd /usr/local/www && ls -al

Code:
:
drwxr-xr-x  13 root  wheel   512 Oct  3 15:58 ./
drwxr-xr-x  15 root  wheel   512 Oct  2 14:23 ../
lrwxr-xr-x   1 root  wheel    13 Nov  1  2008 apache22@ -> xxx.xxx.xxx.xxx
drwxr-xr-x   2 root  wheel   512 Jan 17  2012 cgi-bin/
drwxr-xr-x   6 root  wheel   512 Sep 30 15:36 xxx.xxx.xxx.xxx/
drwxr-xr-x   3 root  wheel   512 Jan 17  2012 icons/
drwxr-xr-x   2 root  wheel  2560 Oct  1 19:50 mrtg/
drwxr-xr-x   9 root  wheel  3072 Sep 30 10:59 phpMyAdmin/
-rw-r--r--   1 root  wheel    20 Nov 29  2009 phpinfo.php
drwxr-xr-x  11 www   www    1536 Oct  3 15:58 postfixadmin/
drwxr-xr-x  14 root  wheel   512 Oct  1 06:23 squirrelmail/
drwxr-xr-x  21 root  wheel  8704 Nov 30  2009 webERP/

and setup.php

Code:
/**
 * Postfix Admin
 *
 * LICENSE
 * This source file is subject to the GPL license that is bundled with
 * this package in the file LICENSE.TXT.
 *
 * Further details on the project are available at :
 *     http://www.postfixadmin.com or http://postfixadmin.sf.net
 *
 * @version $Id: setup.php 1405 2012-06-30 11:07:57Z christian_boltz $
 * @license GNU GPL v2 or later.
 *
 * File: setup.php
 * Used to help ensure a server is setup appropriately during installation/setup
.
 * After setup, it should be renamed or removed.
 *
 * Template File: -none-
 *
 * Template Variables: -none-
 *
 * Form POST \ GET Variables: -none-
 */

define('POSTFIXADMIN', 1); # by defining it here, common.php will not start a se
ssion.

require_once(dirname(__FILE__).'/common.php'); # make sure correct common.php is
 used.

$CONF['show_header_text'] = 'NO';
$CONF['theme_logo'] = 'images/logo-default.png';
$CONF['theme_css'] = 'css/default.css';
require($incpath.'/templates/header.php');
?>

<div class='setup'>
<h2>Postfix Admin Setup Checker</h2>

<p>Running software:
<ul>
<?php
//
// Check for availablilty functions
//
$f_phpversion = function_exists ("phpversion");
$f_apache_get_version = function_exists ("apache_get_version");
$f_get_magic_quotes_gpc = function_exists ("get_magic_quotes_gpc");
$f_mysql_connect = function_exists ("mysql_connect");
$f_mysqli_connect = function_exists ("mysqli_connect");
$f_pg_connect = function_exists ("pg_connect");
$f_session_start = function_exists ("session_start");
$f_preg_match = function_exists ("preg_match");
$f_mb_encode_mimeheader = function_exists ("mb_encode_mimeheader");
$f_imap_open = function_exists ("imap_open");

$file_config = file_exists (realpath ("./config.inc.php"));

$error = 0;

//
// Check for PHP version
//
if ($f_phpversion == 1)
{
    if (phpversion() < 5) {
        print "<li><b>Error: Depends on: PHP v5</b>
</li>\n";
        $error += 1;
    }
    if (phpversion() >= 5) {
        $phpversion = 5;
        print "<li>PHP version " . phpversion () . "</li>\n";
    }
}
else
{
    print "<li><b>Unable to check for PHP version. (missing function: phpversion
())</b></li>\n";
}

//
// Check for Apache version
//
if ($f_apache_get_version == 1)
{
    print "<li>" . apache_get_version() . "</li>\n";
}
else
{
    # not running on Apache.
    # However postfixadmin _is_ running, so obviously we are on a supported webs
erver ;-))
    # No need to confuse the user with a warning.
}

print "</ul>";
print "<p>Checking for dependencies:\n";
print "<ul>\n";

//
// Check for Magic Quotes
//
if ($f_get_magic_quotes_gpc == 1)
{
    if (get_magic_quotes_gpc () == 0)
    {
        print "<li>Magic Quotes: Disabled - OK</li>\n";
    }
    else
    {
        print "<li><b>Warning: Magic Quotes: ON (internal workaround used)</b></
li>\n";
    }
}
else
{
    print "<li><b>Unable to check for Magic Quotes. (missing function: get_magic
_quotes_gpc())</b></li>\n";
}

//
// Check for config.inc.php
//
$config_loaded = 0;
if ($file_config == 1)
{
    print "<li>Depends on: presence config.inc.php - OK</li>\n";
    require_once($incpath.'/config.inc.php');
    $config_loaded = 1;

    if(isset($CONF['configured'])) {
        if($CONF['configured'] === TRUE) {
            print "<li>Checking \$CONF['configured'] - OK\n";
        } else {
            print "<li><b>Warning: \$CONF['configured'] is 'false'.
\n";
            print "You must edit your config.inc.php and change this to true (th
is indicates you've created the database and user)</b>\n";
        }
    }
}
else
{
    print "<li><b>Error: Depends on: presence config.inc.php - NOT FOUND</b>
</li>\n";
    print "Create the file, and edit as appropriate (e.g. select database type e
tc)
";
    print "For example:
\n";
    print "<code><pre>cp config.inc.php.sample config.inc.php</pre></code>\n";
    $error =+ 1;
}

//
// Check if there is support for at least 1 database
//
if (($f_mysql_connect == 0) and ($f_mysqli_connect == 0) and ($f_pg_connect == 0
))
{
    print "<li><b>Error: There is no database support in your PHP setup</b><br /
>\n";
    print "To install MySQL 3.23 or 4.0 support on FreeBSD:
\n";
    print "<pre>% cd /usr/ports/databases/php$phpversion-mysql/\n";
    print "% make clean install\n";
    print " - or with portupgrade -\n";
    print "% portinstall php$phpversion-mysql</pre>\n";
    if ($phpversion >= 5)
    {
        print "To install MySQL 4.1 support on FreeBSD:
\n";
        print "<pre>% cd /usr/ports/databases/php5-mysqli/\n";
        print "% make clean install\n";
        print " - or with portupgrade -\n";
        print "% portinstall php5-mysqli</pre>\n";
    }
    print "To install PostgreSQL support on FreeBSD:
\n";
    print "<pre>% cd /usr/ports/databases/php$phpversion-pgsql/\n";
    print "% make clean install\n";
    print " - or with portupgrade -\n";
    print "% portinstall php$phpversion-pgsql</pre></li>\n";
    $error =+ 1;
}
//
// MySQL 3.23, 4.0 functions
//
if ($f_mysql_connect == 1)
{
    print "<li>Depends on: MySQL 3.23, 4.0 - OK</li>\n";
}

//
// MySQL 4.1 functions
//
if ($phpversion >= 5)
{
    if ($f_mysqli_connect == 1)
    {
        print "<li>Depends on: MySQL 4.1 - OK\n";
        if ( !($config_loaded && $CONF['database_type'] == 'mysqli') ) {
            print "(change the database_type to 'mysqli' in config.inc.php!!)\n"
;
        }
        print "</li>";
    }
}

//
// PostgreSQL functions
//
if ($f_pg_connect == 1)
{
    print "<li>Depends on: PostgreSQL - OK \n";
    if ( !($config_loaded && $CONF['database_type'] == 'pgsql') ) {
        print "(change the database_type to 'pgsql' in config.inc.php!!)\n";
    }
    print "</li>";
}

//
// Database connection
//
if ($config_loaded) {
    list ($link, $error_text) = db_connect(TRUE);
    if ($error_text == "") {
        print "<li>Testing database connection - OK - {$CONF['database_type']}:/
/{$CONF['database_user']}:xxxxx@{$CONF['database_host']}/{$CONF['database_name']
}</li>";
    } else {
        print "<li><b>Error: Can't connect to database</b>
\n";
        print "Please edit the \$CONF['database_*'] parameters in config.inc.php
    $error =+ 1;
}

    } elseif ($pass == $setuppw && $lostpw_mode == 0) { # correct passsword (and
 not asking for a new password)
        $result = "pass_OK";
        $error = 0;
    } else {
        $pass = encrypt_setup_password($password, generate_setup_password_salt()
);
        $result = "";
        if ($lostpw_mode == 1) {
            $error = 0; # non-matching password is expected when the user asks f
or a new password
        } else {
            $result = '<p><b>Setup password not specified correctly</b></p>';
        }
        $result .= '<p>If you want to use the password you entered as setup pass
word, edit config.inc.php and set</p>';
        $result .= "<pre>\$CONF['setup_password'] = '$pass';</pre>";
    }
    return array ($error, $result);
}

/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */
?>

and PHP modules:

Code:
 # pkg info | grep php5
php5-5.4.20                    PHP Scripting Language
php5-ctype-5.4.20              The ctype shared extension for php
php5-dom-5.4.20                The dom shared extension for php
php5-exif-5.4.20               The exif shared extension for php
php5-extensions-1.7            A "meta-port" to install PHP extensions
php5-filter-5.4.20             The filter shared extension for php
php5-ftp-5.4.20                The ftp shared extension for php
php5-gd-5.4.20                 The gd shared extension for php
php5-gettext-5.4.20            The gettext shared extension for php
php5-hash-5.4.20               The hash shared extension for php
php5-iconv-5.4.20              The iconv shared extension for php
php5-imap-5.4.20               The imap shared extension for php
php5-json-5.4.20               The json shared extension for php
php5-mbstring-5.4.20           The mbstring shared extension for php
php5-mysql-5.4.20              The mysql shared extension for php
php5-mysqli-5.4.20             The mysqli shared extension for php
php5-pdo-5.4.20                The pdo shared extension for php
php5-pdo_mysql-5.4.20          The pdo_mysql shared extension for php
php5-phar-5.4.20               The phar shared extension for php
php5-posix-5.4.20              The posix shared extension for php
php5-session-5.4.20            The session shared extension for php
php5-simplexml-5.4.20          The simplexml shared extension for php
php5-sqlite3-5.4.20            The sqlite3 shared extension for php
php5-tokenizer-5.4.20          The tokenizer shared extension for php
php5-xml-5.4.20                The xml shared extension for php
php5-xmlreader-5.4.20          The xmlreader shared extension for php
php5-xmlrpc-5.4.20             The xmlrpc shared extension for php
php5-xmlwriter-5.4.20          The xmlwriter shared extension for php
php5-zip-5.4.20                The zip shared extension for php
php5-zlib-5.4.20               The zlib shared extension for php
 
quintessence said:
Hi,
When you open in your browser http://your_postfix_admin/setup.php does everything seem to be ok?

Yes.

Code:
Postfix Admin Setup Checker

Running software:

    PHP version 5.4.20
    Apache/2.2.25 (FreeBSD) PHP/5.4.20 mod_ssl/2.2.25 OpenSSL/0.9.8y DAV/2

Checking for dependencies:

    Magic Quotes: Disabled - OK
    Depends on: presence config.inc.php - OK
    Checking $CONF['configured'] - OK
    Depends on: MySQL 3.23, 4.0 - OK
    Depends on: MySQL 4.1 - OK
    Testing database connection - OK - mysqli://postfix:xxxxx@localhost/postfix
    Depends on: session - OK
    Depends on: pcre - OK
    Depends on: multibyte string - OK
    Depends on: IMAP functions - OK

Everything seems fine... attempting to create/update database structure

Database is up to date
 
Hi,

When you create a virtual domain or mailbox, is everything going in the databases correctly? Also make sure /usr/local/virtual/ is owned by www:www.
 
quintessence said:
Hi,

When you create virtual domain or mailbox, is everything goes in the databases correctly?
Also make sure /usr/local/virtual/ is owned by www:www.

Yes, no any error messages regarding MySQL and UID/GID of virtual is www:www.

MySQL has been double-checked, all data by PostfixAdmin are saved correctly.
 
Thanks you all. I don't know why, just a fresh install of PostfixAdmin. PostfixAdmin can set[]up domains and users in virtual/ right now.
 
Can you check in your master.passwd the entries for www user is it same as before upgrade FreeBSD? If your user is not able to go into the virtual folder, you will not able to create folders in it. And if you see in your domains table in MySQL your inserted virtual domain via the PostfixAdmin, your problem is the user. Because of that usually you should not use system user for that purpose.
# su -m www -c 'cd /usr/local/virtual; pwd'
 
Back
Top