Beispiel #1
0
function mysql_action_enable_change()
{
    $enable = $_GET["changemysqlenable"];
    $artica = new artica_general();
    $artica->EnableMysqlFeatures = $enable;
    if ($enable == 0) {
        $main = new main_cf();
        $main->save_conf();
        $main->save_conf_to_server();
    }
    $artica->SaveMysqlSettings();
    $sock = new sockets();
    $datas = $sock->getfile('restartmysql');
    $datas = htmlentities($datas);
    $tbl = explode("\n", $datas);
    $datas = '';
    while (list($num, $val) = each($tbl)) {
        $datas = $datas . "<div>{$val}</div>";
    }
    echo "<div style='width:100%;height:500px;overflow:auto'>{$datas}</div>";
}
Beispiel #2
0
function bundle_save()
{
    $sock = new sockets();
    $name = $_GET["bundle_save"];
    $enable = $_GET["bundle_enable"];
    if ($name == "kasper") {
        if ($enable == "no") {
            writelogs("DISABLE KASPERSKY", __FUNCTION__, __FILE__);
            $artica = new artica_general();
            $artica->KasxFilterEnabled = 0;
            $artica->kavmilterEnable = 0;
            $artica->Save();
            $main = new main_cf();
            $main->save_conf();
            $main->save_conf_to_server();
        } else {
            $artica = new artica_general();
            $artica->KasxFilterEnabled = 1;
            $artica->kavmilterEnable = 1;
            $artica->Save();
            $main = new main_cf();
            $main->save_conf();
            $main->save_conf_to_server();
        }
        $tpl = new templates();
        echo $tpl->_ENGINE_parse_body("{enable}:{$enable} ->{success}\n");
        return null;
    }
    if ($name == "amavis") {
        if ($enable == "no") {
            writelogs("DISABLE AMAVIS", __FUNCTION__, __FILE__);
            $sock->SET_INFO("EnableAmavisDaemon", "0");
            $main = new main_cf();
            $main->save_conf();
            $main->save_conf_to_server();
        } else {
            $sock = new sockets();
            $sock->SET_INFO("EnableAmavisDaemon", "1");
            $main = new main_cf();
            $main->save_conf();
            $main->save_conf_to_server();
        }
        $tpl = new templates();
        echo $tpl->_ENGINE_parse_body("{enable}:{$enable} ->{success}\n");
        return null;
    }
    if ($name == "addons") {
        if ($enable == "no") {
            writelogs("DISABLE ADDONS", __FUNCTION__, __FILE__);
            $artica = new artica_general();
            $artica->MilterGreyListEnabled = 0;
            $artica->Save();
            $main = new main_cf();
            $main->save_conf();
            $main->save_conf_to_server();
        } else {
            $artica = new artica_general();
            $artica->MilterGreyListEnabled = 1;
            $artica->Save();
            $main = new main_cf();
            $main->save_conf();
            $main->save_conf_to_server();
        }
        $tpl = new templates();
        echo $tpl->_ENGINE_parse_body("{enable}:{$enable} ->{success}\n");
        return null;
    }
    if ($name == "opensource") {
        $sock = new sockets();
        if ($enable == "no") {
            writelogs("DISABLE opensource", __FUNCTION__, __FILE__);
            $artica = new artica_general();
            $artica->SpamAssMilterEnabled = 0;
            $artica->ClamavMilterEnabled = 0;
            $artica->Save();
            $main = new main_cf();
            $main->save_conf();
            $main->save_conf_to_server();
        } else {
            $artica = new artica_general();
            $sock->SET_INFO("EnableAmavisDaemon", 0);
            $artica->SpamAssMilterEnabled = 1;
            $artica->ClamavMilterEnabled = 1;
            $artica->Save();
            $main = new main_cf();
            $main->save_conf();
            $main->save_conf_to_server();
        }
        $tpl = new templates();
        echo $tpl->_ENGINE_parse_body("{enable}:{$enable} ->{success}\n");
        return null;
    }
}
Beispiel #3
0
function ApplyConfigPostfix()
{
    $users = new usersMenus();
    $users->LoadModulesEnabled();
    $tpl = new templates();
    if ($users->AsPostfixAdministrator == true) {
        //Apply amavis settings if installed
        if ($users->AMAVIS_INSTALLED == 1) {
            if ($users->EnableAmavisDaemon == 1) {
                include_once "ressources/class.amavis.inc";
                $amavis = new amavis();
                $amavis->Save();
                $amavis->SaveToServer();
            }
        }
        //------------------------------------
        $main = new main_cf();
        $main->save_conf();
        if (!$main->save_conf_to_server()) {
            $result = InfosError('postfix_main_settings', '{error}');
            echo $tpl->_ENGINE_parse_body($result);
            return null;
        }
        $filters = new main_header_check();
        $filters->SaveToDaemon();
        if ($users->KAV_MILTER_INSTALLED) {
            if ($users->KAVMILTER_ENABLED == 1) {
                include_once "ressources/class.kavmilterd.inc";
                $kavmilterd = new kavmilterd();
                $kavmilterd->ReBuildAllRules();
                $kavmilterd->SaveToLdap(0, 1);
                $tpl = new templates();
                echo $tpl->_ENGINE_parse_body(Success("aveserver_main_settings"));
            }
        }
        if ($users->AMAVIS_INSTALLED) {
            if ($users->EnableAmavisDaemon == 1) {
                include_once "ressources/class.amavis.inc";
                $amavis = new amavis();
                $amavis->Save();
            }
        }
        if ($users->kas_installed) {
            if ($users->KasxFilterEnabled == 1) {
                include_once "ressources/class.kas-filter.inc";
                $kas = new kas_single();
                $kas->Save();
            }
        }
        $result = Success("postfix_main_settings");
    } else {
        $result = NotAllowed("postfix_main_settings");
    }
    echo $tpl->_ENGINE_parse_body($result);
}
Beispiel #4
0
function ActiveTLSMsgbox_SavePostfix()
{
    $main = new main_cf();
    $main->save_conf();
    $main->save_conf_to_server();
    $html = "<table style='width:100%'>\n\t<tr>\n\t<td width=1% valign='top'><img src='img/ok24.png'></td>\n\t<td><strong>{restarting_postfix}</strong><p class=caption>{you_can_close}</p></td>\n\t</tr>\n\t</table>\n\t";
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body($html);
}
Beispiel #5
0
function apply_popup2()
{
    $amavis = new amavis();
    $amavis->Save();
    $amavis->SaveToServer();
    $main = new main_cf();
    $main->save_conf();
    $main->save_conf_to_server();
}
Beispiel #6
0
function SaveSettings()
{
    echo "<div><code>";
    $ldap = new clladp();
    $usersMenus = new usersMenus();
    $ldap->AddOrganization($_COOKIE["company"]);
    echo "</div></code>";
    echo "<div><code>";
    if (!$usersMenus->cyrus_imapd_installed) {
        $ldap->AddRelayDomain($_COOKIE["company"], $_COOKIE["smtp_domain"], $_COOKIE["smtp_relay"], 25);
    } else {
        $ldap->AddDomainEntity($_COOKIE["company"], $_COOKIE["smtp_domain"]);
    }
    echo "</div></code>";
    echo "<div><code>";
    $users = new user($_COOKIE["username"]);
    $users->mail = "{$_COOKIE["username"]}@{$_COOKIE["smtp_domain"]}";
    $users->password = $_COOKIE["password"];
    $users->ou = $_COOKIE["company"];
    $users->add_user();
    $users->add_alias("root");
    $users->add_alias("mailflt3");
    $users->add_alias("*****@*****.**");
    $users->add_alias("root@{$usersMenus->fqdn}");
    $users->add_alias("postmaster@{$usersMenus->fqdn}");
    $users->add_alias("*****@*****.**");
    $users->add_alias("postmaster");
    echo "</div></code>";
    $sock = new sockets();
    $sock->SET_INFO("PostmasterAdress", $users->mail);
    $sock->SET_INFO("MasterSMTPDomainName", $_COOKIE["smtp_domain"]);
    $sock->SET_INFO("SmtpWizardFinish", 1);
    if ($usersMenus->AMAVIS_INSTALLED) {
        echo "<div><code>";
        include_once "ressources/class.amavis.inc";
        $amavis = new amavis();
        $amavis->Save();
        $sock->SET_INFO("EnableAmavisDaemon", "1");
        $sock->getFrameWork("cmd.php?artica-filter-reload=yes");
        $amavis->SaveToServer();
        echo "</div></code>";
    }
    if ($usersMenus->BIND9_INSTALLED) {
        include_once "ressources/class.bind9.inc";
        include_once "ressources/class.system.network.inc";
        $net = new networking();
        if (is_array($net->arrayNameServers)) {
            $dns = implode("\n", $net->arrayNameServers);
            $sock->SaveConfigFile($dns, "PostfixBind9DNSList");
            $sock->SET_INFO('PostfixEnabledInBind9', 1);
        }
    }
    echo "<div><code>";
    $main = new main_cf();
    $main->save_conf();
    $main->save_conf_to_server();
    echo "</div></code>";
}
Beispiel #7
0
 function BuildRobots($list, $domain)
 {
     $array[] = "admin";
     $array[] = "bounces";
     $array[] = "confirm";
     $array[] = "join";
     $array[] = "leave";
     $array[] = "owner";
     $array[] = "request";
     $array[] = "subscribe";
     $array[] = "unsubscribe";
     $tpl = new templates();
     $ldap = new clladp();
     $dn = "cn={$list}@{$domain},cn=robots,cn=mailman,cn=artica,{$ldap->suffix}";
     if (!$ldap->ExistsDN($dn)) {
         $upd["objectClass"][] = 'top';
         $upd["objectClass"][] = 'ArticaMailManRobots';
         $upd["MailManAliasPath"][] = "\"|/var/lib/mailman/mail/mailman post {$list}\"";
         $upd["TransportMailmanMaps"][] = 'mailman:';
         $upd["cn"][] = "{$list}@{$domain}";
         if (!$ldap->ldap_add($dn, $upd)) {
             echo $ldap->ldap_last_error;
             exit;
         }
         echo $tpl->_ENGINE_parse_body("{success}:{$list}\n");
     } else {
         unset($upd);
         echo $tpl->_ENGINE_parse_body("{success}:{$list}\n");
     }
     while (list($num, $ligne) = each($array)) {
         $dn = "cn={$list}-{$ligne}@{$domain},cn=robots,cn=mailman,cn=artica,{$ldap->suffix}";
         if (!$ldap->ExistsDN($dn)) {
             $upd["objectClass"][] = 'top';
             $upd["objectClass"][] = 'ArticaMailManRobots';
             $upd["MailManAliasPath"][] = "\"|/var/lib/mailman/mail/mailman {$ligne} {$list}\"";
             $upd["cn"][] = "{$list}-{$ligne}@{$domain}";
             $upd["TransportMailmanMaps"][] = 'mailman:';
             if (!$ldap->ldap_add($dn, $upd)) {
                 echo $ldap->ldap_last_error;
                 exit;
             }
             echo $tpl->_ENGINE_parse_body("{success}:{$list}-{$ligne}\n");
             unset($upd);
         } else {
             echo $tpl->_ENGINE_parse_body("{success}:{$list}-{$ligne}\n");
             unset($upd);
         }
     }
     $main = new main_cf();
     $main->save_conf();
     $main->save_conf_to_server();
 }
