<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Computer Support &#187; filter</title>
	<atom:link href="http://www.xiitec.com/blog/tag/filter/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.xiitec.com/blog</link>
	<description></description>
	<lastBuildDate>Wed, 30 Dec 2009 08:40:28 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Filtering Outbound Mail with procmail</title>
		<link>http://www.xiitec.com/blog/2009/02/13/filtering-outbound-mail-with-procmail/</link>
		<comments>http://www.xiitec.com/blog/2009/02/13/filtering-outbound-mail-with-procmail/#comments</comments>
		<pubDate>Fri, 13 Feb 2009 17:47:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Sendmail]]></category>
		<category><![CDATA[filter]]></category>

		<guid isPermaLink="false">http://www.xiitec.com/blog/?p=250</guid>
		<description><![CDATA[You want to configure sendmail to filter mail addressed to specific   domains using procmail as the mail filtering   software

Build a mailertable that routes mail bound for specific   domains through the procmail mailer.
Create a file in the /etc/procmailrcs directory that   defines the specific filtering needed. Multiple filters can [...]]]></description>
			<content:encoded><![CDATA[<p>You want to configure sendmail to filter mail addressed to specific   domains using procmail as the mail filtering   software</p>
<p><span id="more-250"></span></p>
<p>Build a <em>mailertable</em> that routes mail bound for specific   domains through the procmail mailer.</p>
<p>Create a file in the <em>/etc/procmailrcs</em> directory that   defines the specific filtering needed. Multiple filters can be used.</p>
<p>Create a sendmail configuration that enables the <em>mailertable</em> feature and adds procmail to   the list of available mailers. Here are the lines that should be added to the   sendmail configuration:</p>
<pre>dnl Enable support for the mailertable

FEATURE(`mailertable')

dnl Add procmail to the list of available mailers

MAILER(procmail)</pre>
<p>Build the <em>sendmail.cf</em> file, copy it to <em>/etc/mail/sendmail.cf</em></p>
<p>The MAILER(procmail) macro adds the procmail   mailer definition to the <em>sendmail.cf</em> file. The procmail mailer   is not related to the <em>local_procmail</em> feature. A system can use the   procmail mailer without using procmail   as a local mailer, and procmail can be   used as a local mailer without adding the MAILER(procmail)   macro to the configuration.</p>
<p>The MAILER(procmail) macro does not add any code to   the configuration to use the procmail mailer. You must either add   custom <em>sendmail.cf</em> rules to reference the mailer, or route mail through   the procmail mailer using the <em>mailertable</em>. Using the <em>mailertable</em> is the easiest and the recommended way to access the mailer.   Here we add <em>mailertable</em> entries that invoke procmail:</p>
<pre># <strong>cd /etc/mail </strong>

# <strong>cat &gt;&gt; mailertable </strong>

example.com       procmail:/etc/procmailrcs/spam-filter

wrotethebook.net  procmail:/etc/procmailrcs/spam-filter

fake.ora.com      procmail:/etc/procmailrcs/uce-filter  <em>

Ctrl-D </em>

# <strong>makemap hash mailertable &lt; mailertable </strong></pre>
<p>The example adds three entries to the <em>mailertable</em> that   route mail through the procmail mailer. The first field in a <em>mailertable</em> entry is the key against which the recipient address is   matched. The second field is the <em>mailer</em> value and the <em>host</em> value that sendmail uses to build the mail delivery triple.   In this example, mail with a matching recipient address is routed through the   procmail mailer. A few tests of a system running  show   this:</p>
<pre># <strong>sendmail -bv crooks@example.com</strong>

crooks@example.com... deliverable: mailer procmail, host /etc/procmailrcs/

spam-filter, user crooks@example.com

# <strong>sendmail -bv spammers@wrotethebook.net</strong>

spammers@wrotethebook.net... deliverable: mailer procmail, host /etc/procmailrcs/

spam-filter, user spammers@wrotethebook.net

# <strong>sendmail -bv thieves@fake.ora.com</strong>  thieves@fake.ora.com... deliverable: mailer procmail,

 host /etc/procmailrcs/  uce-filter, user thieves@fake.ora.com</pre>
<p>When mail is routed to the procmail mailer, the host   value ($h) must contain the pathname of the <em>rc</em>-file that procmail should use to filter the mail. In the example   above, two different filters, <em>spam-filter</em> and <em>uce-filter</em>, are   passed to procmail depending on the destination   of the email. sendmail calls procmail from the   procmail mailer using the following command:</p>
<pre>procmail -Y -m $h $f $u</pre>
<p>The -Y flag tells procmail to use the Berkeley Unix mailbox format. The   -m flag runs procmail as a   general-purpose mail filter. The first argument that follows the -m   flag must be the path of the <em>rc</em>-file that contains the procmail filter. sendmail assigns the host   value returned by the <em>mailertable</em> lookup to the $h macro, which   it then passes to procmail as the first argument   after the -m flag. Therefore, the <em>host</em> field of a <em>mailertable</em> entry that uses the procmail mailer must contain the   full pathname of an <em>rc</em>-file.</p>
<p>The next two arguments passed to procmail are the envelope sender email address   ($f) and the envelope recipient email address ($u). These   values are available inside the procmail <em>rc</em>-file as variables $1 and $2, respectively.</p>
<p>One common technique for avoiding a loop is to add the   pseudodomain .PROCMAIL to the recipient address when mail is resent to   the original recipient. The pseudodomain ensures that the recipient address no   longer matches a value in the <em>mailertable</em>, which breaks the loop. The   pseudodomain is added by procmail commands in the <em>rc</em>-file. However, a properly configured rc-file is not the complete solution.   .PROCMAIL is not a real domain, so code must be added to the <em>sendmail.cf</em> file to ensure that the pseudodomain is properly handled. The   following m4 macros and <em>sendmail.cf</em> code,   added to the end of the this recipe&#8217;s master configuration file, handle the   .PROCMAIL pseudodomain, if one is added by the <em>rc</em>-file:</p>
<pre>LOCAL_CONFIG

# Add .PROCMAIL to the pseudo-domain list

CP.PROCMAIL

LOCAL_RULE_0

# Strip .PROCMAIL and send via esmtp

R$+ &lt; @ $+ .PROCMAIL . &gt;        $#esmtp $@ $2 $: $1&lt;@$2&gt;</pre>
<p>The LOCAL_CONFIG macro marks the start of code that is   to be added to the local information section of the <em>sendmail.cf</em> file. In   this example, we add a comment and a C command to the local information   section. The C command adds .PROCMAIL to class P.   Class P lists pseudodomains that sendmail should not attempt to lookup   in the DNS. Adding .PROCMAIL to class P avoids the delays and   wasted resources that occur when sendmail looks up a domain name that does not   exist.</p>
<p>The LOCAL_RULE_0 macro marks the start of <em>sendmail.cf</em> code that is added to ruleset 0—more commonly called the   parse ruleset. Specifically, the code that follows the   LOCAL_RULE_0 macro is added to the ParseLocal ruleset, which   is a hook into the parse ruleset where locally defined rules are   addedThe parse ruleset   rewrites the delivery address to a mail delivery triple.</p>
<p>The code that follows the LOCAL_RULE_0 macro in the   example is a comment and a rewrite rule. The R command matches input   addresses of the form <em>user</em>@<em>domain</em>.PROCMAIL, and   rewrites those addresses into a mail delivery triple where the mailer is   esmtp, the host value is <em>domain</em>, and the user value is <em>user</em>@<em>domain</em>. After rebuilding the   configuration with the new master configuration file, running a   sendmail -bv test shows the impact of this rewrite rule:</p>
<pre># <strong>sendmail -bv crooks@example.com.PROCMAIL</strong>

crooks@example.com.PROCMAIL... deliverable: mailer esmtp, host example.com,

user   crooks@example.com</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.xiitec.com/blog/2009/02/13/filtering-outbound-mail-with-procmail/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Filtering Local Mail with procmail</title>
		<link>http://www.xiitec.com/blog/2009/02/13/filtering-local-mail-with-procmail/</link>
		<comments>http://www.xiitec.com/blog/2009/02/13/filtering-local-mail-with-procmail/#comments</comments>
		<pubDate>Fri, 13 Feb 2009 17:42:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Sendmail]]></category>
		<category><![CDATA[filter]]></category>

		<guid isPermaLink="false">http://www.xiitec.com/blog/?p=249</guid>
		<description><![CDATA[You want to filter mail with procmail before making deliveries to local users

Add the local_procmail feature to the sendmail configuration, placing the FEATURE macro after the OSTYPE macro and before the MAILER(`local&#8217;) line in the master configuration file. Values for the local mailer are usually set in the OSTYPE file. Carefully review the file for [...]]]></description>
			<content:encoded><![CDATA[<p>You want to filter mail with procmail before making deliveries to local users</p>
<p><span id="more-249"></span></p>
<p>Add the local_procmail feature to the sendmail configuration, placing the FEATURE macro after the OSTYPE macro and before the MAILER(`local&#8217;) line in the master configuration file. Values for the local mailer are usually set in the OSTYPE file. Carefully review the file for your operating system. Add the local_procmail feature to your master configuration file only if local_procmail is not already included in the OSTYPE file.</p>
<p>Create an /etc/procmailrc file containing the filters you want to apply to local mail.</p>
<p>Build and install the new configuration</p>
<p>The linux.m4 OSTYPE file contains the local_procmail feature because procmail is the local mailer used by default on most Linux systems. On a Linux system, just running a configuration that uses the linux.m4 OSTYPE file is sufficient. Other systems are not so easy. For example, assume you have a Solaris 8 system. The solaris8.m4 OSTYPE file uses the local_lmtp feature to set mail.local as the local mailer. To change the local mailer to procmail, override the local_lmtp feature by placing the local_procmail feature in the master configuration file. Here is an example based on the generic-solaris.mc file:</p>
<p>VERSIONID(`Solaris with local_procmail added&#8217;)<br />
OSTYPE(solaris2)<br />
DOMAIN(generic)<br />
dnl Add the local_procmail feature<br />
FEATURE(`local_procmail&#8217;)<br />
MAILER(local)<br />
MAILER(smtp)</p>
<p>Because the local_procmail feature occurs after the OSTYPE macro, it overrides the local_lmtp feature defined in the OSTYPE file. The local_procmail feature is enabled once the sendmail.cf file is built, copied to sendmail.cf, and sendmail is restarted.</p>
<p>When the local_procmail feature is used, sendmail passes local mail to procmail for delivery. procmail processes the mail, first using the commands defined in the /etc/procmailrc file and then using the commands defined in the .procmailrc file in the recipient&#8217;s home directory. If no rc file is defined, procmail writes the mail to the user&#8217;s mailbox unaltered. Note that the user&#8217;s .procmailrc file is applied to mail delivered by the local_procmail feature. When local_procmail is used, it is not necessary for the user to call the procmail program from the .forward file. All the user needs to do is create a .procmailrc file and it will be applied to the mail. Using procmail as a local mailer allows both the system administrator and the user to filter inbound mail with procmail.</p>
<p>When procmail is used as the local mailer, sendmail runs it with three arguments: -Y, -a, and -d. The -Y argument tells procmail to use the standard Berkeley Unix mailbox format. The -d argument provides procmail with the username of the local recipient who is to receive the mail (in the mail delivery triple this is the user value). The -a argument passes an optional value to procmail that is accessible inside the procmail as the $1 variable; in the mail delivery triple, this is the host value. sendmail only passes a value through -a when either the +detail syntax is used or mail is routed to the local mailer via the mailertable. In the case of the +detail syntax, the detail value is passed. In the case of the mailertable, the input address that was the key to the mailertable entry is the value passed. In all other cases, no value is passed by the -a argument and the $1 variable is unassigned.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xiitec.com/blog/2009/02/13/filtering-local-mail-with-procmail/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Configuring TCP/IP Filtering</title>
		<link>http://www.xiitec.com/blog/2008/02/15/configuring-tcpip-filtering/</link>
		<comments>http://www.xiitec.com/blog/2008/02/15/configuring-tcpip-filtering/#comments</comments>
		<pubDate>Fri, 15 Feb 2008 23:38:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Networking]]></category>
		<category><![CDATA[configure]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[TCP/IP]]></category>

		<guid isPermaLink="false">http://www.xiitec.com/blog/?p=136</guid>
		<description><![CDATA[This filtering is applied to inbound traffic and does not affect outbound  traffic.

Using a graphical user interface

 Open the Control Panel.
From the Network Connections applet, open the connection you want to configure.
Click the Properties button.
Select Internet Protocol (TCP/IP).
Click the Properties button.
Click the Advanced button.
Click the Options tab.
Select TCP/IP filtering.
Click the Properties button.
Check the box [...]]]></description>
			<content:encoded><![CDATA[<p>This filtering is applied to inbound traffic and does not affect outbound  traffic.</p>
<p><span id="more-136"></span></p>
<p><strong>Using a graphical user interface</strong></p>
<ol>
<li> Open the Control Panel.</li>
<li>From the Network Connections applet, open the connection you want to configure.</li>
<li>Click the Properties button.</li>
<li>Select Internet Protocol (TCP/IP).</li>
<li>Click the Properties button.</li>
<li>Click the Advanced button.</li>
<li>Click the Options tab.</li>
<li>Select TCP/IP filtering.</li>
<li>Click the Properties button.</li>
<li>Check the box beside Enable TCP/IP Filtering.</li>
<li>Select Permit Only for TCP Ports, UDP Ports, and/or IP Protocols.</li>
<li>Click the Add button.</li>
<li>Enter the port or protocol number and click OK.</li>
<li>Repeat the last couple of steps until you&#8217;ve entered all desired ports and protocols.</li>
<li>After you are done, close all the dialog screens by clicking either OK or Close.</li>
<li>You will be prompted to reboot for the changes to take effect.</li>
</ol>
<p><strong>Using a command-line interface</strong></p>
<p>The following command enables TCP/IP filtering:</p>
<pre>&gt; reg add HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters /vEnableSecurityFilters /t REG_DWORD /d 1</pre>
<p>You must reboot for the changes to take effect. To disable  filtering, change <tt>/d</tt> <tt>1</tt> to <tt>/d</tt> <tt>0</tt>.</p>
<p>Next, configure the protocols and ports you want to filter.  This must be done on a per-interface basis. To configure this using the  registry, you need to know the GUID assigned to the interface you want to  modify. This is a sample interface entry:</p>
<pre>HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\{07383FC4-FF4D-4E16-9DD6-C27061719D76}</pre>
<p>To find out what adapter that corresponds with, you can use  this command (on Windows Server 2003):</p>
<pre>&gt; wmic nicconfig get caption,settingid</pre>
<p>Once you know the GUID of the interface, you can use the  <tt>reg</tt> <tt>add</tt> command to modify the <tt>RawIPAllowedProtocols</tt>,  <tt>TCPAllowedPorts</tt>, or <tt>UDPAllowedPorts</tt> values to filter what you  want. Each of those values is of type REG_MULTI_SZ. Here is an example of  setting protocols 25 and 80:</p>
<pre>reg add HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\{07383FC4-FF4D-4E16-9DD6-C27061719D76} /v RawIPAllowedProtocols /t REG_MULTI_SZ /d 25\080</pre>
<p>You can also use the WMIC utility to configure TCP/IP  filtering. These two commands show you how:</p>
<pre>&gt; wmic /node:"<tt><em>&lt;ServerName&gt;</em></tt>" nicconfig call EnableIPFilterSec(1)&gt; wmic /node:"<tt><em>&lt;ServerName&gt;</em></tt>" nicconfig where ipenabled=True call EnableIPSec

(<tt><em>&lt;TCPPortList&gt;</em></tt>),(<tt><em>&lt;UDPPortList&gt;</em></tt>),(<tt><em>&lt;ProtoList&gt;</em></tt>)</pre>
<p>This command allows all TCP and UDP ports, but allows only  protocols 80 (http) and 25 (smtp):</p>
<pre>&gt; wmic nicconfig where ipenabled=True call EnableIPSec (80,25),(0),(0)</pre>
<p><strong>Using VBScript</strong></p>
<pre>' This code enables IP Filtering for all adapters and configures' filtering for all IP-enabled adapters.

' ------ SCRIPT CONFIGURATION ------

strComputer = "."

arrTCPPorts = Array ( 0 )       ' Allow all TCP ports

arrUDPPorts = Array ( 0 )       ' Allow all UDP ports

arrProtos   = Array ( 80, 25 )  ' Allow only HTTP and SMTP

' ------ END CONFIGURATION ---------

set objWMI = GetObject("winmgmts:\\" &amp; strComputer &amp; "\root\cimv2")

set objAdapterConfig = objWMI.Get("Win32_NetworkAdapterConfiguration")

intRC = objAdapterConfig.EnableIPFilterSec( True )

if intRC = 0 then

WScript.Echo "IP Filtering for all adapters enabled"

elseif intRC = 1 then

WScript.Echo "IP Filtering enabled for all adapters, " &amp; _

"but you must reboot for the changes to take effect"

else

WScript.Echo "There was an error enabling IP Filtering for all " &amp; _

"adapters: " &amp; intRC

end ifset colNAConfigs = objWMI.ExecQuery( _

"select * " &amp; _

" from Win32_NetworkAdapterConfiguration " &amp; _

" where IPEnabled = True" )

for each objNAConfig in colNAConfigs

intRC = objNAConfig.EnableIPSec( arrTCPPorts, arrUDPPorts, arrProtos )

if intRC = 0 then

WScript.Echo "IP Filtering configured for '" &amp; _

objNAConfig.Description &amp; "'"

elseif intRC = 1 then

WScript.Echo "IP Filtering configured for '" &amp; objNAConfig.Description &amp; _

"', but you must reboot for the changes to take effect"

else

WScript.Echo "There was an error configuring IP Filtering for '" &amp; _

objNAConfig.Description &amp; "': " &amp; intRC

end if

next</pre>
<p>Filtering by port or protocol can be useful in certain  situations, but be aware of the limitations. A good example of when you might  want to configure filtering is for external web servers. If your web server is  running on the default HTTP port (80) and it is running no other networked  application, then you only need port 80 open. But allowing only port 80 traffic  also prevents the server from acting as a member in an Active Directory domain  (which requires several ports to be open) and makes remote administration  difficult because you can&#8217;t connect using the Terminal Services client.  Obviously you can add these ports to the list you allow, but remember that if  you do port/protocol filtering, you must have the ports/protocols open that are  needed to support the machine.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xiitec.com/blog/2008/02/15/configuring-tcpip-filtering/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
