function MailBoxTransport()
{
    $main = new maincf_multi();
    $sock = new sockets();
    $users = new usersMenus();
    $default = $main->getMailBoxTransport();
    system("{$GLOBALS["postconf"]} -e \"zarafa_destination_recipient_limit = 1\" >/dev/null 2>&1");
    system("{$GLOBALS["postconf"]} -e \"mailbox_transport = {$default}\" >/dev/null 2>&1");
    if (preg_match("#lmtp:(.+?):[0-9]+#", $default)) {
        if (!$users->ZARAFA_INSTALLED) {
            if (!$users->cyrus_imapd_installed) {
                disable_lmtp_sasl();
                return null;
            }
            echo "Starting......: Postfix LMTP is enabled {$default}\n";
            $ldap = new clladp();
            $CyrusLMTPListen = trim($sock->GET_INFO("CyrusLMTPListen"));
            $cyruspass = $ldap->CyrusPassword();
            @file_put_contents("/etc/postfix/lmtpauth", "{$CyrusLMTPListen}\tcyrus:{$cyruspass}");
            shell_exec("{$GLOBALS["postmap"]} hash:/etc/postfix/lmtpauth");
            system("{$GLOBALS["postconf"]} -e \"lmtp_sasl_auth_enable = yes\" >/dev/null 2>&1");
            system("{$GLOBALS["postconf"]} -e \"lmtp_sasl_password_maps = hash:/etc/postfix/lmtpauth\" >/dev/null 2>&1");
            system("{$GLOBALS["postconf"]} -e \"lmtp_sasl_mechanism_filter = plain, login\" >/dev/null 2>&1");
            system("{$GLOBALS["postconf"]} -e \"lmtp_sasl_security_options =\" >/dev/null 2>&1");
        }
    } else {
        disable_lmtp_sasl();
    }
}
Example #2
0
function MailBoxTransport()
{
    $main = new maincf_multi();
    if (!isset($GLOBALS["CLASS_SOCKET"])) {
        $GLOBALS["CLASS_SOCKET"] = new sockets();
        $sock = $GLOBALS["CLASS_SOCKET"];
    } else {
        $sock = $GLOBALS["CLASS_SOCKET"];
    }
    if (!isset($GLOBALS["CLASS_USERS_MENUS"])) {
        $users = new usersMenus();
        $GLOBALS["CLASS_USERS_MENUS"] = $users;
    } else {
        $users = $GLOBALS["CLASS_USERS_MENUS"];
    }
    $default = $main->getMailBoxTransport();
    postconf("zarafa_destination_recipient_limit", 1);
    echo "Starting......: Postfix mailbox_transport {$default}\n";
    postconf("mailbox_transport", $default);
    system("{$GLOBALS["postconf"]} -e \"zarafa_destination_recipient_limit = 1\" >/dev/null 2>&1");
    if (preg_match("#lmtp:(.+?):[0-9]+#", $default)) {
        if (!$users->ZARAFA_INSTALLED) {
            if (!$users->cyrus_imapd_installed) {
                echo "Starting......: Postfix None of Zarafa or cyrus imap installed on this server\n";
                disable_lmtp_sasl();
                return null;
            }
            echo "Starting......: Postfix \"LMTP\" is enabled ({$default})\n";
            $ldap = new clladp();
            $CyrusLMTPListen = trim($sock->GET_INFO("CyrusLMTPListen"));
            $cyruspass = $ldap->CyrusPassword();
            if ($CyrusLMTPListen != null) {
                @file_put_contents("/etc/postfix/lmtpauth", "{$CyrusLMTPListen}\tcyrus:{$cyruspass}");
                shell_exec("{$GLOBALS["postmap"]} hash:/etc/postfix/lmtpauth");
                postconf("lmtp_sasl_auth_enable", "yes");
                postconf("lmtp_sasl_password_maps", "hash:/etc/postfix/lmtpauth");
                postconf("lmtp_sasl_mechanism_filter", "plain, login");
                postconf("lmtp_sasl_security_options", null);
            }
        }
    } else {
        disable_lmtp_sasl();
    }
}
function MailBoxTransport()
{
    $main = new maincf_multi("master", "master");
    if (!isset($GLOBALS["CLASS_SOCKET"])) {
        $GLOBALS["CLASS_SOCKET"] = new sockets();
        $sock = $GLOBALS["CLASS_SOCKET"];
    } else {
        $sock = $GLOBALS["CLASS_SOCKET"];
    }
    if (!isset($GLOBALS["CLASS_USERS_MENUS"])) {
        $users = new usersMenus();
        $GLOBALS["CLASS_USERS_MENUS"] = $users;
    } else {
        $users = $GLOBALS["CLASS_USERS_MENUS"];
    }
    echo "Starting......: " . date("H:i:s") . " Postfix get mailbox transport\n";
    $mailbox_transport = trim($main->GET("mailbox_transport"));
    echo "Starting......: " . date("H:i:s") . " Postfix get mailbox transport = \"{$mailbox_transport}\"\n";
    if ($mailbox_transport != null) {
        postconf("mailbox_transport", $mailbox_transport);
        postconf("zarafa_destination_recipient_limit", 1);
        return;
    }
    $default = $main->getMailBoxTransport();
    if ($default == null) {
        postconf_X("mailbox_transport");
        postconf_X("virtual_transport");
        return;
    }
    postconf("zarafa_destination_recipient_limit", 1);
    echo "Starting......: " . date("H:i:s") . " Postfix mailbox_transport=`{$default}`\n";
    postconf("mailbox_transport", $default);
    postconf("virtual_transport", "\$mailbox_transport");
    postconf("local_transport", "local");
    postconf("lmtp_sasl_auth_enable", "no");
    postconf("lmtp_sasl_password_maps", "");
    postconf("lmtp_sasl_mechanism_filter", "plain, login");
    postconf("lmtp_sasl_security_options", null);
    if (!$users->ZARAFA_INSTALLED) {
        if (!$users->cyrus_imapd_installed) {
            echo "Starting......: " . date("H:i:s") . " Postfix None of Zarafa or cyrus imap installed on this server\n";
            return null;
        }
    }
    if (preg_match("#lmtp:(.+?):([0-9]+)#", $default, $re)) {
        echo "Starting......: " . date("H:i:s") . " Postfix \"LMTP\" is enabled ({$default})\n";
        $ldap = new clladp();
        $CyrusLMTPListen = $re[1] . ":" . $re[2];
        $cyruspass = $ldap->CyrusPassword();
        @file_put_contents("/etc/postfix/lmtpauth", "{$CyrusLMTPListen}\tcyrus:{$cyruspass}");
        shell_exec("{$GLOBALS["postmap"]} hash:/etc/postfix/lmtpauth");
        postconf("lmtp_sasl_auth_enable", "yes");
        postconf("lmtp_sasl_password_maps", "hash:/etc/postfix/lmtpauth");
        postconf("lmtp_sasl_mechanism_filter", "plain, login");
        postconf("lmtp_sasl_security_options", "noanonymous");
    }
}