function smtpd_client_restrictions_save()
{
    $ou = $_GET["ou"];
    unset($_GET["ou"]);
    while (list($key, $line) = each($_GET)) {
        $array[$key] = $line;
    }
    $ayrre = base64_encode(serialize($array));
    $q = new mysql();
    $sql = "SELECT ID FROM postfix_multi WHERE `key`='smtpd_client_restrictions' AND `ou`='{$ou}'";
    $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
    if ($ligne["ID"] < 1) {
        $sql = "INSERT INTO postfix_multi  (`ou`,`key`,`ValueTEXT`) VALUES('{$ou}','smtpd_client_restrictions','{$ayrre}')";
    } else {
        $sql = "UPDATE postfix_multi SET `ValueTEXT`='{$ayrre}' WHERE ID={$ligne["ID"]}";
    }
    $q->QUERY_SQL($sql, "artica_backup");
    if (!$q->ok) {
        echo $q->mysql_error;
        return;
    }
    $sock = new sockets();
    $sock->getFrameWork("cmd.php?postfix-multi-configure-ou={$ou}");
    return;
    $upd_vals["PostFixRestrictionClassList"][] = "permit_mynetworks=\"\"";
    $upd_vals["PostFixRestrictionClassList"][] = "permit_sasl_authenticated=\"\"";
    $upd_vals["PostFixRestrictionClassList"][] = "check_client_access=\"hash:/etc/postfix/postfix_allowed_connections\"";
    if ($_GET["reject_unknown_client_hostname"] == 1) {
        $upd_vals["PostFixRestrictionClassList"][] = "reject_unknown_client_hostname=\"\"";
    }
    if ($_GET["reject_invalid_hostname"] == 1) {
        $upd_vals["PostFixRestrictionClassList"][] = "reject_invalid_hostname=\"\"";
    }
    if ($_GET["reject_unknown_reverse_client_hostname"] == 1) {
        $upd_vals["PostFixRestrictionClassList"][] = "reject_unknown_reverse_client_hostname=\"\"";
    }
    if ($_GET["reject_unknown_sender_domain"] == 1) {
        $upd_vals["PostFixRestrictionClassList"][] = "reject_unknown_sender_domain=\"\"";
    }
    if ($_GET["reject_non_fqdn_sender"] == 1) {
        $upd_vals["PostFixRestrictionClassList"][] = "reject_non_fqdn_sender=\"\"";
    }
    if ($EnablePostfixAntispamPack == 1) {
        $upd_vals["PostFixRestrictionClassList"][] = "reject_rbl_client=\"zen.spamhaus.org\"";
        $upd_vals["PostFixRestrictionClassList"][] = "reject_rbl_client=\"sbl.spamhaus.org\"";
        $upd_vals["PostFixRestrictionClassList"][] = "reject_rbl_client=\"cbl.abuseat.org\"";
        /*reject_rbl_client bl.spamcop.net,
                reject_rbl_client b.barracudacentral.org,
                reject_rbl_client zen.spamhaus.org,
                reject_rbl_client dul.dnsbl.sorbs.net,
                reject_rbl_client psbl.surriel.com,
                reject_rbl_client ix.dnsbl.manitu.net, 
        		*/
    }
    $upd_vals["PostFixRestrictionClassList"][] = "permit=\"\"";
    $sock = new sockets();
    $sock->SET_INFO('EnablePostfixAntispamPack', $EnablePostfixAntispamPack);
    if (!$ldap->Ldap_modify("cn=smtpd_client_restrictions,cn=restrictions_classes,cn=artica,{$ldap->suffix}", $upd_vals)) {
        echo "Modify smtpd_client_restrictions branch\n{$ldap->ldap_last_error}";
        return null;
    }
    unset($upd_vals);
    if ($EnablePostfixAntispamPack == 1) {
        $upd_vals["PostFixRestrictionClassList"][] = "permit_mynetworks=\"\"";
        $upd_vals["PostFixRestrictionClassList"][] = "permit_sasl_authenticated=\"\"";
        $upd_vals["PostFixRestrictionClassList"][] = "check_client_access=\"hash:/etc/postfix/postfix_allowed_connections\"";
        $upd_vals["PostFixRestrictionClassList"][] = "reject_non_fqdn_hostname=\"\"";
        $upd_vals["PostFixRestrictionClassList"][] = "reject_invalid_hostname=\"\"";
        $upd_vals["PostFixRestrictionClassList"][] = "permit=\"\"";
        if (!$ldap->Ldap_modify("cn=smtpd_helo_restrictions,cn=restrictions_classes,cn=artica,{$ldap->suffix}", $upd_vals)) {
            echo "Modify datas in smtpd_helo_restrictions branch\n{$ldap->ldap_last_error}";
            return null;
        }
    }
    $main = new main_cf();
    $main->save_conf_to_server(1);
    $sock = new sockets();
    $tpl = new templates();
    $datas = $sock->getfile("PostfixReload");
    if (trim($datas == null)) {
        for ($i = 0; $i < 10; $i++) {
            sleep(1);
            $datas = trim($sock->getfile("PostfixReload")) . " ({$i})";
            break;
        }
    }
    echo $tpl->_ENGINE_parse_body("\n{smtpd_client_restrictions} {success} \"{$datas}\"\n");
}
function compile_postfix_server()
{
    $tpl = new templates();
    $main = new main_cf();
    if (!$main->save_conf_to_server()) {
        echo $tpl->_ENGINE_parse_body("<br><strong>{APP_POSTFIX}:</strong>{postfix_main_settings} {error}");
        echo $tpl->_ENGINE_parse_body('<br>{postfix_main_settings} {error}');
        return null;
    }
    echo $tpl->_ENGINE_parse_body("<br><strong>{APP_POSTFIX}:</strong>{apply config} {success}");
}
function save_step_postfix_server()
{
    $main = new main_cf();
    $tpl = new templates();
    $datas = $main->save_conf_to_server();
    return $tpl->_ENGINE_parse_body(save_step_infos(true, $datas));
}
function COMPILE()
{
    $sock = new sockets();
    $sock->SET_INFO("KasxFilterEnabled", 1);
    $sock->SET_INFO("kavmilterEnable", 1);
    $domain = trim(strtolower($_SESSION["WIZARD"]["ORGANIZATION"]));
    $ou = $_SESSION["WIZARD"]["ORGANIZATION"];
    $ou = str_replace(" ", "_", $ou);
    $ldap = new clladp();
    $ldap->AddOrganization($_SESSION["WIZARD"]["ORGANIZATION"]);
    $hashdoms = $ldap->hash_get_all_domains();
    if ($hashdoms[$domain] == null) {
        $ldap->AddRelayDomain($ou, $domain, $_SESSION["WIZARD"]["MAILBOX_IP"], 25);
    }
    $kas = new kas_mysql($ou);
    $kas->SET_VALUE("OPT_FILTRATION_ON", 1);
    $main = new main_cf();
    $main->add_my_networks($_SESSION["WIZARD"]["SMTP_NET"]);
    $main->save_conf_to_server();
    $sock->getFrameWork("cmd.php?kas-reconfigure=yes");
    $sock->getFrameWork("cmd.php?kavmilter-configure");
    $tpl = new templates();
    $html = "\n\t\t\n\t\t<H3>{success}</H3><center>" . button("{close}", "CloseTimeOut()") . "</center>";
    echo $tpl->_ENGINE_parse_body("{success}");
}
function ConfigureMainMaster()
{
    $main = new main_cf();
    $main->save_conf_to_server(1);
    if (!is_file("/etc/postfix/hash_files/header_checks.cf")) {
        @file_put_contents("/etc/postfix/hash_files/header_checks.cf", "#");
    }
    file_put_contents('/etc/postfix/main.cf', $main->main_cf_datas);
    $unix = new unix();
    $postfix = $unix->find_program("postfix");
    shell_exec("{$postfix} reload");
}
function ChangeHostName()
{
    $tpl = new templates();
    if ($_GET["ChangeHostName"] == 'null') {
        echo $tpl->_ENGINE_parse_body('{cancel}');
        return null;
    }
    $sock = new sockets();
    $sock->getFrameWork("cmd.php?ChangeHostName={$_GET["ChangeHostName"]}");
    $users = new usersMenus();
    if ($users->POSTFIX_INSTALLED) {
        include_once 'ressources/class.main_cf.inc';
        $main = new main_cf();
        $main->main_array["myhostname"] = $_GET["ChangeHostName"];
        $main->save_conf();
        $main->save_conf_to_server();
    }
}
Beispiel #14
0
function backup_save()
{
    $MailArchiverEnabled = $_GET["MailArchiverEnabled"];
    writelogs("MailArchiverEnabled={$MailArchiverEnabled}", __FUNCTION__, __FILE__);
    $sock = new sockets();
    $sock->SET_INFO('MailArchiverEnabled', $MailArchiverEnabled);
    $main = new main_cf();
    $main->save_conf();
    $main->save_conf_to_server();
    $sock = new sockets();
    $sock->getFrameWork("cmd.php?SaveMaincf=yes");
}
function save_bounce_maincf()
{
    $mny = new usersMenus();
    $tpl = new templates();
    if ($mny->AsPostfixAdministrator == false) {
        echo $tpl->_ENGINE_parse_body('{no_privileges');
        exit;
    }
    $main = new main_cf();
    unset($_GET["save_bounce_maincf"]);
    while (list($num, $val) = each($_GET)) {
        $main->main_array[$num] = strtolower($val);
    }
    $main->save_conf();
    if ($pages->AutomaticConfig == true) {
        $main->save_conf_to_server();
    }
    echo $tpl->_ENGINE_parse_body('{success}');
}
function smtpd_client_restrictions_save()
{
    $ldap = new clladp();
    if (!$ldap->ExistsDN("cn=restrictions_classes,cn=artica,{$ldap->suffix}")) {
        $upd["objectClass"][] = "top";
        $upd["objectClass"][] = "top";
        $upd["objectClass"][] = "PostFixStructuralClass";
        $upd["cn"][0] = "restrictions_classes";
        if (!$ldap->ldap_add("cn=restrictions_classes,cn=artica,{$ldap->suffix}", $upd)) {
            echo "cn=restrictions_classes,cn=artica,{$ldap->suffix}\n{$ldap->ldap_last_error}";
            return null;
        }
    }
    if ($ldap->ExistsDN("cn=smtpd_client_restrictions,cn=restrictions_classes,cn=artica,{$ldap->suffix}")) {
        $ldap->ldap_delete("cn=smtpd_client_restrictions,cn=restrictions_classes,cn=artica,{$ldap->suffix}", false);
        $upd1["objectClass"][] = "top";
        $upd1["objectClass"][] = "PostFixRestrictionStandardClasses";
        $upd1["cn"][0] = "smtpd_client_restrictions";
        if (!$ldap->ldap_add("cn=smtpd_client_restrictions,cn=restrictions_classes,cn=artica,{$ldap->suffix}", $upd1)) {
            echo "Modify smtpd_client_restrictions branch\n{$ldap->ldap_last_error}";
            return null;
        }
    }
    unset($upd1);
    if ($ldap->ExistsDN("cn=smtpd_helo_restrictions,cn=restrictions_classes,cn=artica,{$ldap->suffix}")) {
        $ldap->ldap_delete("cn=smtpd_helo_restrictions,cn=restrictions_classes,cn=artica,{$ldap->suffix}", false);
    }
    if (!$ldap->ExistsDN("cn=smtpd_helo_restrictions,cn=restrictions_classes,cn=artica,{$ldap->suffix}")) {
        $upd1["objectClass"][] = "top";
        $upd1["objectClass"][] = "PostFixRestrictionStandardClasses";
        $upd1["cn"][0] = "smtpd_helo_restrictions";
        if (!$ldap->ldap_add("cn=smtpd_helo_restrictions,cn=restrictions_classes,cn=artica,{$ldap->suffix}", $upd1)) {
            echo "Modify smtpd_helo_restrictions branch\n{$ldap->ldap_last_error}";
            return null;
        }
    }
    $EnablePostfixAntispamPack = $_GET["EnablePostfixAntispamPack"];
    $upd_vals["PostFixRestrictionClassList"][] = "permit_mynetworks=\"\"";
    $upd_vals["PostFixRestrictionClassList"][] = "permit_sasl_authenticated=\"\"";
    $upd_vals["PostFixRestrictionClassList"][] = "check_client_access=\"hash:/etc/postfix/postfix_allowed_connections\"";
    if ($_GET["reject_unknown_client_hostname"] == 1) {
        $upd_vals["PostFixRestrictionClassList"][] = "reject_unknown_client_hostname=\"\"";
    }
    if ($_GET["reject_invalid_hostname"] == 1) {
        $upd_vals["PostFixRestrictionClassList"][] = "reject_invalid_hostname=\"\"";
    }
    if ($_GET["reject_unknown_reverse_client_hostname"] == 1) {
        $upd_vals["PostFixRestrictionClassList"][] = "reject_unknown_reverse_client_hostname=\"\"";
    }
    if ($_GET["reject_unknown_sender_domain"] == 1) {
        $upd_vals["PostFixRestrictionClassList"][] = "reject_unknown_sender_domain=\"\"";
    }
    if ($_GET["reject_non_fqdn_sender"] == 1) {
        $upd_vals["PostFixRestrictionClassList"][] = "reject_non_fqdn_sender=\"\"";
    }
    if ($EnablePostfixAntispamPack == 1) {
        $upd_vals["PostFixRestrictionClassList"][] = "reject_rbl_client=\"zen.spamhaus.org\"";
        $upd_vals["PostFixRestrictionClassList"][] = "reject_rbl_client=\"sbl.spamhaus.org\"";
        $upd_vals["PostFixRestrictionClassList"][] = "reject_rbl_client=\"cbl.abuseat.org\"";
    }
    $upd_vals["PostFixRestrictionClassList"][] = "permit=\"\"";
    $sock = new sockets();
    $sock->SET_INFO('EnablePostfixAntispamPack', $EnablePostfixAntispamPack);
    $sock->SET_INFO('reject_forged_mails', $_GET["reject_forged_mails"]);
    if (!$ldap->Ldap_modify("cn=smtpd_client_restrictions,cn=restrictions_classes,cn=artica,{$ldap->suffix}", $upd_vals)) {
        echo "Modify smtpd_client_restrictions branch\n{$ldap->ldap_last_error}";
        return null;
    }
    unset($upd_vals);
    if ($EnablePostfixAntispamPack == 1) {
        $upd_vals["PostFixRestrictionClassList"][] = "permit_mynetworks=\"\"";
        $upd_vals["PostFixRestrictionClassList"][] = "permit_sasl_authenticated=\"\"";
        $upd_vals["PostFixRestrictionClassList"][] = "check_client_access=\"hash:/etc/postfix/postfix_allowed_connections\"";
        $upd_vals["PostFixRestrictionClassList"][] = "reject_non_fqdn_hostname=\"\"";
        $upd_vals["PostFixRestrictionClassList"][] = "reject_invalid_hostname=\"\"";
        $upd_vals["PostFixRestrictionClassList"][] = "permit=\"\"";
        if (!$ldap->Ldap_modify("cn=smtpd_helo_restrictions,cn=restrictions_classes,cn=artica,{$ldap->suffix}", $upd_vals)) {
            echo "Modify datas in smtpd_helo_restrictions branch\n{$ldap->ldap_last_error}";
            return null;
        }
    }
    $main = new main_cf();
    $main->save_conf_to_server(1);
    $sock = new sockets();
    $tpl = new templates();
    $sock->getFrameWork("cmd.php?reconfigure-postfix=yes");
}
Beispiel #17
0
<?php
if(posix_getuid()<>0){die("Cannot be used in web server mode\n\n");}
include_once(dirname(__FILE__).'/ressources/class.templates.inc');
include_once(dirname(__FILE__).'/ressources/class.ini.inc');
include_once(dirname(__FILE__).'/ressources/class.main_cf.inc');
include_once(dirname(__FILE__).'/ressources/class.amavis.inc');
include_once(dirname(__FILE__).'/ressources/class.samba.inc');
include_once(dirname(__FILE__).'/ressources/class.squid.inc');

