<?xml version="1.0" encoding="utf-8"?>
			
			<rss version="2.0">
			<channel>
			<title>Andrew Schwabe&apos;s Blog - Qmail</title>
			<link>http://blog.schwabe.net/index.cfm</link>
			<description>Flex and CF and all things Wack.</description>
			<language>en-us</language>
			<pubDate>Fri, 10 Sep 2010 17:53:22 -0400</pubDate>
			<lastBuildDate>Mon, 12 Mar 2007 02:00:00 -0400</lastBuildDate>
			<generator>BlogCFC</generator>
			<docs>http://blogs.law.harvard.edu/tech/rss</docs>
			<managingEditor>aschwabe@schwabe.net</managingEditor>
			<webMaster>aschwabe@schwabe.net</webMaster>
			
			
			
			
			
			<item>
				<title>Qmail rcptcheck patch posted</title>
				<link>http://blog.schwabe.net/index.cfm/2007/3/12/Qmail-rcptcheck-patch-posted</link>
				<description>
				
				&lt;p&gt;It has come to my attention that the checkrcpt patch for qmail seems to have disappeared from earth.&amp;nbsp; So here is my copy of the patch, reposted along with some other helpful files.&lt;/p&gt;
&lt;p&gt;Note: This is for qmail+vpopmail only.&amp;nbsp; You should be running supervise, and a &amp;quot;run&amp;quot; file is supplied that has the appropriate config for this patch.&lt;/p&gt;
&lt;p&gt;No warranty expressed, offerred, blah blah blah.&amp;nbsp; Use it at your own risk.&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;&lt;a href=&quot;http://job2.iexp.com/qmail_patch/&quot;&gt;http://job2.iexp.com/qmail_patch/&lt;/a&gt;&lt;/font&gt;&lt;/p&gt;
				
				</description>
						
				
				<category>Qmail</category>				
				
				<pubDate>Mon, 12 Mar 2007 02:00:00 -0400</pubDate>
				<guid>http://blog.schwabe.net/index.cfm/2007/3/12/Qmail-rcptcheck-patch-posted</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>vchkrcpt.sh - my kick butt script for vpopmail</title>
				<link>http://blog.schwabe.net/index.cfm/2007/1/12/vchkrcpt.sh--my-kick-butt-script-for-vpopmail</link>
				<description>
				
				&lt;p&gt;This script is for those who have build a qmail+vpopmail server (including qmr and some of the other distributions).&lt;/p&gt;
