示例#1
0
function postscreen($hostname)
{
    $user = new usersMenus();
    if (!$user->POSTSCREEN_INSTALLED) {
        echo "Starting......: " . date("H:i:s") . " {$hostname} PostScreen is not installed, you should upgrade to 2.8 postfix version\n";
        return;
    }
    $maincf = new maincf_multi($hostname);
    $maincf->buildconf();
    _start_instance($hostname);
}
function reconfigure_instance_mime_checks($hostname)
{
    $unix = new unix();
    $users = new usersMenus();
    $postconf = $unix->find_program("postconf");
    $postmulti = $unix->find_program("postmulti");
    if ($users->AMAVIS_INSTALLED) {
        $main = new maincf_multi($hostname);
        $array_filters = unserialize(base64_decode($main->GET_BIGDATA("PluginsEnabled")));
        if ($array_filters["APP_AMAVIS"] == 1) {
            @unlink("/etc/postfix-{$hostname}/mime_header_checks");
            shell_exec("{$postconf} -c \"/etc/postfix-{$hostname}\" -e \"mime_header_checks = \"");
            system("/usr/share/artica-postfix/bin/artica-install --amavis-reload");
            _start_instance($hostname);
            return;
        }
    }
    $sql = "SELECT * FROM smtp_attachments_blocking WHERE ou='{$_GET["ou"]}' AND hostname='{$hostname}' ORDER BY IncludeByName";
    $q = new mysql();
    $results = $q->QUERY_SQL($sql, "artica_backup");
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        if ($ligne["IncludeByName"] == null) {
            continue;
        }
        $f[] = $ligne["IncludeByName"];
    }
    if (!is_array($f)) {
        @unlink("/etc/postfix-{$hostname}/mime_header_checks");
        shell_exec("{$postconf} -c \"/etc/postfix-{$hostname}\" -e \"mime_header_checks = \"");
        _start_instance($hostname);
        return;
    }
    $strings = implode("|", $f);
    echo "Starting......: Postfix \"{$hostname}\" " . count($f) . " extensions blocked\n";
    $pattern[] = "/^\\s*Content-(Disposition|Type).*name\\s*=\\s*\"?(.+\\.({$strings}))\"?\\s*\$/\tREJECT file attachment types is not allowed. File \"\$2\" has the unacceptable extension \"\$3\"";
    $pattern[] = "";
    @file_put_contents("/etc/postfix-{$hostname}/mime_header_checks", implode("\n", $pattern));
    shell_exec("{$postconf} -c \"/etc/postfix-{$hostname}\" -e \"mime_header_checks = regexp:/etc/postfix-{$hostname}/mime_header_checks\"");
}