function compile_amavis() { $amavis = new amavis(); $amavis->Save(); $tpl = new templates(); echo $tpl->_ENGINE_parse_body('<hr>{save_config_to_server}<hr> ', "amavis.index.php"); }
function max_servers_save() { $amavis = new amavis(); $amavis->main_array["BEHAVIORS"]["max_servers"] = $_GET["max_servers"]; $amavis->main_array["BEHAVIORS"]["child_timeout"] = "{$_GET["child_timeout"]}*60"; $amavis->Save(); $sock = new sockets(); $sock->getFrameWork("cmd.php?postfix-ssl=yes"); }
function amavis_reload(){ SPAMASSASSIN_V320(); PhishTag(); HitFreqsRuleTiming(); if(!is_file("/usr/local/sbin/amavisd")){return null;} if(!is_file("/usr/local/etc/amavisd.conf")){return null;} $amavis=new amavis(); $amavis->CheckDKIM(); $conf=$amavis->buildconf(); @file_put_contents("/usr/local/etc/amavisd.conf",$conf); $unix=new unix(); $unix->THREAD_COMMAND_SET("/usr/share/artica-postfix/bin/artica-make APP_SPAMASSASSIN_RQ"); CheckSecuritiesFolders(); $unix->send_email_events("Amavis will be reloaded", "exec.spamassassin, ordered to reload amavis {$GLOBALS["CMDLINES"]}", "postfix"); $unix->THREAD_COMMAND_SET("/usr/local/sbin/amavisd -c /usr/local/etc/amavisd.conf reload"); }
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>"; }
<?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');
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); }
function INI_SAVE() { $amavis = new amavis(); while (list($num, $ligne) = each($_GET)) { $amavis->main_array[$_GET["INI_SAVE"]][$num] = $ligne; } $amavis->EnableBlockUsersTroughInternet = $_GET["EnableBlockUsersTroughInternet"]; $amavis->Save(); }
function log_level_save() { $amavis = new amavis(); $sock = new sockets(); $sock->SET_INFO("AmavisDebugSpamassassin", $_POST["AmavisDebugSpamassassin"]); $amavis->main_array["BEHAVIORS"]["log_level"] = $_POST["log_level"]; $tpl = new templates(); echo $tpl->_ENGINE_parse_body('{log_level} -> ' . $_POST["log_level"] . "\n"); $amavis->Save(); }
function parameters_save() { $AmavisMemoryInRAM = $_POST["AmavisMemoryInRAM"]; if ($AmavisMemoryInRAM > 0) { if ($AmavisMemoryInRAM < 128) { $AmavisMemoryInRAM = 128; } } $sock = new sockets(); $sock->SET_INFO('AmavisMemoryInRAM', $AmavisMemoryInRAM); $sock->SET_INFO('AmavisDebugSpamassassin', $AmavisDebugSpamassassin); $amavis = new amavis(); $amavis->main_array["BEHAVIORS"]["max_servers"] = $_POST["max_servers"]; $amavis->main_array["BEHAVIORS"]["max_requests"] = $_POST["max_requests"]; $amavis->main_array["BEHAVIORS"]["child_timeout"] = $_POST["child_timeout"]; $amavis->main_array["BEHAVIORS"]["final_virus_destiny"] = $_POST["final_virus_destiny"]; $amavis->main_array["BEHAVIORS"]["final_banned_destiny"] = $_POST["final_banned_destiny"]; $amavis->main_array["BEHAVIORS"]["final_spam_destiny"] = $_POST["final_spam_destiny"]; $amavis->main_array["BEHAVIORS"]["always_clean"] = $_POST["always_clean"]; $amavis->main_array["BEHAVIORS"]["trust_my_net"] = $_POST["trust_my_net"]; $amavis->main_array["BEHAVIORS"]["enable_db"] = $_POST["enable_db"]; $amavis->main_array["BEHAVIORS"]["enable_global_cache"] = $_POST["enable_global_cache"]; $amavis->main_array["BEHAVIORS"]["log_level"] = $_POST["log_level"]; $amavis->Save(); $tpl = new templates(); echo $tpl->javascript_parse_text("{ERROR_NEED_TO_SAVEAPPLY}"); }
function CheckAmavisLocalInterface() { $sock = new sockets(); $a = $sock->GET_INFO("EnableAmavisInMasterCF"); $EnableAmavisInMasterCF = intval(trim($a)); if ($EnableAmavisInMasterCF == 0) { events("CheckAmavisLocalInterface():: EnableAmavisInMasterCF not enabled = \"{$a}\""); return; } $datas = @file_get_contents("/usr/local/etc/amavisd.conf"); $tbl = explode("\n", $datas); events("CheckAmavisLocalInterface():: " . count($tbl) . " lines"); while (list($num, $ligne) = each($tbl)) { if (trim($ligne) == null) { continue; } if (preg_match("#inet_acl.+?qw#", $ligne)) { events("CheckAmavisLocalInterface():: inet_acl parameters ok"); return true; } } events("rebuild amavis"); $amavis = new amavis(); $amavis->Save(); $amavis->SaveToServer(); }
function compile_amavis() { $tpl = new templates(); $sock = new sockets(); $sock->getFrameWork("cmd.php?SaveMaincf=yes"); $users = new usersMenus(); $users->LoadModulesEnabled(); $page = CurrentPageName(); $script = "\n\t<div id='compile_amavis'></div>\n\t<script>\n\t\tChangeStatus(15);\n\t\tLoadAjaxSilent('compile_amavis','{$page}?compile_kavmilter=yes');\n\t</script>\t\n\t\n\t"; if (!$users->AMAVIS_INSTALLED) { echo $tpl->_ENGINE_parse_body("<strong>{APP_AMAVISD_NEW}:</strong> {error_module_not_installed}") . $script; die; } if ($users->EnableAmavisDaemon != 1) { echo $tpl->_ENGINE_parse_body("<strong>{APP_AMAVISD_NEW}:</strong> {error_module_not_enabled}") . $script; die; } include_once "ressources/class.amavis.inc"; $amavis = new amavis(); $amavis->SaveToServer(); $sock = new sockets(); $sock->getFrameWork("services.php?restart-postfix-all=yes"); echo $script; }
function compile_amavis() { $tpl = new templates(); $users = new usersMenus(); $users->LoadModulesEnabled(); if (!$users->AMAVIS_INSTALLED) { echo $tpl->_ENGINE_parse_body("<strong>{APP_AMAVISD_NEW}:</strong> {error_module_not_installed}"); die; } if ($users->EnableAmavisDaemon != 1) { echo $tpl->_ENGINE_parse_body("<strong>{APP_AMAVISD_NEW}:</strong> {error_module_not_enabled}"); die; } include_once "ressources/class.amavis.inc"; $amavis = new amavis(); $amavis->SaveToServer(); }
<?php include dirname(__FILE__) . '/ressources/class.amavis.inc'; include_once dirname(__FILE__) . '/framework/frame.class.inc'; include_once dirname(__FILE__) . '/framework/class.unix.inc'; if (posix_getuid() != 0) { die("Cannot be used in web server mode\n\n"); } if (preg_match("#--verbose#", implode(" ", $argv))) { $GLOBALS["VERBOSE"] = true; } $GLOBALS["EXECUTED_AS_ROOT"] = true; echo "Starting......: amavisd-new build configuration\n"; $amavis = new amavis(); $amavis->CheckDKIM(); $conf = $amavis->buildconf(); PatchPyzor(); $tpl[] = "template-spam-admin.txt"; $tpl[] = "template-spam-sender.txt"; $tpl[] = "template-dsn.txt"; $tpl[] = "template-virus-admin.txt"; $tpl[] = "template-virus-recipient.txt"; $tpl[] = "template-virus-sender.txt"; @mkdir("/usr/local/etc/amavis", 0755, true); while (list($index, $file) = each($tpl)) { if (!is_file("/usr/local/etc/amavis/{$file}")) { echo "Starting......: amavisd-new installing template {$file}\n"; @copy("/usr/share/artica-postfix/bin/install/amavis/{$file}", "/usr/local/etc/amavis/{$file}"); } } echo "Starting......: amavisd-new " . strlen($conf) . " bytes length\n";
function INI_SAVE() { $amavis = new amavis(); while (list($num, $ligne) = each($_GET)) { writelogs("Saving [{$num}]=[{$ligne}]", __FUNCTION__, __FILE__, __LINE__); $amavis->main_array[$_GET["INI_SAVE"]][$num] = $ligne; } $amavis->EnableBlockUsersTroughInternet = $_GET["EnableBlockUsersTroughInternet"]; $amavis->Save(); }
function SAVE_QUAR() { if (isset($_GET["SAVE_KAS"])) { $kas = new kas_mysql("default"); if ($_GET["ACTION_SPAM_MODE"] == 1) { $kas->SET_VALUE("ACTION_SPAM_MODE", 2); } else { $kas->SET_VALUE("ACTION_SPAM_MODE", -1); } if ($_GET["ACTION_FORMAL_MODE"] == 1) { $kas->SET_VALUE("ACTION_FORMAL_MODE", 2); } else { $kas->SET_VALUE("ACTION_FORMAL_MODE", 0); } if ($_GET["ACTION_PROBABLE_MODE"] == 1) { $kas->SET_VALUE("ACTION_PROBABLE_MODE", 2); } else { $kas->SET_VALUE("ACTION_SPAM_MODE", 0); $kas->SET_VALUE("ACTION_SPAM_SUBJECT_PREFIX", "[SPAM]"); } $sock = new sockets(); $sock->getFrameWork("cmd.php?kas-reconfigure=yes"); } if (isset($_GET["SAVE_AMAVIS"])) { $amavis = new amavis(); $amavis->main_array["BEHAVIORS"]["spam_quarantine_spammy"] = $_GET["EnableQuarantineSpammy"]; $amavis->main_array["BEHAVIORS"]["spam_quarantine_spammy2"] = $_GET["EnableQuarantineSpammy2"]; $amavis->Save(); } }
function main_postmaster(){ $user=new usersMenus(); $servername=$user->hostname; if(isset($_GET["postmaster_mail"])){ if($_GET["postmaster_mail"]==null){ echo main_result(true,'No mailbox set','{postmaster}'); exit; } include_once('ressources/class.user.inc'); $mail=$_GET["postmaster_mail"]; $ldap=new clladp(); $uid=$ldap->uid_from_email($mail); writelogs("$mail has uid $uid",__FUNCTION__,__FILE__); $users=new user($uid); $users->mail=$mail; if(!$users->add_user()){ echo main_result(true,$users->ldap_error,'{postmaster}'); exit; } if(!$users->alias_add("postmaster@$servername")){ echo main_result(true,"postmaster@$servername:$users->ldap_error",'{postmaster}'); exit; } if(!$users->alias_add("root@$servername")){ echo main_result(true,"root@$servername:$users->ldap_error",'{postmaster}'); exit; } include_once("ressources/class.main_cf.inc"); $main=new main_cf(); $main->main_array["double_bounce_sender"]=$mail; $main->main_array["address_verify_sender"]=$mail; $main->main_array["2bounce_notice_recipient"]=$mail; $main->main_array["error_notice_recipient"]=$mail; $main->main_array["delay_notice_recipient"]=$mail; $main->main_array["empty_address_recipient"]=$mail; $main->save_conf(); $main->save_conf_to_server(); $amavis=new amavis(); $amavis->main_array["BEHAVIORS"]["virus_admin"]=$mail; $amavis->main_array["BEHAVIORS"]["mailfrom_notify_admin"]=$mail; $amavis->main_array["BEHAVIORS"]["mailfrom_notify_recip"]=$mail; $amavis->main_array["BEHAVIORS"]["mailfrom_notify_spamadmin"]=$mail; $amavis->Save(); $amavis->SaveToServer(); echo main_result(false,"<br>root@$servername<br>postmaster@$servername<br>{success}",'{postmaster}'); return null; } $postmasters="postmaster@$servername,root@$servername"; $html=" <strong>{postmaster}</strong> <p class=caption>{postmaster_explain} $postmasters</p> <table style='width:100%'> <tr> <td align='right' nowrap valign='top'><strong>{local_mail}:</strong></td> <td valign='top'>" . Field_text('postmaster_mail',$_GET["postmaster_mail"],'width:100%')."</td> </tr> <tr><td colspan=2 align='right'><input type='button' OnClick=\"javascript:postmaster1();\" value='{build} »'></td></tr> </tr> </table>"; $tpl=new templates(); echo $tpl->_ENGINE_parse_body($html); }
function COPY_DOMAINS_SAVE() { include_once "ressources/class.amavis.inc"; $amavis = new amavis(); $domain = $_GET["duplicate_local_domain"]; if (!is_numeric($_GET["duplicate_port"])) { $_GET["duplicate_port"] = 25; } $amavis->copy_to_domain_array[$domain]["enable"] = $_GET["enable"]; $amavis->copy_to_domain_array[$domain]["duplicate_host"] = $_GET["duplicate_host"]; $amavis->copy_to_domain_array[$domain]["duplicate_port"] = $_GET["duplicate_port"]; $amavis->SaveCopyToDomains(); $tpl = new templates(); echo html_entity_decode($tpl->_ENGINE_parse_body("{enable}:{$_GET["enable"]}\n{$domain} -> {$_GET["duplicate_host"]}:{$_GET["duplicate_port"]}\n{success}")); }
function amavis_reload() { $sock = new sockets(); $unix = new unix(); $EnableAmavisDaemon = intval($sock->GET_INFO("EnableAmavisDaemon")); $SpamAssMilterEnabled = intval($sock->GET_INFO("SpamAssMilterEnabled")); $PHP = $unix->LOCATE_PHP5_BIN(); SPAMASSASSIN_V320(); PhishTag(); HitFreqsRuleTiming(); if ($EnableAmavisDaemon == 1) { if (!is_file("/usr/local/sbin/amavisd")) { return null; } if (!is_file("/usr/local/etc/amavisd.conf")) { return null; } $amavis = new amavis(); $amavis->CheckDKIM(); $conf = $amavis->buildconf(); @file_put_contents("/usr/local/etc/amavisd.conf", $conf); $unix->THREAD_COMMAND_SET("/usr/share/artica-postfix/bin/artica-make APP_SPAMASSASSIN_RQ"); CheckSecuritiesFolders(); $unix->send_email_events("Amavis will be reloaded", "exec.spamassassin, ordered to reload amavis {$GLOBALS["CMDLINES"]}", "postfix"); $unix->THREAD_COMMAND_SET("/usr/local/sbin/amavisd -c /usr/local/etc/amavisd.conf reload"); } if ($SpamAssMilterEnabled == 1) { echo "Starting......: " . date("H:i:s") . " Restarting SpamAssassin milter edition\n"; shell_exec("{$PHP} /usr/share/artica-postfix/exec.initslapd.php --spamass-milter"); shell_exec("/etc/init.d/spamass-milter restart"); } }
function buildWhitelist($aspid = false) { $unix = new unix(); if (!$aspid) { $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $pid = $unix->get_pid_from_file($pidfile); if ($unix->process_exists($pid, basename(__FILE__))) { $time = $unix->PROCCESS_TIME_MIN($pid); if ($GLOBALS["OUTPUT"]) { echo "Building......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} service Already Artica task running PID {$pid} since {$time}mn\n"; } return; } @file_put_contents($pidfile, getmypid()); } $amavis = new amavis(); $amavis->whitelist_sender_maps(); if ($GLOBALS["OUTPUT"]) { echo "Building......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Building Whitelist done\n"; } reload(true); }