&lt;p&gt;This script also requires the vchkrcpt patch, which you may need to mangle to work with your config.&amp;nbsp; It seems that this patch fell through the cracks and didn&apos;t get into most of the main distributions.&amp;nbsp; It is a terrible shame, because almost all default qmail setups have a severe security issue:&amp;nbsp; they accept all email for a domain, and if an account doesn&apos;t exist, they bounce it later.&amp;nbsp; This is terrible, what with the age of SpamCop and other &amp;quot;spam trap&amp;quot; and realtime black hole lists out there.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;Ponder this batman:&amp;nbsp; Somebody spams you at your domain with a bad recipient address like &lt;a href=&quot;mailto:not_there@yourcompany.com&quot;&gt;not_there@yourcompany.com&lt;/a&gt;&amp;nbsp;and forges the sender to be some spamtrap like &lt;a href=&quot;mailto:qazwsx123@spamcop.net&quot;&gt;qazwsx123@spamcop.net&lt;/a&gt;.&amp;nbsp; If your server accepts all mail for &amp;quot;yourcompany.com&amp;quot; and then bounces it later, then it will accept this message.&amp;nbsp; It will then generate a bounce message, which it sends to the forged email address.&amp;nbsp; In this scenario, somebody else spammed you, but you sent email to a spam trap, which often automatically blacklists your mail server.&amp;nbsp; nice, huh...&lt;/p&gt;
&lt;p&gt;SO... the point of that little bunny trail is that you shouldn&apos;t accept email when it is addressed to a non-existant mailbox.&amp;nbsp; Thats where vchkrcpt comes in.&amp;nbsp; Patch your qmail so you can use it (not covered here), and once you can support it, use my script.&lt;/p&gt;
&lt;p&gt;And here it is in all its goodness and tested wonder.&amp;nbsp; Quick warranty and disclaimer:&amp;nbsp; don&apos;t be dumb.&amp;nbsp; edit this for your server and tested it on&amp;nbsp;a non-production server.&amp;nbsp; If you don&apos;t do these things, its nobody&apos;s fault but your own for crashing your mail server.&lt;/p&gt;
&lt;blockquote dir=&quot;ltr&quot; style=&quot;MARGIN-RIGHT: 0px&quot;&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;#!/bin/bash&lt;br /&gt;
#&lt;br /&gt;
# Andrew&apos;s kick-ass chkrcpt script for qmail+vpopmail&lt;br /&gt;
# Author: aschwabe@gmail.com&lt;br /&gt;
#&lt;br /&gt;
# This script makes qmail check for the existance of a user before email is accepted.&lt;br /&gt;
# Will check vpopmail accounts, and look for .qmail* files to determine real accounts.&lt;br /&gt;
# Logs all checks in the /var/log/maillog, and then refers to it to throttle spammers.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;set -- $RECIPIENT&lt;br /&gt;
set -- $SENDER&lt;br /&gt;
MY_TEST=&amp;quot;&amp;quot;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;#echo `whoami`&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;if [ &amp;quot;$RECIPIENT&amp;quot; == &amp;quot;&amp;quot; ]; then&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; # uncomment these lines and the &amp;quot;echo&amp;quot; lines throughout to test at the command line&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; #echo &amp;quot;sender:&amp;quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; #read SENDER&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; #echo &amp;quot;recipient:&amp;quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; #read RECIPIENT&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; exit 100&lt;br /&gt;
fi&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;# email sender addresses explicitly allowed:&lt;br /&gt;
allowed[1]=&amp;quot;override@yourcompany.comiexp.com&amp;quot;&lt;br /&gt;
for index in 1 2&lt;br /&gt;
do&lt;br /&gt;
&amp;nbsp; if [ &amp;quot;$SENDER&amp;quot; == &amp;quot;${allowed[index]}&amp;quot; ]; then&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /usr/bin/logger -p mail.info -t vchkrcpt &amp;quot;mail from &amp;lt;$SENDER&amp;gt; to &amp;lt;$RECIPIENT&amp;gt; : ok (sender explicitly allowed: ${allowed[index]})&amp;quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exit 0&lt;br /&gt;
&amp;nbsp; fi&lt;br /&gt;
done&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;USERPART=`echo &amp;quot;$RECIPIENT&amp;quot; |cut -d@ -f1`&lt;br /&gt;
DOMAIN=`echo &amp;quot;$RECIPIENT&amp;quot; |cut -d@ -f2`&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;# We reject any emails with more than one @ sign&lt;br /&gt;
THIRDPART=`echo &amp;quot;$RECIPIENT&amp;quot; |cut -d@ -f3`&lt;br /&gt;
if [ &amp;quot;$THIRDPART&amp;quot; != &amp;quot;&amp;quot; ]; then&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;&amp;nbsp; #echo &amp;quot;Invalid username - multiple or no @ signs&amp;quot;&lt;br /&gt;
&amp;nbsp; /usr/bin/logger -p mail.info -t vchkrcpt &amp;quot;mail from &amp;lt;$SENDER&amp;gt; to &amp;lt;$RECIPIENT&amp;gt; : illegal username&amp;quot;&lt;br /&gt;
&amp;nbsp; exit 100&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;fi&lt;br /&gt;
# We reject any emails with ! in the name&lt;br /&gt;
EXCL_CHECK=`echo $USERPART |grep &apos;!&apos; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; echo $?|grep &amp;quot;1&amp;quot; &amp;gt; /dev/null 2&amp;gt;&amp;amp;1 ; echo $?`&lt;br /&gt;
if [ &amp;quot;$EXCL_CHECK&amp;quot; == &amp;quot;1&amp;quot; ]; then&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;&amp;nbsp; #echo &amp;quot;Invalid username&amp;quot;&lt;br /&gt;
&amp;nbsp; /usr/bin/logger -p mail.info -t vchkrcpt &amp;quot;mail from &amp;lt;$SENDER&amp;gt; to &amp;lt;$RECIPIENT&amp;gt; : illegal username&amp;quot;&lt;br /&gt;
&amp;nbsp; exit 100&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;fi&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;# We reject any emails with a percent sign in the name&lt;br /&gt;
PERCENT_CHECK=`echo $USERPART |grep &apos;%&apos; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; echo $?|grep &amp;quot;1&amp;quot; &amp;gt; /dev/null 2&amp;gt;&amp;amp;1 ; echo $?`&lt;br /&gt;
if [ &amp;quot;$PERCENT_CHECK&amp;quot; == &amp;quot;1&amp;quot; ]; then&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;&amp;nbsp; #echo &amp;quot;Invalid username&amp;quot;&lt;br /&gt;
&amp;nbsp; /usr/bin/logger -p mail.info -t vchkrcpt &amp;quot;mail from &amp;lt;$SENDER&amp;gt; to &amp;lt;$RECIPIENT&amp;gt; : illegal username&amp;quot;&lt;br /&gt;
&amp;nbsp; exit 100&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;fi&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;# We reject if this sender has had 3 or more bad recipients recently&lt;br /&gt;
if [ &amp;quot;$SENDER&amp;quot; != &amp;quot;&amp;quot; ]; then&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SPAMMER_CHECK=`tail -n300 /var/log/maillog|grep vchkrcpt|grep $SENDER |grep &apos;bounce-no-mailbox&apos;|wc -l`&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; #echo &apos;result of spammer check:&apos;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; #echo $SPAMMER_CHECK&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if [ &amp;quot;$SPAMMER_CHECK&amp;quot; -gt &amp;quot;2&amp;quot; ]; then&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #echo &amp;quot;Too many invalid recipients.&amp;nbsp; Mail will not be accepted.&amp;quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /usr/bin/logger -p mail.info -t vchkrcpt &amp;quot;mail from &amp;lt;$SENDER&amp;gt; to &amp;lt;$RECIPIENT&amp;gt; : spammer=bounce-no-mailbox&amp;quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exit 100&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; fi&lt;br /&gt;
fi&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;# check for valid account&lt;br /&gt;
MY_TEST=`/home/vpopmail/bin/vuserinfo -d $RECIPIENT |/usr/bin/head -n1`&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;if [ &amp;quot;$MY_TEST&amp;quot; == &amp;quot;&amp;quot; ] || [ &amp;quot;${MY_TEST:0:7}&amp;quot; == &amp;quot;no such&amp;quot; ]; then&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;&amp;nbsp; # it wasn&apos;t a real pop user, so check if its an alias&lt;br /&gt;
&amp;nbsp; MY_TEST=`/home/vpopmail/bin/valias $RECIPIENT|/usr/bin/head -n1`&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;&amp;nbsp; # if the address has a dash in it, re-build a default alias address&lt;br /&gt;
&amp;nbsp; USER_ALIAS_CHECK=`echo $USERPART |grep &apos;\-&apos; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; echo $?|grep &amp;quot;1&amp;quot; &amp;gt; /dev/null 2&amp;gt;&amp;amp;1 ; echo $?`&lt;br /&gt;
&amp;nbsp; if [ &amp;quot;$USER_ALIAS_CHECK&amp;quot; == &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ALIAS_USERPART=`echo $USERPART | cut -d - -f1`&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ALIAS_USERPART=$ALIAS_USERPART&amp;quot;-default&amp;quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ALIAS_RECIPIENT=$ALIAS_USERPART&amp;quot;@&amp;quot;$DOMAIN&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; MY_TEST2=`/home/vpopmail/bin/valias $ALIAS_RECIPIENT|/usr/bin/head -n1`&lt;br /&gt;
&amp;nbsp; else&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; MY_TEST2=&amp;quot;&amp;quot;&lt;br /&gt;
&amp;nbsp; fi&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;&amp;nbsp; if [ &amp;quot;$MY_TEST&amp;quot; != &amp;quot;&amp;quot; ]; then&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # this is a valid alias&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; #echo &amp;quot;valid alias&amp;quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; /usr/bin/logger -p mail.info -t vchkrcpt &amp;quot;mail from &amp;lt;$SENDER&amp;gt; to &amp;lt;$RECIPIENT&amp;gt; : alias ok&amp;quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; exit 0&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;&amp;nbsp; elif [ &amp;quot;$MY_TEST2&amp;quot; != &amp;quot;&amp;quot; ]; then&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # this is a valid user alias&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; #echo &amp;quot;valid user-alias&amp;quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; /usr/bin/logger -p mail.info -t vchkrcpt &amp;quot;mail from &amp;lt;$SENDER&amp;gt; to &amp;lt;$RECIPIENT&amp;gt; : user-alias ok&amp;quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; exit 0&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;&amp;nbsp; else&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # look for a .qmail-default file, and see it if has a real account in it&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DEFAULT_RECIPIENT=&amp;quot;default@&amp;quot;$DOMAIN&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; #echo &amp;quot;default recipient = $DEFAULT_RECIPIENT&amp;quot;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DEFAULT_BOUNCE=`/home/vpopmail/bin/valias $DEFAULT_RECIPIENT | /usr/bin/head -n1|grep bounce-no-mailbox \&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; echo $? |grep &amp;quot;1&amp;quot; &amp;gt; /dev/null 2&amp;gt;&amp;amp;1 ; echo $?`&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; #echo &amp;quot;DEFAULT_BOUNCE result = $DEFAULT_BOUNCE&amp;quot;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if [ &amp;quot;$DEFAULT_BOUNCE&amp;quot; == &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #echo &amp;quot;.qmail-default = bounce&amp;quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #echo &amp;quot;invalid recipient&amp;quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /usr/bin/logger -p mail.info -t vchkrcpt &amp;quot;mail from &amp;lt;$SENDER&amp;gt; to &amp;lt;$RECIPIENT&amp;gt; : catchall=bounce-no-mailbox&amp;quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exit 100&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; fi&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; DEFAULT_DELETE=`/home/vpopmail/bin/valias $DEFAULT_RECIPIENT | /usr/bin/head -n1|grep &apos; delete&apos; \&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; echo $? |grep &amp;quot;1&amp;quot; &amp;gt; /dev/null 2&amp;gt;&amp;amp;1 ; echo $?`&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; #echo &amp;quot;DEFAULT_DELETE result = $DEFAULT_DELETE&amp;quot;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if [ &amp;quot;$DEFAULT_DELETE&amp;quot; == &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #echo &amp;quot;.qmail-default = delete&amp;quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #echo &amp;quot;invalid recipient&amp;quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /usr/bin/logger -p mail.info -t vchkrcpt &amp;quot;mail from &amp;lt;$SENDER&amp;gt; to &amp;lt;$RECIPIENT&amp;gt; : catchall=delete&amp;quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exit 100&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; fi&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MY_TEST=`/home/vpopmail/bin/valias $DEFAULT_RECIPIENT | /usr/bin/head -n1`&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; #echo &amp;quot;ALIAS DEFAULT result = $MY_TEST&amp;quot;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if [ &amp;quot;$MY_TEST&amp;quot; == &amp;quot;&amp;quot; ]; then&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #echo &amp;quot;invalid recipient (no default alias)&amp;quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /usr/bin/logger -p mail.info -t vchkrcpt &amp;quot;mail from &amp;lt;$SENDER&amp;gt; to &amp;lt;$RECIPIENT&amp;gt; : catchall=none&amp;quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exit 100&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #echo &amp;quot;valid recipient (.qmail-default)&amp;quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /usr/bin/logger -p mail.info -t vchkrcpt &amp;quot;mail from &amp;lt;$SENDER&amp;gt; to &amp;lt;$RECIPIENT&amp;gt; : catchall=ok&amp;quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exit 0&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fi&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;&amp;nbsp; fi&lt;br /&gt;
else&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;&amp;nbsp; #echo &amp;quot;valid mailbox&amp;quot;&lt;br /&gt;
&amp;nbsp; /usr/bin/logger -p mail.info -t vchkrcpt &amp;quot;mail from &amp;lt;$SENDER&amp;gt; to &amp;lt;$RECIPIENT&amp;gt; : account ok&amp;quot;&lt;br /&gt;
&amp;nbsp; exit 0&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;fi&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt;
&lt;/blockquote&gt;
				
				</description>
						
				
				<category>Qmail</category>				
				
				<pubDate>Fri, 12 Jan 2007 20:20:00 -0400</pubDate>
				<guid>http://blog.schwabe.net/index.cfm/2007/1/12/vchkrcpt.sh--my-kick-butt-script-for-vpopmail</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Authenticating web applications agains vpopmail + qmail</title>
				<link>http://blog.schwabe.net/index.cfm/2006/12/30/Authenticating-web-applications-against-vpopmail-qmail</link>
				<description>
				
				&lt;p&gt;We run qmail + vpopmail + spamassassin for email.&amp;nbsp; it is relatively nice, however the spamassassin config uses qmail-scanner and has a global configuration for multiple domains.&amp;nbsp; sooo... I wanted to build a web based app where users could manage a whitelist of email addresses to go into the global config.&lt;/p&gt;
&lt;p&gt;The first challenge: I dont want to have to add new accounts for everybody that wants access to the whitelist, so I better re-use what security info is available.&lt;/p&gt;
&lt;p&gt;Turns out that you can get lots of useful information about a domain in vpopmail by running this command:&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;/home/vpopmail/bin/vuserinfo -a &lt;a href=&quot;mailto:postmaster@yourdomain.com&quot;&gt;postmaster@yourdomain.com&lt;/a&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;This will pull out the postmaster password and a bunch of other useful things.&amp;nbsp; For now at least, the password is all we need.&lt;/p&gt;
&lt;p&gt;Now, choose your technology to write your web app, but use something that can execute local commands.&amp;nbsp; In this case, we have ColdFusion running on Redhat Enterprise Linux, so we can use the &amp;lt;cfexecute&amp;gt; tag to run the above command, capture the output, which includes the password, and scrape it to pull out the info we want.&amp;nbsp; Now all we do is compare what the user entered to the real password, and you are done!&lt;/p&gt;
&lt;p&gt;So, once this was all put together, users authenticate to my web app by using their domain name and vpopmail postmaster&amp;nbsp;password.&lt;/p&gt;
&lt;p&gt;Hope this was helpful.&amp;nbsp; Feel free to ask me questions if you have similar problems and need help.&lt;/p&gt;
				
				</description>
						
				
				<category>Qmail</category>				
				
				<category>ColdFusion</category>				
				
				<pubDate>Sat, 30 Dec 2006 02:00:00 -0400</pubDate>
				<guid>http://blog.schwabe.net/index.cfm/2006/12/30/Authenticating-web-applications-against-vpopmail-qmail</guid>
				
			</item>
			
		 	
			</channel></rss>