Пример #1
0
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");	
	
}
Пример #2
0
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");
    }
}
Пример #3
0
<?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";
Пример #4
0
function buildconfig($aspid = false)
{
    $unix = new unix();
    if (!$aspid) {
        $me = basename(__FILE__);
        $pidpath = "/etc/artica-postfix/pids/{$me}.pid";
        $pid = $unix->get_pid_from_file($pidpath);
        if ($unix->process_exists($pid, $me)) {
            echo "Starting......: " . date("H:i:s") . " amavisd-new already executed pid {$pid}\n";
            die;
        }
    }
    @file_put_contents($pidpath, getmypid());
    $php = $unix->LOCATE_PHP5_BIN();
    $nohup = $unix->find_program("nohup");
    $cmd = "{$nohup} {$php} /usr/share/artica-postfix/exec.spamassassin.php --sa-update >/dev/null 2>&1 &";
    shell_exec($cmd);
    echo "Starting......: " . date("H:i:s") . " 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......: " . date("H:i:s") . " amavisd-new installing template {$file}\n";
            @copy("/usr/share/artica-postfix/bin/install/amavis/{$file}", "/usr/local/etc/amavis/{$file}");
        }
    }
    echo "Starting......: " . date("H:i:s") . " amavisd-new " . strlen($conf) . " bytes length\n";
    @file_put_contents("/usr/local/etc/amavisd.conf", $conf);
    shell_exec("/bin/chown -R postfix:postfix /etc/amavis/dkim >/dev/null 2>&1");
    shell_exec("/bin/chown -R postfix:postfix /usr/local/etc/amavis >/dev/null 2>&1");
    shell_exec("/bin/chown -R postfix:postfix /usr/local/etc/amavis/* >/dev/null 2>&1");
    shell_exec("/bin/chown root:root /var/amavis-plugins/check-external-users.conf");
    shell_exec("/bin/chown root:root /var/amavis-plugins");
    shell_exec("/bin/chmod 755 /var/amavis-plugins");
    shell_exec("/bin/chmod -R 755 /etc/amavis/dkim >/dev/null 2>&1");
    shell_exec("/bin/chmod -R 755 /usr/local/etc/amavis >/dev/null 2>&1");
    shell_exec("/bin/chmod -R 755 /usr/local/etc/amavis/* >/dev/null 2>&1");
    if (is_dir("/etc/mail/spamassassin")) {
        shell_exec("/bin/chmod -R 666 /etc/mail/spamassassin");
        shell_exec("/bin/chown -R postfix:postfix /etc/mail/spamassassin");
        shell_exec("/bin/chmod 755 /etc/mail/spamassassin");
    }
    if (is_dir("/etc/spamassassin")) {
        shell_exec("/bin/chmod -R 666 /etc/spamassassin");
        shell_exec("/bin/chmod 755 /etc/spamassassin");
        shell_exec("/bin/chown -R postfix:postfix /etc/spamassassin");
    }
    if (is_dir("/var/lib/spamassassin")) {
        shell_exec("/bin/chmod -R 755 /var/lib/spamassassin");
        shell_exec("/bin/chown -R postfix:postfix /var/lib/spamassassin");
    }
    echo "Starting......: " . date("H:i:s") . " amavisd-new done\n";
    $unix = new unix();
    $unix->THREAD_COMMAND_SET($unix->LOCATE_PHP5_BIN() . " /usr/share/artica-postfix/exec.spamassassin.php");
}