<?xml version="1.0" encoding="utf-8"?>
<feed version="0.3"
    xmlns="http://purl.org/atom/ns#"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xml:lang="en">


    <title>Machine Room Cacophony</title>
    <link rel="alternate" type="text/html" href="http://secsup.net/" />
    <tagline>Loud rambling noise</tagline>
    <modified>2008-06-26T05:27:23-05:00</modified>
    <generator url="http://www.pmachine.com/" version="1.4.0">ExpressionEngine</generator>
    <copyright>Copyright (c) 2008, chris</copyright>



    <entry>
      <title>Enabling Malware Blocking via DNS</title>
      <link rel="alternate" type="text/html" href="http://secsup.net/index.php/shaded_grey/comments/enabling_malware_blocking_via_dns/" /> 
      <id>tag:http://secsup.net/,2008:/1.31</id>
      <issued>2008-06-26T04:55:23-05:00</issued>
      <modified>2008-06-26T05:27:23-05:00</modified>
      <summary>Often Malware can be downloaded from websites as an accident (hidden iframe content on compromised websites) or may need to communicate to an update server or control server across the Internet. This can be cut off with the use of the DNS and your local cache &amp;amp; recursive resolver.</summary>
      <created>2008-06-26T04:55:23-05:00</created>
		<author>
		  <name>chris</name>
		  <email>chris@as701.net</email>
		  		</author>
      <dc:subject></dc:subject>
      <content type="text/html" mode="escaped" xml:lang="en-US"><![CDATA[<p>There are quite a few lists of malware download sites available, <a href="http://dns-bh.sagadc.org/" title="http://dns-bh.sagadc.org/">this one</a> seems to have a decently comprehensive list and it comes in a good format <a href="http://www.isc.org/sw/bind/" title="bind">bind</a> configuration format:
</p>
<blockquote>
<br />
zone &#8220;007arcadegames.com&#8221;  {type master; file &#8220;/etc/namedb/blockeddomain.hosts&#8221;;};
<br />
zone &#8220;008i.com&#8221;  {type master; file &#8220;/etc/namedb/blockeddomain.hosts&#8221;;};
<br />
zone &#8220;008k.com&#8221;  {type master; file &#8220;/etc/namedb/blockeddomain.hosts&#8221;;};
<br />
</blockquote>
<p>
SAGA-dc.org even provides the <a href="http://dns-bh.sagadc.org/files/blockeddomain.hosts" title="empty zone file">empty zone file</a>, to do this in an automated fashion:
</p>
<p>
put in your root crontab:
<br />
<blockquote>
<br />
31 0,6,12,18 * * * /usr/bin/wget -q -O - <a href="http://secsup.net/index.php?URL=http://dns-bh.sagadc.org%2Ffiles%2Fspywaredomains.zones" target="_blank" >http://dns-bh.sagadc.org/files/spywaredomains.zones</a> | sed &#8216;s/\/namedb\//\/bind\//&#8217; > /etc/bind/spywaredomains.zones 2>&amp;1  &amp;&amp; pkill -HUP named
<br />
</blockquote>
<p>
setup named to read this new zone info, add to the bottom of your named.conf:
<br />
<blockquote>
<br />
include &#8220;/etc/bind/spywaredomains.zones&#8221;;
<br />
</blockquote>
<p>
Now, anyone that uses your recursive resolver should better protected than before&#8230;
</p>]]></content>
    </entry>

    <entry>
      <title>SSH Key authentication and Tunneling to a proxy host</title>
      <link rel="alternate" type="text/html" href="http://secsup.net/index.php/shaded_grey/comments/ssh_key_authentication_and_tunneling_to_a_proxy_host/" /> 
      <id>tag:http://secsup.net/,2008:/1.30</id>
      <issued>2008-06-23T20:00:34-05:00</issued>
      <modified>2008-06-23T20:28:34-05:00</modified>
      <summary>Someone asked how to set this up quickly and easily&amp;#8230; the idea being:

1) you have a host somewhere on the interwebs that&amp;#8217;s accessible via SSH and runs a squid/proxy for you

