Example #1
0
function smtpd_sasl_auth_enable()
{
    $main = new main_cf();
    $clientRestriction = new smtpd_restrictions();
    //smtpd_recipient_restrictions
    if ($_GET["smtpd_sasl_auth_enable"] == "no") {
        $clientRestriction->DeleteKey("permit_sasl_authenticated", "smtpd_recipient_restrictions");
    }
    if ($_GET["smtpd_sasl_auth_enable"] == "yes") {
        $clientRestriction->AddKey("permit_sasl_authenticated", 'smtpd_recipient_restrictions');
        $clientRestriction->AddKey("reject_unauth_destination", 'smtpd_recipient_restrictions');
    }
    $main->main_array["smtp_sender_dependent_authentication"] = $_GET["smtp_sender_dependent_authentication"];
    $main->main_array["smtpd_sasl_auth_enable"] = $_GET["smtpd_sasl_auth_enable"];
    $main->main_array["smtpd_sasl_authenticated_header"] = $_GET["smtpd_sasl_authenticated_header"];
    $main->save_conf();
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body('{success}');
}
function TreeSmtpd_client_restrictions_deleterule()
{
    $mny = new usersMenus();
    $tpl = new templates();
    $main = new smtpd_restrictions();
    $pages = new HtmlPages();
    if ($mny->AsPostfixAdministrator == false) {
        echo $tpl->_ENGINE_parse_body('{no_privileges');
        exit;
    }
    switch ($_GET["Sender"]) {
        case 1:
            unset($main->SenderArray[$_GET["TreeSmtpd_client_restrictions_deleterule"]]);
            $main->save_smtpd_sender_restrictions();
            break;
        case 0:
            unset($main->ClientArray[$_GET["TreeSmtpd_client_restrictions_deleterule"]]);
            $main->save_smtpd_client_restrictions();
            break;
        case 2:
            writelogs("unset RecipientArray(" . $_GET["TreeSmtpd_client_restrictions_deleterule"] . ")", __FUNCTION__, __FILE__);
            unset($main->RecipientArray[$_GET["TreeSmtpd_client_restrictions_deleterule"]]);
            $main->save_smtpd_recipient_restrictions();
            break;
        case 3:
            writelogs("unset HelloArray(" . $_GET["TreeSmtpd_client_restrictions_deleterule"] . ")", __FUNCTION__, __FILE__);
            unset($main->HelloArray[$_GET["TreeSmtpd_client_restrictions_deleterule"]]);
            $main->save_smtpd_helo_restrictions();
            break;
        default:
            unset($main->ClientArray[$_GET["TreeSmtpd_client_restrictions_deleterule"]]);
            $main->save_smtpd_client_restrictions();
            break;
    }
    if ($pages->AutomaticConfig == true) {
        $main->save_conf_to_server();
    }
    echo DIV_SHADOW($pages->PagePostfixsmtpd_client_restrictions_table(0, $_GET["Sender"]), 'windows');
}
Example #3
0
function sasl_save()
{
    if ($_GET["PostfixEnableSubmission"] == 1) {
        $_GET["save_auth"] = 1;
    }
    $main = new main_cf();
    $socks = new sockets();
    $socks->SET_INFO('PostfixEnableSubmission', $_GET["PostfixEnableSubmission"]);
    if ($_GET["save_auth"] == 1) {
        $main->main_array["smtpd_sasl_auth_enable"] = "yes";
        $main->main_array["smtpd_use_tls"] = "yes";
        $main->main_array["smtpd_sasl_path"] = "smtpd";
        $main->main_array["smtpd_tls_session_cache_database"] = "btree:\$queue_directory/smtpd_tls_cache ";
        if ($main->main_array["smtpd_tls_key_file"] == null) {
            $main->main_array["smtpd_tls_key_file"] = "/etc/ssl/certs/postfix/ca.key";
        }
        if ($main->main_array["smtpd_tls_cert_file"] == null) {
            $main->main_array["smtpd_tls_cert_file"] = "/etc/ssl/certs/postfix/ca.crt";
        }
        if ($main->main_array["smtpd_tls_CAfile"] == null) {
            $main->main_array["smtpd_tls_CAfile"] = "/etc/ssl/certs/postfix/ca.csr";
        }
        if ($main->main_array["smtpd_tls_session_cache_timeout"] == null) {
            $main->main_array["smtpd_tls_session_cache_timeout"] = "3600s";
        }
        $socks->SET_INFO('PostFixSmtpSaslEnable', '1');
        $mainr = new smtpd_restrictions();
        $mainr->AddKey("permit_mynetworks", "smtpd_recipient_restrictions");
        $mainr->AddKey("permit_sasl_authenticated", "smtpd_recipient_restrictions");
        $mainr->AddKey("reject_unauth_destination", "smtpd_recipient_restrictions");
    } else {
        $main->main_array["smtpd_sasl_auth_enable"] = "no";
        $main->main_array["smtpd_use_tls"] = "no";
        $main->main_array["smtpd_tls_auth_only"] = "no";
        $mainr = new smtpd_restrictions();
        $socks->SET_INFO('PostFixSmtpSaslEnable', '0');
        $mainr->DeleteKey("permit_sasl_authenticated", "smtpd_recipient_restrictions");
    }
    $main->save_conf();
    $main->save_conf_to_server();
}
function PostFixClassRestrictionGenerateConfig()
{
    $main = new smtpd_restrictions();
    $datas = $main->Build();
    $datas1 = nl2br($datas);
    if (preg_match('#bind_pw([\\s=]+)([0-9\\w\\*\\-\\#\\%\\?\\&\\~\\$]+)#s', $datas1, $regs)) {
        $paswd = $regs[2];
        $datas1 = str_replace($paswd, '****', $datas1);
    }
    $datas1 = str_replace(",", ", ", $datas1);
    echo RoundedLightWhite("<div style='padding:20px;font-size:10px;overflow:auto;height:300px'><code>{$datas1}</code></div>");
}