当前位置: 首页>>代码示例>>PHP>>正文


PHP clladp::load_mynetworks方法代码示例

本文整理汇总了PHP中clladp::load_mynetworks方法的典型用法代码示例。如果您正苦于以下问题:PHP clladp::load_mynetworks方法的具体用法?PHP clladp::load_mynetworks怎么用?PHP clladp::load_mynetworks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在clladp的用法示例。


在下文中一共展示了clladp::load_mynetworks方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: TrustedNetworks

function TrustedNetworks()
{
    $ipClass = new IP();
    $q = new mysql();
    $sql = "SELECT * FROM postfix_whitelist_con";
    $results = $q->QUERY_SQL($sql, "artica_backup");
    if (!$q->ok) {
        echo "{$q->mysql_error}\n";
    }
    while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
        if ($ipClass->isIPAddressOrRange($ligne["ipaddr"])) {
            $f[] = "trusted_networks {$ligne["ipaddr"]}";
        }
        $hostname = trim(strtolower($ligne["hostname"]));
        if (strlen($hostname) < 3) {
            continue;
        }
        if ($hostname == null) {
            continue;
        }
        if (!$ipClass->isIPAddressOrRange($ligne["ipaddr"])) {
            $f[] = "whitelist_from_rcvd *@*  {$hostname}";
        }
    }
    $sql = "SELECT ID,pattern FROM miltergreylist_acls WHERE `method`='whitelist' AND `type`='addr'";
    $results = $q->QUERY_SQL($sql, "artica_backup");
    while ($ligne = mysql_fetch_assoc($results)) {
        $ipaddr = trim($ligne["pattern"]);
        if ($ipaddr == null) {
            continue;
        }
        if ($ipaddr == "127.0.0.1/8") {
            $ipaddr = "127.0.0.0/8";
        }
        if (!$ipClass->isIPAddressOrRange($ipaddr)) {
            continue;
        }
        $f[] = "trusted_networks {$ipaddr}";
    }
    $sql = "SELECT ID,pattern FROM miltergreylist_acls WHERE `method`='whitelist' AND `type`='from'";
    $results = $q->QUERY_SQL($sql, "artica_backup");
    while ($ligne = mysql_fetch_assoc($results)) {
        $from = trim($ligne["pattern"]);
        if ($from == null) {
            continue;
        }
        if ($ipClass->isIPAddressOrRange($from)) {
            continue;
        }
        $from = str_replace(".*", "*", $from);
        $f[] = "whitelist_from {$from}";
    }
    $ldap = new clladp();
    $nets = $ldap->load_mynetworks();
    if (!is_array($nets)) {
        $f[] = "trusted_networks 127.0.0.0/8";
    }
    while (list($num, $network) = each($nets)) {
        $cleaned[$network] = $network;
    }
    unset($nets);
    while (list($network, $network2) = each($cleaned)) {
        $nets[] = $network;
    }
    while (list($a, $b) = each($nets)) {
        $f[] = "trusted_networks {$b}";
    }
    $sql = "SELECT * FROM postfix_global_whitelist WHERE enabled=1 AND score=0 ORDER BY sender";
    $q = new mysql();
    $results = $q->QUERY_SQL($sql, "artica_backup");
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $f[] = "whitelist_from {$ligne["sender"]}";
    }
    $count = count($f);
    echo "Starting......: " . date("H:i:s") . " spamassassin Whitelisted ({$count} rows) done\n";
    $user = new usersMenus();
    $init_pre = dirname($user->spamassassin_conf_path) . "/trusted_nets.pre";
    $final = @implode("\n", $f) . "\n";
    @file_put_contents($init_pre, $final);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:80,代码来源:exec.spamassassin.php

示例2: snort_NetWorks

function snort_NetWorks(){
	$ldap=new clladp();
	$nets=$ldap->load_mynetworks();
	while (list ($index, $line) = each ($nets) ){if(preg_match("#[0-9\.]+\/[0-9]+#",$line)){$newnets[$line]=$line;}}
	$nets2=GetAllNicNets();
	while (list ($index, $line) = each ($nets) ){if(preg_match("#[0-9\.]+\/[0-9]+#",$line)){$newnets[$line]=$line;}}
	while (list ($index, $line) = each ($newnets) ){if(preg_match("#127\.0\.0#",$index)){continue;}$final[]=$index;}
	if(count($final)>1){
		$HOME_NET="[".@implode(",",$final)."]";
	}else{
		$HOME_NET=@implode("",$final);
	}
	
	@file_put_contents("/usr/share/artica-postfix/ressources/logs/web/snort.networks",serialize($final));
	@chmod("/usr/share/artica-postfix/ressources/logs/web/snort.networks",777);
	return $HOME_NET;
}
开发者ID:rsd,项目名称:artica-1.5,代码行数:17,代码来源:exec.snort.php