2) you have a macintosh

3) you don&amp;#8217;t normally do unix-y things

4) you&amp;#8217;d like a command-line quick and easy setup to allow you to proxy your traffic (web/chat) through your ssh host and sqiud</summary>
      <created>2008-06-23T20:00:34-05:00</created>
		<author>
		  <name>chris</name>
		  <email>chris@as701.net</email>
		  		</author>
      <dc:subject>Macintosh, Networking, Security, Unix</dc:subject>
      <content type="text/html" mode="escaped" xml:lang="en-US"><![CDATA[<p>Mac&#8217;s are unix these days, they have a shell application called: &#8220;Terminal.app&#8221; you&#8217;ll use this to setup the keys and to do the proxy-things later on. Follow these steps
</p>
<p>
1) open Terminal.app (Applications/Utilities/Terminal.all or if you see below and install quicksilver: Cmd-space Term)
</p>
<p>
2) use ssh-keygen to make a key:
</p>
<blockquote>
<br />
mba:~ you$ ssh-keygen -t dsa -f .ssh/id_dsa
<br />
Generating public/private dsa key pair.
<br />
Enter passphrase (empty for no passphrase): (put in your passphrase here)
<br />
Enter same passphrase again: (repeat passphrase)
<br />
Your identification has been saved in .ssh/id_dsa.
<br />
Your public key has been saved in .ssh/id_dsa.pub.
<br />
The key fingerprint is:
<br />
d6:d3:54:79:16:14:ab:42:cf:80:52:6f:9b:55:5e:4e morrowc@mba.local
<br />
</blockquote>
<p>
3) scp that id_dsa.pub to your ssh bastion host
</p>
<blockquote>
<br />
mba:~ you$ scp .ssh/id_dsa.pub you@bastion:.ssh/mba_id_dsa.pub
<br />
Password: (your passwd here)
<br />
</blockquote>
<p>
4) ssh to the bastion and append the mba_id_dsa.pub to your .ssh/authorized_keys file
</p>
<blockquote>
<br />
	bastion:~ you$ cat .ssh/mba_id_dsa.pub >> .ssh/authorized_keys
<br />
	bastion:~ you$ chmod 400 .ssh/authorized_keys
<br />
</blockquote>
<p>
5) exit the ssh and attempt an ssh again, you should be prompted for your passPHRASE not passWORD.
</p>
<p>
All good! Now for the tunneling bits, I suggest:
</p>
<p>
1) 8080 for web traffic (http/https/ftp)
<br />
2) 8000 for chat traffic (aim/gtalk don&#8217;t like squid for some reason, but don&#8217;t mind socks proxying)
</p>
<p>
We&#8217;ll be setting up an alias command that does all the hard work for us, this alias lives in your ~/.bash_profile file, here&#8217;s the setup:
</p>
<p>
1) edit ~/.bash_profile  (vi ~/.bash_profile)
<br />
2) add this
</p>
<blockquote>
<br />
	alias proxy="ssh you@ssh-bastion -D127.0.0.1:8000 -L8080:127.0.0.1:3128&#8221;
<br />
</blockquote>
<p>
Now, to test this, do:
</p>
<blockquote>
<br />
	mba:~ you$ . .bash_profile
<br />
	mba:~ you$ proxy
