function popup()
{
    $ldap = new clladp();
    $cyruspass = $ldap->CyrusPassword();
    $html = "<H1>{cyrus password}</H1>\n\t<div id='change_cyrus_password'>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td valign='top' width=1%><img src='img/cyrus-password-120.png'></td>\n\t\t<td valign='top'><p class=caption>{change_cyrus_password}</p>\n\t\t<br>" . RoundedLightWhite("\n\t\t\t<table style='width:99%'>\n\t\t\t<tr>\n\t\t\t\t<td class=legend>{password}:</td>\n\t\t\t\t<td>" . Field_password('cyruspassword', $cyruspass) . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td colspan=2 align='right'><hr><input type='button' Onclick=\"javascript:SaveCyrusPassword();\" value='{edit}&nbsp;'></td>\n\t\t\t</tr>\n\t\t</table>") . "\n\t\t</td>\n\t\t</tr>\n\t\t</table></div>";
    $tp = new templates();
    echo $tp->_ENGINE_parse_body($html, 'cyrus.index.php');
}
function popup()
{
    $ldap = new clladp();
    $cyruspass = $ldap->CyrusPassword();
    $html = "\n\t<div id='change_cyrus_password' style='width:98%' class=form>\n\t<div class=text-info style='font-size:16px'>{change_cyrus_password}</div>\n\t<table style='width:99%'>\n\t<tr>\n\t<td class=legend style='font-size:16px'>{password}:</td>\n\t<td>" . Field_password('cyruspassword', $cyruspass, "font-size:16px") . "</td>\n\t</tr>\n\t<tr>\n\t<td colspan=2 align='right'><hr>\n\t\t" . button("{apply}", "SaveCyrusPassword()", "22px") . "</td>\n\t</tr>\n\t</table>\n\t</div>";
    $tp = new templates();
    echo $tp->_ENGINE_parse_body($html, 'cyrus.index.php');
}
function build_cyrus_lmtp_auth()
{
    $users = new usersMenus();
    $disable = false;
    if ($users->ZABBIX_INSTALLED) {
        $disable = true;
    } else {
        if (!$users->cyrus_imapd_installed) {
            $disable = true;
        }
    }
    if ($disable) {
        shell_exec("{$GLOBALS["postconf"]} -e \"lmtp_sasl_auth_enable =no\" >/dev/null 2>&1");
        shell_exec("{$GLOBALS["postconf"]} -e \"lmtp_sasl_password_maps =\" >/dev/null 2>&1");
        shell_exec("{$GLOBALS["postconf"]} -e \"lmtp_sasl_security_options =\" >/dev/null 2>&1");
        return;
    }
    $sock = new sockets();
    $page = CurrentPageName();
    $CyrusEnableLMTPUnix = $sock->GET_INFO("CyrusEnableLMTPUnix");
    if ($CyrusEnableLMTPUnix == 1) {
        shell_exec("{$GLOBALS["postconf"]} -e \"lmtp_sasl_auth_enable =no\" >/dev/null 2>&1");
        shell_exec("{$GLOBALS["postconf"]} -e \"lmtp_sasl_password_maps =\" >/dev/null 2>&1");
        shell_exec("{$GLOBALS["postconf"]} -e \"lmtp_sasl_security_options =\" >/dev/null 2>&1");
    } else {
        $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 >/dev/null 2>&1");
        shell_exec("{$GLOBALS["postconf"]} -e \"lmtp_sasl_auth_enable =yes\" >/dev/null 2>&1");
        shell_exec("{$GLOBALS["postconf"]} -e \"lmtp_sasl_password_maps = hash:/etc/postfix/lmtpauth\" >/dev/null 2>&1");
        shell_exec("{$GLOBALS["postconf"]} -e \"lmtp_sasl_mechanism_filter = plain, login\" >/dev/null 2>&1");
        shell_exec("{$GLOBALS["postconf"]} -e \"lmtp_sasl_security_options =\" >/dev/null 2>&1");
    }
}
if (!CheckBranch()) {
    die;
}
CheckCyrusByDomains();
if (trim($username) == null) {
    writelogs("No username specified...", __FUNCTION__, __FILE__, __LINE__);
    die;
}
$ldap = new clladp();
if ($ldap->ldapFailed) {
    writelogs('Unable to logon to ldap server...', __FUNCTION__, __FILE__, __LINE__);
    die;
}
$users = new usersMenus();
$cyrus_text_password = $users->cyrus_ldap_admin_password;
$cyrus_password = $ldap->CyrusPassword();
if ($cyrus_password != $cyrus_text_password) {
    writelogs('Cyrus password did not match, modify it...', __FUNCTION__, __FILE__, __LINE__);
    if (!ChangeCyrusPassword("cyrus", $cyrus_text_password)) {
        return false;
    }
    $cyrus_password = $cyrus_text_password;
}
ChangeCyrusPassword($username, $cyrus_password);
UpdateMurderUser($cyrus_password);
function ChangeCyrusPassword($username, $password)
{
    $ldap = new clladp();
    if (strlen($password) == 0) {
        writelogs('ChangeCyrusPassword():: No password specified', __FUNCTION__, __FILE__, __LINE__);
        return false;
Exemple #5
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();
    $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();
    }
}
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");
    }
}
Exemple #8
0
function delete_mailbox($user)
{
    $sock = new sockets();
    $cyradm = "cyrus";
    $CyrusEnableImapMurderedFrontEnd = $sock->GET_INFO("CyrusEnableImapMurderedFrontEnd");
    if ($CyrusEnableImapMurderedFrontEnd == 1) {
        shell_exec("/usr/share/artica-postfix/bin/artica-install --delete-mailbox {$user}");
        return;
    }
    $ldap = new clladp();
    $cyruspass = $ldap->CyrusPassword();
    if (preg_match("#(.+?)@(.+)#", $user, $re)) {
        $cyradm = "{$cyradm}@{$re[2]}";
        $user = $re[1];
    }
    $cmd = "/usr/share/artica-postfix/bin/cyrus-admin.pl -u cyrus -p \"{$cyruspass}\" -m \"{$user}\" --delete 2>&1";
    exec($cmd, $results);
}