示例3: MyNetworks

function MyNetworks($trust = 0)
{
    if ($trust == 1) {
        $ldap = new clladp();
        $nets = $ldap->load_mynetworks();
    }
    $nets[] = "127.0.0.0/8";
    while (list($num, $network) = each($nets)) {
        $cleaned[$network] = $network;
    }
    unset($nets);
    while (list($network, $network2) = each($cleaned)) {
        $nets[] = $network;
    }
    echo "Starting......: " . date("H:i:s") . " opendkim generating internal hosts " . count($nets) . " entries done...\n";
    $nets[] = "";
    @file_put_contents("/etc/mail/dkim/internal-hosts", @implode("\n", $nets));
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:18,代码来源:exec.opendkim.php

示例4: TrustedNetworks

function TrustedNetworks(){
	
	$q=new mysql();
	$sql="SELECT * FROM postfix_whitelist_con";
	$results=$q->QUERY_SQL($sql,"artica_backup");
	if(!$q->ok){echo "$q->mysql_error\n";}
	
	while($ligne=mysql_fetch_array($results,MYSQL_ASSOC)){
			if(trim($server)==null){continue;}
			if(preg_match("#[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+#",$ligne["ipaddr"])){
				$f[]="trusted_networks {$ligne["ipaddr"]}";
			}
			
			if(!preg_match("#[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+#",$ligne["hostname"])){
		  		$f[]="whitelist_from_rcvd *@*  {$ligne["hostname"]}";
			}
		}
		
	
	
	
	$ldap=new clladp();
	$nets=$ldap->load_mynetworks();
	if(!is_array($nets)){
		$f[]="trusted_networks 127.0.0.0/8";
	}
	

	while (list ($num, $network) = each ($nets) ){$cleaned[$network]=$network;}
	unset($nets);
	while (list ($network, $network2) = each ($cleaned) ){$nets[]=$network;}
	while (list ($a, $b) = each ($nets) ){
		$f[]="trusted_networks $b";
	}
	
	
	$sql="SELECT * FROM postfix_global_whitelist WHERE enabled=1 AND score=0 ORDER BY sender";	
	$q=new mysql();
	$results=$q->QUERY_SQL($sql,"artica_backup");
	while($ligne=@mysql_fetch_array($results,MYSQL_ASSOC)){
		
			$f[]="whitelist_from {$ligne["sender"]}";
		
	}
	
	
	
	$count=count($f);
	echo "Starting......: spamassassin Whitelisted ($count rows) done\n";	
	$user=new usersMenus();
	$init_pre=dirname($user->spamassassin_conf_path)."/trusted_nets.pre";
	$final=@implode("\n",$f)."\n";
	@file_put_contents($init_pre,$final);	
	
	
}
开发者ID:rsd,项目名称:artica-1.5,代码行数:56,代码来源:exec.spamassassin.php

示例5: mynetworks

function mynetworks()
{
    if ($GLOBALS["EnablePostfixMultiInstance"] == 1) {
        echo "Starting......: Building mynetworks multiple-instances, enabled\n";
        shell_exec("{$GLOBALS["postconf"]} -e \"mynetworks =127.0.0.0/8\" >/dev/null 2>&1");
        return;
    }
    $ldap = new clladp();
    $nets = $ldap->load_mynetworks();
    if (!is_array($nets)) {
        if ($GLOBALS["DEBUG"]) {
            echo "No networks sets\n";
        }
        shell_exec("{$GLOBALS["postconf"]} -e \"mynetworks =127.0.0.0/8\" >/dev/null 2>&1");
        return;
    }
    $nets[] = "127.0.0.0/8";
    while (list($num, $network) = each($nets)) {
        $cleaned[$network] = $network;
    }
    unset($nets);
    while (list($network, $network2) = each($cleaned)) {
        $nets[] = $network;
    }
    $inline = @implode(", ", $nets);
    $inline = str_replace(',,', ',', $inline);
    $config_net = @implode("\n", $nets);
    echo "Starting......: Building mynetworks " . count($nets) . " Networks ({$inline})\n";
    @file_put_contents("/etc/artica-postfix/mynetworks", $config_net);
    shell_exec("{$GLOBALS["postconf"]} -e \"mynetworks = {$inline}\" >/dev/null 2>&1");
}
开发者ID:brucewu16899,项目名称:artica,代码行数:31,代码来源:exec.postfix.maincf.php

示例6: MyNetworks

function MyNetworks($trust = 1)
{
    $ldap = new clladp();
    $nets = $ldap->load_mynetworks();
    $q = new mysql();
    $nets[] = "127.0.0.0/8";
    while (list($num, $network) = each($nets)) {
        $cleaned[$network] = $network;
    }
    unset($nets);
    while (list($network, $network2) = each($cleaned)) {
        $nets[] = $network;
    }
    $t = explode("\n", @file_get_contents("/etc/hosts"));
    while (list($num, $line) = each($t)) {
        if (preg_match("#^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\\s+(.+?)\\s+#", $line, $re)) {
            echo "Starting......: " . date("H:i:s") . " milter-dkim Internal Host \"{$re[1]}\"\n";
            $nets[] = $re[1];
            $already[$re[1]] = true;
        } else {
            if ($GLOBALS["VERBOSE"]) {
                echo "Starting......: " . date("H:i:s") . " milter-dkim DEBUG HOSTS: {$line}, No match\n";
            }
        }
    }
    $sql = "SELECT *  FROM `postfix_multi` WHERE `key` = 'myhostname'";
    $results = $q->QUERY_SQL($sql, "artica_backup");
    if (!$q->ok) {
        echo "{$q->mysql_error}\n";
    }
    while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
        if (isset($already[$ligne["ip_address"]])) {
            continue;
        }
        if (isset($already[$ligne["value"]])) {
            continue;
        }
        echo "Starting......: " . date("H:i:s") . " milter-dkim Internal Host \"{$ligne["ip_address"]}\"\n";
        echo "Starting......: " . date("H:i:s") . " milter-dkim Internal Host \"{$ligne["value"]}\"\n";
        $nets[] = $ligne["ip_address"];
        $nets[] = $ligne["value"];
        $already[$ligne["ip_address"]] = true;
        $already[$ligne["value"]] = true;
    }
    echo "Starting......: " . date("H:i:s") . " milter-dkim generating internal hosts " . count($nets) . " entries done...\n";
    @file_put_contents("/etc/mail/dkim/internal-hosts", @implode("\n", $nets));
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:47,代码来源:exec.dkim-milter.php

示例7: spamassin_milter

function spamassin_milter()
{
    include_once dirname(__FILE__) . "/ressources/class.spamassassin.inc";
    $spam = new spamassassin();
    $R = null;
    if (intval($spam->main_array["block_with_required_score"]) > 0) {
        $R = " -r {$spam->main_array["block_with_required_score"]} ";
    }
    $ldap = new clladp();
    $ARR[] = "127.0.0.1";
    if (!$ldap->ldapFailed) {
        $nets = $ldap->load_mynetworks();
        while (list($i, $mask) = each($nets)) {
            if (preg_match("#^127\\.0\\.0\\.#", $mask)) {
                continue;
            }
            $ARR[] = $mask;
        }
    }
    $f[] = "#!/bin/sh";
    $f[] = "#";
    $f[] = "# \$Id: spamass-milter.init 553 " . date("Y-m-d H:i:s") . " don \$";
    $f[] = "#";
    $f[] = "# Sample init script for Debian GNU/Linux";
    $f[] = "#";
    $f[] = "#  Copyright (c) 2002 Georg C. F. Greve <greve@gnu.org>,";
    $f[] = "#   all rights maintained by FSF Europe e.V., ";
    $f[] = "#   Villa Vogelsang, Antonienallee 1, 45279 Essen, Germany";
    $f[] = "#";
    $f[] = "#   This program is free software; you can redistribute it and/or modify";
    $f[] = "#   it under the terms of the GNU General Public License as published by";
    $f[] = "#   the Free Software Foundation; either version 2 of the License, or";
    $f[] = "#   (at your option) any later version.";
    $f[] = "#  ";
    $f[] = "#   This program is distributed in the hope that it will be useful,";
    $f[] = "#   but WITHOUT ANY WARRANTY; without even the implied warranty of";
    $f[] = "#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the";
    $f[] = "#   GNU General Public License for more details.";
    $f[] = "#  ";
    $f[] = "#   You should have received a copy of the GNU General Public License";
    $f[] = "#   along with this program; if not, write to the Free Software";
    $f[] = "#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA";
    $f[] = "#";
    $f[] = "#   Contact:";
    $f[] = "#            Michael Brown <michaelb@opentext.com>";
    $f[] = "";
    $f[] = "# This init script was modified on Thu, 30 Jan 2003 02:06:04 -0500 by";
    $f[] = "# Don Armstrong <don@donarmstrong.com> from contrib/spamass-milter to";
    $f[] = "# allow force-reload and options specified in";
    $f[] = "# /etc/default/spamass-milter necessary for inclusion in debian.";
    $f[] = "";
    $f[] = "# It has been modified additionally to support LSB Boot options and";
    $f[] = "# status on Friday, July 6, 2007 14:02:44 PDT";
    $f[] = "";
    $f[] = "";
    $f[] = "### BEGIN INIT INFO";
    $f[] = "# Provides:          spamass-milter";
    $f[] = "# Required-Start:    \$syslog \$local_fs \$remote_fs";
    $f[] = "# Required-Stop:     \$syslog \$local_fs \$remote_fs";
    $f[] = "# Default-Start:     2 3 4 5";
    $f[] = "# Default-Stop:      0 1 6";
    $f[] = "# Short-Description: milter for spamassassin";
    $f[] = "# Description:       Calls spamassassin to allow filtering out";
    $f[] = "#                    spam from ham in libmilter compatible MTAs.";
    $f[] = "### END INIT INFO";
    $f[] = "";
    $f[] = "";
    $f[] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
    $f[] = "NAME=spamass-milter";
    $f[] = "DAEMON=/usr/sbin/spamass-milter";
    $f[] = "SOCKET=/var/run/spamass/spamass.sock";
    $f[] = "PIDFILE=/var/run/spamass/spamass.pid";
    $f[] = "DESC=\"Sendmail milter plugin for SpamAssassin\"";
    $f[] = "";
    $f[] = "DEFAULT=/etc/default/spamass-milter";
    $f[] = "OPTIONS=\"{$R}-u postfix -i " . @implode(",", $ARR) . " -- --socket=/var/run/spamassassin/spamd.sock\"";
    $f[] = "RUNAS=\"postfix\"";
    $f[] = "CHUID=\"\"";
    $f[] = "SOCKETMODE=\"0660\"";
    $f[] = "SOCKETOWNER=\"postfix:postfix\"";
    $f[] = "CHUID=\"--chuid \$RUNAS\";";
    $f[] = "";
    $f[] = "test -x \$DAEMON || exit 0";
    $f[] = "set -e";
    $f[] = "if [ ! -f \"/etc/artica-postfix/settings/Daemons/SpamAssMilterEnabled\" ]; then";
    $f[] = "\techo 0 >/etc/artica-postfix/settings/Daemons/SpamAssMilterEnabled || true";
    $f[] = "fi";
    $f[] = "if [ ! -f \"/etc/artica-postfix/settings/Daemons/EnableAmavisDaemon\" ]; then";
    $f[] = "\techo 0 >/etc/artica-postfix/settings/Daemons/EnableAmavisDaemon || true";
    $f[] = "fi";
    $f[] = "if [ ! -f \"/etc/artica-postfix/settings/Daemons/SpamAssBlockWithRequiredScore\" ]; then";
    $f[] = "\techo 5 >/etc/artica-postfix/settings/Daemons/SpamAssBlockWithRequiredScore || true";
    $f[] = "fi";
    $f[] = "SpamAssMilterEnabled=`cat /etc/artica-postfix/settings/Daemons/SpamAssMilterEnabled`";
    $f[] = "EnableAmavisDaemon=`cat /etc/artica-postfix/settings/Daemons/EnableAmavisDaemon`";
    $f[] = "";
    $f[] = "";
    $f[] = "start() {";
    $f[] = "if [ \$EnableAmavisDaemon != 0 ]; then";
    $f[] = "\techo \"WARNING: \$NAME Not enabled ( see EnableAmavisDaemon [ set to 1] )\";";
//.........这里部分代码省略.........
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:101,代码来源:exec.initslapd.php

示例8: default_outgoing_rule

function default_outgoing_rule()
{
    if (!is_file("/opt/kaspersky/klms/bin/klms-control")) {
        echo "Starting......: " . date("H:i:s") . " Kaspersky Mail security Suite `klms-control` no such binary\n";
        return;
    }
    $unix = new unix();
    $ruleslist = ruleslist();
    $ID = $ruleslist["From Local Network"];
    if (!is_numeric($ID)) {
        $ID = 0;
    }
    echo "Starting......: " . date("H:i:s") . " Kaspersky Mail security Suite default rule ID:{$ID}\n";
    $sock = new sockets();
    $MynetworksInISPMode = $sock->GET_INFO("MynetworksInISPMode");
    $PostfixBadNettr = unserialize(base64_decode($sock->GET_INFO("PostfixBadNettr")));
    if (!is_numeric($MynetworksInISPMode)) {
        $MynetworksInISPMode = 0;
    }
    $ldap = new clladp();
    $NEWAR["127.0.0.1"] = true;
    if ($MynetworksInISPMode == 0) {
        $array = $ldap->load_mynetworks();
        while (list($key, $IP) = each($array)) {
            if (isset($PostfixBadNettr[$IP])) {
                if ($PostfixBadNettr[$IP] == 1) {
                    continue;
                }
            }
            $NEWAR[$IP] = true;
        }
    }
    $tools = new DomainsTools();
    $HashDomains = $ldap->Hash_relay_domains();
    if (is_array($HashDomains)) {
        while (list($num, $ligne) = each($HashDomains)) {
            $arr = $tools->transport_maps_explode($ligne);
            $NEWAR[$arr[1]] = true;
        }
    }
    $q = new mysql();
    $sql = "SELECT ipaddr FROM postfix_whitelist_con";
    $results = $q->QUERY_SQL($sql, "artica_backup");
    while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
        $NEWAR[$ligne["ipaddr"]] = true;
    }
    $f = array();
    $f[] = "<root>";
    $f[] = "    <belongingCriteria>";
    $f[] = "        <sender>";
    while (list($key, $none) = each($NEWAR)) {
        if ($key == null) {
            continue;
        }
        $f[] = "            <item>";
        $f[] = "                <type>CIDR</type>";
        $f[] = "                <value>{$key}</value>";
        $f[] = "            </item>";
    }
    $f[] = "        </sender>";
    $f[] = "        <recipient>";
    $f[] = "            <item>";
    $f[] = "                <type>EMailMask</type>";
    $f[] = "                <value>*</value>";
    $f[] = "            </item>";
    $f[] = "        </recipient>";
    $f[] = "    </belongingCriteria>";
    $f[] = "    <scanSettings>";
    $f[] = "        <ruleDescription>Local networks will be not scanned for outgoing connexions...</ruleDescription>";
    $f[] = "        <active>1</active>";
    $f[] = "        <ruleAction>Scan</ruleAction>";
    $f[] = "        <avScanSettings>";
    $f[] = "            <engineSettings>";
    $f[] = "                <enableScan>1</enableScan>";
    $f[] = "                <maxSizeLimit>0</maxSizeLimit>";
    $f[] = "                <excludedNames />";
    $f[] = "                <excludedFormats>";
    $f[] = "                    <executableCategory>";
    $f[] = "                        <executableWin>0</executableWin>";
    $f[] = "                        <executableMsi>0</executableMsi>";
    $f[] = "                        <executableJava>0</executableJava>";
    $f[] = "                        <executableElf>0</executableElf>";
    $f[] = "                        <executableDeb>0</executableDeb>";
    $f[] = "                        <executableRpm>0</executableRpm>";
    $f[] = "                    </executableCategory>";
    $f[] = "                    <officeCategory>";
    $f[] = "                        <documentSubcategory>";
    $f[] = "                            <msOfficeDoc>0</msOfficeDoc>";
    $f[] = "                            <msOfficeDocx>0</msOfficeDocx>";
    $f[] = "                            <msOfficeDocm>0</msOfficeDocm>";
    $f[] = "                            <msOfficeDot>0</msOfficeDot>";
    $f[] = "                            <msOfficeDotx>0</msOfficeDotx>";
    $f[] = "                            <msOfficeDotm>0</msOfficeDotm>";
    $f[] = "                            <officePdf>0</officePdf>";
    $f[] = "                            <officeXps>0</officeXps>";
    $f[] = "                            <officeRtf>0</officeRtf>";
    $f[] = "                            <officeOdt>0</officeOdt>";
    $f[] = "                            <officeSxw>0</officeSxw>";
    $f[] = "                        </documentSubcategory>";
    $f[] = "                        <spreadsheetSubcategory>";
//.........这里部分代码省略.........
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:101,代码来源:exec.klms.php


注:本文中的clladp::load_mynetworks方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。