<br />
</blockquote>
<p>
which should log you into your bastion host and setup the tunnels, which you can verify with firefox/safari provided you setup the proxy-bits on those applications.
</p>
<p>
All this said, i&#8217;d get the following additional applications for your Mac:
</p>
<p>
1) <a href="http://www.adiumx.com/" title="Adium-X">Adium-X</a> the all-over-goodness chat client (yahoo/msn/gtalk/aim and more protocols available)
<br />
2)  <a href="http://mac.softpedia.com/get/Utilities/Quicksilver.shtml" title="QuickSilver">QuickSilver</a> a replacement to the horrid Spotlight searching, includes app launching capabilties as well
</p>]]></content>
    </entry>

    <entry>
      <title>Ubuntu Hardy Heron TCP/Firewall State Table tweaks</title>
      <link rel="alternate" type="text/html" href="http://secsup.net/index.php/shaded_grey/comments/ubuntu_hardy_heron_tcp_firewall_state_table_tweaks/" /> 
      <id>tag:http://secsup.net/,2008:/1.29</id>
      <issued>2008-06-04T21:01:23-05:00</issued>
      <modified>2008-06-04T21:10:23-05:00</modified>
      <summary>Hardy Heron installs just nicely, but it&amp;#8217;s got some issues when it comes to moderate traffic loads and NAT state maintenance&amp;#8230;</summary>
      <created>2008-06-04T21:01:23-05:00</created>
		<author>
		  <name>chris</name>
		  <email>chris@as701.net</email>
		  		</author>
      <dc:subject></dc:subject>
      <content type="text/html" mode="escaped" xml:lang="en-US"><![CDATA[<p>After installation if Hardy Heron, if you use <a href="http://netfilter.org/" title="netfilter/iptables">netfilter/iptables</a> to provide both security and NAT services you may run into issues with nf_conntrack not expiring connection state entries fast enough. After some poking around on <a href="http://www.google.com/" title="google">google</a> I was resigned to rebooting every day, that seemed crappy and almost microsoft-like. So, taking a closer look at the system level variables at my disposal with sysctl I found:
<br />
<blockquote>
<br />
########
<br />
# special additions for tcp speedups
<br />
net/ipv4/tcp_tw_reuse = 1
<br />
net/ipv4/tcp_tw_recycle = 1
<br />
net/core/somaxconn = 1024
<br />
net/ipv4/ip_local_port_range = 2048 65000
<br />
#
<br />
# nf_conntrack additions
<br />
net/netfilter/nf_conntrack_generic_timeout = 300
<br />
net/netfilter/nf_conntrack_tcp_timeout_established = 14400
<br />
net/netfilter/nf_conntrack_tcp_timeout_fin_wait = 20
<br />
net/netfilter/nf_conntrack_tcp_timeout_close_wait = 20
<br />
net/netfilter/nf_conntrack_tcp_timeout_last_ack = 10
<br />
net/netfilter/nf_conntrack_tcp_timeout_time_wait = 20
<br />
net/netfilter/nf_conntrack_tcp_timeout_close = 10
<br />
net/netfilter/nf_conntrack_udp_timeout = 10
<br />
net/netfilter/nf_conntrack_udp_timeout_stream = 30
<br />
net/netfilter/nf_conntrack_icmp_timeout = 5
<br />
</blockquote>
<p>
This reduces some conntrack timeouts significantly, take:
</p>
<blockquote>
<br />
net/netfilter/nf_conntrack_tcp_timeout_established = 14400
<br />
</blockquote>
<p>
for instance which was set to something on the order of: 432000 which is about (432000/86400 = 5 days). So, anything that didn&#8217;t end properly (apparently lots of spambots fall into this category) would stick around for almost 5 days time. With a limit of 65k sessions in the nf_conntrack state-table this is obviously a bad thing. So, add the above text to your /etc/sysctl.conf and reload that with sysctl -p /etc/sysctl.conf&#8230;
<br />

</p>]]></content>
    </entry>

    <entry>
      <title>Firewall Rules to drop Internet Nuisance Networks</title>
      <link rel="alternate" type="text/html" href="http://secsup.net/index.php/shaded_grey/comments/firewall_rules_to_drop_internet_nuisance_networks/" /> 
      <id>tag:http://secsup.net/,2008:/1.28</id>
      <issued>2008-05-22T18:33:37-05:00</issued>
      <modified>2008-05-22T18:54:37-05:00</modified>
      <summary>There are a host of well known (to security folks at the least) nuisance networks. This is a set of simple iptables rules to drop those networks as sources.</summary>
      <created>2008-05-22T18:33:37-05:00</created>
		<author>
		  <name>chris</name>
		  <email>chris@as701.net</email>
		  		</author>
      <dc:subject></dc:subject>
      <content type="text/html" mode="escaped" xml:lang="en-US"><![CDATA[<p>For ease of use, you can <a href="http://www.gnu.org/software/wget/" title="wget">wget</a> to grab the listing which is in the form:
</p>
<blockquote>
<br />
-A INPUT -s ip-block/mask -j DROP
<br />
-A INPUT -s ip-block/mask -j DROP
<br />
-A INPUT -s ip-block/mask -j DROP
<br />
</blockquote>
<p>
downloads available at:
</p>
<p>
<a href="http://secsup.net/files/fw-drop-list.txt" title="linky-loo">linky-loo</a>
</p>
<p>
Obviously you can sed/awk/perl your way into the final listing that fits your model better. Some other resources on blocking known bad traffic can be found over at:
</p>
<p>
<a href="http://www.dshield.org/" title="DShield">DShield</a>
<br />
<a href="http://www.mynetwatchman.com/" title="MyNetWatchman">MyNetWatchman</a>
</p>
<p>
Note that the list I have isn&#8217;t from either of these&#8230; but they are great resources none-the-less.
</p>]]></content>
    </entry>

    <entry>
      <title>Cisco AP1220 IOS upgrade</title>
      <link rel="alternate" type="text/html" href="http://secsup.net/index.php/shaded_grey/comments/cisco_ap1220_ios_upgrade/" /> 
      <id>tag:http://secsup.net/,2008:/1.27</id>
      <issued>2008-04-29T04:11:23-05:00</issued>
      <modified>2008-04-29T04:25:23-05:00</modified>
      <summary>a quicky upgrade tutorial for the AP1220 series aironet wireless access-point.</summary>
      <created>2008-04-29T04:11:23-05:00</created>
		<author>
		  <name>chris</name>
		  <email>chris@as701.net</email>
		  		</author>
      <dc:subject>Networking, Security</dc:subject>
      <content type="text/html" mode="escaped" xml:lang="en-US"><![CDATA[<p>Cisco makes it relatively easy to <a href="http://www.cisco.com/en/US/products/hw/wireless/ps430/products_tech_note09186a008019fea0.shtml" title="upgrade from vxworks to ios">upgrade from vxworks to ios</a> after that you&#8217;ll want to upgrade to some later version (than 12.2(11)JA3 ) GD code like 12.3(8)JEB1  which you can download from ftp.cisco.com and <a href="http://www.cisco.com/en/US/docs/wireless/access_point/12.3_8_JA/configuration/guide/s38mfw.html#wp1034890" title="follow the instructions">follow the instructions</a> which are essentially:
<br />
<ul>
<li> make software .tar available via tftp
<li> login to AP
<li> enable
<li> archive download-sw /overwrite  tftp://tftpboot-server/c1200-k9w7-tar.123-8.JEB1.tar
<li> copy run start
<li> reboot
<li> rejoice
</ul>
<p>
Hopefully that all works out well, of course you may want to copy your config elsewhere just in case&#8230;
<br />

</p>]]></content>
    </entry>

    <entry>
      <title>GPG key expiring or not</title>
      <link rel="alternate" type="text/html" href="http://secsup.net/index.php/shaded_grey/comments/gpg_key_expiring_or_not/" /> 
      <id>tag:http://secsup.net/,2008:/1.26</id>
      <issued>2008-04-01T05:37:07-05:00</issued>
      <modified>2008-04-01T06:00:06-05:00</modified>
      <summary>So, after a period of time your GPG key will expire, if you want it to expire, that&amp;#8217;s good news. If you happen to still be using it, not so good news. Simple un-expire instructions follow.</summary>
      <created>2008-04-01T05:37:07-05:00</created>
		<author>
		  <name>chris</name>
		  <email>chris@as701.net</email>
		  		</author>
      <dc:subject>Security, Unix</dc:subject>
      <content type="text/html" mode="escaped" xml:lang="en-US"><![CDATA[<p>Start with finding your current key-id:
<br />
<code>
<br />
gpg --list-keys | more
<br />
</code>
<p>
Edit the key in question:
<br />
<code>
<br />
gpg --edit &lt;keyid&gt;
<br />
</code>
<p>
use the commands: 
<br />
<ol>
<li>key - select the key inside edit-mode
<li>expire - change expire date inside edit-mode (set date to sometime in the future)
<li>remember to select the primary and secondary keys and repeat expire command
<li>save - save your work and get outta there!
</ol>
<p>
All done! easy-peasy&#8230; 
</p>]]></content>
    </entry>

    <entry>
      <title>Short and Sweet instructions for GeekTool and gcal display</title>
      <link rel="alternate" type="text/html" href="http://secsup.net/index.php/shaded_grey/comments/short_and_sweet_instructions_for_geektool_and_gcal_display/" /> 
      <id>tag:http://secsup.net/,2007:/1.25</id>
      <issued>2007-12-28T19:54:48-05:00</issued>
      <modified>2007-12-28T21:49:48-05:00</modified>
      <summary>I wanted to take the parts of GeekTool and this  lifehacker column on taking gCal and displaying it on your macintosh desktop which is fully documented by Devan Goldstein though I admit that he uses some tricks I&amp;#8217;d rather avoid.</summary>
      <created>2007-12-28T19:54:48-05:00</created>
		<author>
		  <name>chris</name>
		  <email>chris@as701.net</email>
		  		</author>
      <dc:subject></dc:subject>
      <content type="text/html" mode="escaped" xml:lang="en-US"><![CDATA[<p><a href="http://lifehacker.com/software/mac-tip/embed-google-calendar-agenda-into-the-desktop-295356.php" title="LifeHacker">LifeHacker</a> had a decent writeup on taking your gcal and grabbing it via some perl and shell foo then using <a href="http://projects.tynsoe.org/en/geektool/" title="GeekTool">GeekTool</a> to display the resulting formatted text file on your computer desktop. The actual meat of the work was done by <a href="http://www.devangoldstein.com/87/bringing-google-calendar-to-my-desktop/" title="Devan Goldstein">Devan Goldstein</a> though his discussion and methods aren&#8217;t something I&#8217;m necessarily &#8216;ok&#8217; with and quite long. I&#8217;ll try to make it here in a much shorter format and use cron instead of launchd.
</p>
<p>
Initially a few software/things will be required:
<br />
<ul>
<li>some perl modules - XML::Simple, Date::Parse, Data::Dumper (installed via perl -MCPAN -e shell)
<li>curl
<li>perl
</ul>
<p>
To get the feed data you&#8217;ll have to grab the calendar private URL from gcal:
<br />
Calendar settings -> calendars -> select-your-cal -> click-on-private-xml-url -> copy link
</p>
<p>
Then save that away in a txt file for your use later. I like cron for repeating tasks, Devan says it may be deprecated and going away past 10.4 I&#8217;ll check my 10.5 machine later and see if this will last past an upgrade. We&#8217;ll use cron and curl to grab the URL and save that in a file for later processing.
</p>
<p>
the crontab entry looks like:
<br />
<blockquote>
<br />
*/10 * * * * /usr/bin/curl -f -s {private xml url} -o {destination for .gcalfeed.xml} > /tmp/gcal-feed.log 2>&amp;1
<br />
</blockquote>
<p>
Now that the data will get pulled down each 10 minutes we can use <a href="http://www.devangoldstein.com/dblog/wp-content/uploads/gcalpl.txt" title="Devan's perl-foo">Devan&#8217;s perl-foo</a> to massage that into something geektool will display. I believe I made some changes to this script at home, I&#8217;ll find those and  post a diff so that others can benefit from whatever changes I made.
</p>
<p>
Now, make <a href="http://projects.tynsoe.org/en/geektool/" title="GeekTool">GeekTool</a>do it&#8217;s magic running the script every 10 mins and displaying that out on your desktop:
<br />
<blockquote>
</blockquote>
</p>]]></content>
    </entry>

    <entry>
      <title>SWIP Information for Verizon FiOS Business Customers</title>
      <link rel="alternate" type="text/html" href="http://secsup.net/index.php/shaded_grey/comments/swip_information_for_verizon_fios_business_customers/" /> 
      <id>tag:http://secsup.net/,2007:/1.24</id>
      <issued>2007-10-05T02:13:27-05:00</issued>
      <modified>2007-10-05T02:37:27-05:00</modified>
      <summary>The long and sad story of complying with ARIN policies with respect to private residence SWIP information.</summary>
      <created>2007-10-05T02:13:27-05:00</created>
		<author>
		  <name>chris</name>
		  <email>chris@as701.net</email>
		  		</author>
      <dc:subject></dc:subject>
      <content type="text/html" mode="escaped" xml:lang="en-US"><![CDATA[<p>Essentially ths tory is this:
</p>
<p>
1) you are a FiOS customer
<br />
2) you decide you want &#8216;static ip addresses&#8217;
<br />
3) you realize this means you need to switch from &#8216;residential service&#8217; to &#8216;business service&#8217;
<br />
4) you realize you want more than 1 IP address
</p>
<p>
you start paying (note that paying for ip addresses is also against the ARIN policies) 40$/month for 5 ip addresses, you then realize that your personal information is being included in the SWIP data ala:
</p>
<p>
Verizon Internet Services Inc. VIS-BLOCK (NET-71-240-0-0-1) 
<br />
                                  71.240.0.0 - 71.255.255.255
