qmail mfcheck patch
Block mail from invalid domains that can not be replied to use the mfcheck patch.
cd /usr/local/src/mail/qmail-1.03
patch < qmail-1.03-mfcheck.3.patch
This patch goes in by itself after the smtpd-chkusr patch (ALMOST) except for a few hunks in qmail-smtpd.c and the Makefile which can be done by hand. Check your *.rej files. It may take you a few minutes but the patch is well worth it!
make qmail-smtpd
services stop
cp /var/qmail/bin/qmail-smtpd /var/qmail/bin/qmail-smtpd.bak
cp qmail-smtpd /var/qmail/bin
chown vpopmail:qnofiles /var/qmail/bin/qmail-smtpd
chmod 6555 /var/qmail/bin/qmail-smtpd
services start
Test it with my own admin emailer
#!/usr/bin/perl
# title : admin_emailer script
# author : John David Saario
# company : Alamak Internet
# policy : free to copy and redistribute
if ($ARGV[0] =~ /\S+\@\S+/ && $ARGV[1] =~ /\S+\@\S+/) {
$from = $ARGV[0];
$to = $ARGV[1];
if (-e "/var/qmail/bin/qmail-inject") {
&sendit($from,$to);
} else {
&sendit2($from,$to);
}
} else {
die "Syntax, [from] [to]\n";
}
sub sendit {
my ($from,$to) = @_;
my $subject = "Testing $from -> $to";
my $msg = "Testing $from -> $to\n";
$name = "Goofy";
open (QM, "|/var/qmail/bin/qmail-inject -f$from");
if ($name) {
print QM "From: \"$name\" <$from>\n";
} else {
print QM "From: $from\n";
}
print QM "To: $to\n";
print QM "Subject: $subject\n";
print QM "\n";
print QM $msg;
close QM;
print "Email sent to : $from -> $to\n";
return;
}
sub sendit2 {
my ($from,$to) = @_;
my $subject = "Testing $from -> $to";
my $msg = "Testing $from -> $to\n";
$name = "Goofy";
open (QM, "|/usr/sbin/sendmail -oi -t -f$from") || die "no sendmail\n";
if ($name) {
print QM "From: \"$name\" <$from>\n";
} else {
print QM "From: $from\n";
}
print QM "To: $to\n";
print QM "Subject: $subject\n";
print QM "\n";
print QM $msg;
close QM;
print "Email sent to : $from -> $to\n";
return;
}
Check It.
./admin_emailer [email protected] [email protected]
Successfully delivered.
./admin_emailer root@bogusdomain_xxx.com [email protected]
From: Mail Delivery Subsystem <[email protected]>
----- The following addresses had permanent fatal errors -----
root@bogusdomain_xxx.com
(reason: 550 Host unknown)
----- Transcript of session follows -----
550 5.1.2 root@bogusdomain_xxx.com... Host unknown (Name server: bogusdomain_xxx.com: host not found)
|