$main=new main_cf();
$main->save_conf();
$main->save_conf_to_server(1);

$amavis=new amavis();
$amavis->Save();
$amavis->SaveToServer();

$samba=new samba();
$samba->SaveToLdap();

$squid=new squidbee();
$squid->SaveToLdap();
$squid->SaveToServer();

system('/etc/init.d/artica-postfix restart postfix');
system('/etc/init.d/artica-postfix restart squid');
system('/etc/init.d/artica-postfix restart samba');
system('/usr/share/artica-postfix/bin/artica-install --cyrus-checkconfig');
system('/etc/init.d/artica-postfix restart imap');
system('/etc/init.d/artica-postfix restart saslauthd');
Beispiel #18
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();
}
Beispiel #19
0
function main_fetchmail_build(){
	include_once('ressources/class.user.inc');
	include_once('ressources/class.main_cf.inc');
	include_once('ressources/class.fetchmail.inc');
	
	
$failed=false;	
	
$isp_address_mail=$_GET["isp_address_mail"];
$isp_pop3_server=$_GET["isp_pop3_server"];
$isp_smtp_server=$_GET["isp_smtp_server"];
	
$isp_account=$_GET["isp_account"];
$isp_password=$_GET["isp_password"];
$local_email=$_GET["local_email"];
$local_password=$_GET["local_password"];
	
$isp_smtp_account=$_GET["isp_smtp_account"];
$isp_smtp_password=$_GET["isp_smtp_password"];
	
$relay_server=$_GET["relay_server"];


if($local_email==null){
	echo main_fetchmail_build_results(true,'local mail (False)');
	exit;
}

$ldap=new clladp();
writelogs("i try to found if user exists",__FUNCTION__,__FILE__);
$uid=$ldap->uid_from_email($local_email);
if($uid<>null){
	$user=new user($local_email);
	$ou=$user->ou;
}else{
	writelogs("no user found, create it",__FUNCTION__,__FILE__);
	$tb=explode("@",$local_email);
	$local_domain=$tb[1];  
	$user=new user($tb[0]);
	$ou=$ldap->ou_by_smtp_domain($local_domain);
	if($ou==null){
		$ou=$local_domain;
		writelogs("Adding new organization $ou",__FUNCTION__,__FILE__);
		$ldap->AddOrganization($ou);
	}	
	
}


	
	writelogs("Creating user",__FUNCTION__,__FILE__);
	$user=new user($local_email);
	$user->mail=$local_email;
	$user->password=$local_password;
	$user->ou=$ou;
	$user->SenderCanonical=$isp_address_mail;
	if(!$user->add_user()){
		echo main_fetchmail_build_results(true,$user->ldap_error);
		exit;
	}
	
	
	if($isp_smtp_account<>null){
		writelogs("Creating SMTP authentification for $isp_smtp_server width $isp_smtp_account",__FUNCTION__,__FILE__);
		$sasl=new smtp_sasl_password_maps();
		$sasl->add($isp_address_mail,$isp_smtp_account,$isp_password);
		$main=new main_cf();
		writelogs("Enable sasl engine in postfix",__FUNCTION__,__FILE__);
		$main->smtp_sasl_password_maps_enable_2();		
		
	}
	writelogs("Creating sender_dependent_relayhost_maps -> $isp_smtp_server",__FUNCTION__,__FILE__);
	$sender=new sender_dependent_relayhost_maps();
	if(!$sender->Add($isp_address_mail,$isp_smtp_server)){
		echo main_fetchmail_build_results(true,"sender_dependent_relayhost_maps:$sender->ldap_error");
		exit;
	}
	

	$fetchmail=new Fetchmail_settings();
	$array["poll"]=$isp_pop3_server;
	$array["proto"]="auto";
	$array["keep"]="yes";
	$array["user"]=$isp_account;
	$array["pass"]=$isp_password;
	$array["is"]=$local_email;
	$array["fetchall"]="yes";
	$line=$fetchmail->compile($array);
	if(!$user->fetchmail_add_rule($line)){
		echo main_fetchmail_build_results(true,"fetchmail rule:$user->ldap_error");
		exit;
	}
	
	$relay=new Routing($ou);
	if($relay_server<>null){
		if(!$relay->create_relay_server($local_domain,$relay_server,$ou)){
				echo main_fetchmail_build_results(true,"relay:$relay->ldap_error");
			}
		}else{
			if(!$relay->create_localdomain($ou,$local_domain)){
				echo main_fetchmail_build_results(true,"local domain:$relay->ldap_error");
			}
		}

	
	$fetchmail=new fetchmail();
	$fetchmail->Save();
	$main=new main_cf();
	$main->save_conf();
	$main->save_conf_to_server();
	
	
	
	$info="<table style='width:100%'>
	<tr>
		<td width=1%><img src='img/fw_bold.gif'></td>
		<td nowrap align='right'><strong>{organization}</strong>:</td>
		<td nowrap><strong>$ou</strong></td>
	</tr>
	<tr>
		<td width=1%><img src='img/fw_bold.gif'></td>
		<td nowrap align='right'><strong>{local_mail}</strong>:</td>
		<td nowrap><strong>$local_email</strong></td>
	</tr>
	<tr>
		<td width=1%><img src='img/fw_bold.gif'></td>
		<td nowrap align='right'><strong>{isp_address_mail}</strong>:</td>
		<td nowrap><strong>$isp_address_mail</strong></td>
	</tr>			
	</table>	
	";
	
	echo main_fetchmail_build_results(false,$info);
	
	
}
Beispiel #20
0
function RebuildPostfix()
{
    $tpl = new templates();
    $main = new main_cf();
    $main->save_conf();
    $main->save_conf_to_server();
    $artica = new artica_general();
    $artica->ArticaFirstWizard = 1;
    $artica->Save();
    echo $tpl->_ENGINE_parse_body('main.cf/master.cf {added}');
}