<br />
Maysenstein,Sally FTTP (NET-71-246-230-120-1) 
<br />
                                  71.246.230.120 - 71.246.230.127
</p>
<p>
So, you call tech support (1-800-553-1555) and open 6 tickets talking to 6 different techs, all of which say: &#8220;if you want to make that info private you can&#8217;t cause it&#8217;s a business account, get a residential account and it&#8217;ll all be private&#8221;. Note that the logic of: &#8220;I want static ips, so I must have business service&#8221; is lost on the tech support folks, all save one I talked to today a nice fellow named: &#8220;Laston&#8221;. (most even implied it was illegal effectively to privatize this information, despite the ARIN policy bits that clearly state it as an option, and even include wording to this effect in the <a href="http://www.arin.net/registration/templates/reassign-simple.txt" title="reassign-simple.txt">reassign-simple.txt</a>)
</p>
<p>
Finally the answer is basicaly you can initiate this change on your own without involving tech support, email your request to: IPMGMT@verizon.com and within the day your information will turn into:
</p>
<p>
Verizon Internet Services Inc. VIS-BLOCK (NET-71-240-0-0-1) 
<br />
                                  71.240.0.0 - 71.255.255.255
<br />
Private customer - Verizon Internet Services Inc. FTTP (NET-71-246-230-120-1) 
<br />
                                  71.246.230.120 - 71.246.230.127
</p>
<p>
How very nice of Verizon, please take the time to thank the IPMGMT folks (Mike L in particular).
</p>]]></content>
    </entry>

    <entry>
      <title>Hey lookie, a patent?</title>
      <link rel="alternate" type="text/html" href="http://secsup.net/index.php/shaded_grey/comments/hey_lookie_a_patent/" /> 
      <id>tag:http://secsup.net/,2007:/1.22</id>
      <issued>2007-05-15T01:14:00-05:00</issued>
      <modified>2007-05-15T01:21:00-05:00</modified>
      <summary>Work had is go over all our work from the last year looking for possible patentable things, this is the result (one result I suppose).</summary>
      <created>2007-05-15T01:14:00-05:00</created>
		<author>
		  <name>chris</name>
		  <email>chris@as701.net</email>
		  		</author>
      <dc:subject>Networking, Security</dc:subject>
      <content type="text/html" mode="escaped" xml:lang="en-US"><![CDATA[<p>Thanks to a <a href="http://log.earlax.com/work/" title="co-worker">co-worker</a> I was reminded of the long process of trying to find things we had accomplished which might be &#8216;new&#8217; or &#8216;patentable&#8217;. We were told that parts of our <a href="http://www.verizonbusiness.com/us/govt/ent_svcs/security/mgd_security/wan_defense/" title="DDoS Mitigation">DDoS Mitigation</a> product design might be patentable. The corporate legal folks went ahead and did all the paperwork to submit our <a href="http://appft1.uspto.gov/netacgi/nph-Parser?Sect1=PTO1&amp;Sect2=HITOFF&amp;d=PG01&amp;p=1&amp;u=%2Fnetahtml%2FPTO%2Fsrchnum.html&amp;r=1&amp;f=G&amp;l=50&amp;s1=%2220060236394%22.PGNR.&amp;OS=DN/20060236394&amp;RS=DN/20060236394" title="patentable portion of the product">patentable portion of the product</a>!
</p>
<p>
Hurray for us!
</p>]]></content>
    </entry>

    <entry>
      <title>Some simple postfix processing things</title>
      <link rel="alternate" type="text/html" href="http://secsup.net/index.php/shaded_grey/comments/some_simple_postfix_processing_things/" /> 
      <id>tag:http://secsup.net/,2007:/1.21</id>
      <issued>2007-03-25T14:19:18-05:00</issued>
      <modified>2007-05-15T01:21:17-05:00</modified>
      <summary>Postfix has a bunch of queues, and a bunch of stats through other packages, how about some simple shell things if you have multiple instances running?</summary>
      <created>2007-03-25T14:19:18-05:00</created>
		<author>
		  <name>chris</name>
		  <email>chris@as701.net</email>
		  		</author>
      <dc:subject>Unix</dc:subject>
      <content type="text/html" mode="escaped" xml:lang="en-US"><![CDATA[<p>So, if you have a bunch of <a href="http://www.postfix.org/" title="postfix">postfix</a> processes with independent queues on your system how do you keep track of things like:
<br />
<ol>
<li> which destinations are not accepting email today from you?
<li> which queues need to be flushed?
<li> how many messages in a given timeframe to how many actual recipients?
<li> delete all remaining &#8216;outdated&#8217; messages in the queue
</ol>
<p>
Simple just use your old friend awk/sed/for&#8230; your shell. 
</p>
<p>
To see what things are backed up:
<br />
<pre>
for d in `find postfix-IP* -type f -print | grep def | grep -v pid | grep -v config ` ; do \
  grep "^reci" ${d}  >> /tmp/recips 
done

awk -F\@ '{print $2}' /tmp/recips  | sort | uniq -c | sort -rn |more
</pre>
</p>
<p>
This assumes that all your postfix config directories are in something remote named like: &#8220;postfix-IP&#8221;, adjust that to your needs, of course. To flush the queues for all your postfix instances:
<br />
<pre>
for d in `ls -d postfix-IP*/config` ; do 
  postqueue -c ${d} -f
done
</pre>
<br />
(again assuming postfix-IP* is your postfix config/install locations)
</p>
<p>
To get some stats in a running-total sort of manner:
<br />
<pre>
while : ; do 
   perl -e 'print time()' >> /tmp/mail-stats.log 
   grep "some-uniq-to-line" mail.log | \
                                    grep nrcpt | \
                   awk -F"nrcpt=" '{print $2}' | \
   awk '{TOT=TOT + $1; ALL=ALL + 1} END{ print " connects: " ALL " reciepts: " TOT}' >> /tmp/mail-stats.log 
   sleep 30 
done
</pre>
</p>
<p>
This will make a file in /tmp called mail-stats.log which has about this sort of content:
<br />
<pre>
1174833091 connects: 17405 reciepts: 52372
1174833121 connects: 17433 reciepts: 52481
</pre>
</p>
<p>
which you can later parse and report on via perl or excel (yick) or whatever you prefer&#8230; &#8216;connects&#8217; means messages sent through the system, &#8216;reciepts&#8217; means number of addresses uniquly sent. This is for instances where you send a message like:
<br />
<pre>
To: mom, dad
From: you
Subject: Lookie ma, no hands!

look, I typed with my feets!
</pre>
</p>
<p>
Now, to delete all the old messages lost in the queue let&#8217;s do this:
<br />
<pre>
for d in `ls -d /full-path/to/postfix-IP*/config` ; do 
  postsuper -c${d} -d ALL defer 
done
</pre>
</p>
<p>
Simple, eh? shell commands&#8230; lost in space!
<br />

</p>]]></content>
    </entry>


</feed>