#1 (permalink)  
Old 10-21-2004, 06:31 PM
chirpy's Avatar
Moderator
 
Join Date: Jun 2002
Location: Go on, have a guess
Posts: 13,495
chirpy will become famous soon enough
Convert Default Addresses to :fail:

I just posted this to a thread and thought I'd make it available to anyone who wants to run it on their servers. It changes all Default Addresses (i.e. catchall aliases) for all domains on the server to :fail:

Code:
#!/usr/bin/perl
print "Converting all domain Default Accounts to :fail: ...";
opendir (DIR, "/etc/valiases/") or die;
while (my $file = readdir (DIR)) {
	if ($file =~ /^\./) {next}
	open (IN, "</etc/valiases/$file") or die;
	my @data = <IN>;
	close (IN);
	open (OUT, ">/etc/valiases/$file") or die;
	foreach my $line (@data) {
		if ($line =~ /^\*\:/) {
			print OUT "*: :fail:\n";
		} else {
			print OUT $line;
		}
	}
	close (OUT);
}
print "Done!\n";
Use at your own risk. That means, backup /etc/valiases before running it
__________________
Jonathan Michaelson
cPanel Forum Moderator

Need your cPanel servers secured and tuned?
cPanel Server Configuration, Security, Recovery and Antivirus/AntiSpam Services
Developers of the most effective (and free) Firewall & Security Solution for cPanel Servers - csf
http://www.configserver.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 10-21-2004, 06:33 PM
Advanced cPanel/WHM User
Advanced cPanel/WHM User
 
Join Date: Jun 2003
Posts: 646
nickn is on a distinguished road
Why would you want :fail:? :fail:'s just a bad idea IMO. :blackhole: is the answer.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 10-21-2004, 06:35 PM
chirpy's Avatar
Moderator
 
Join Date: Jun 2002
Location: Go on, have a guess
Posts: 13,495
chirpy will become famous soon enough
Nope, :fail: is definitely the way to go. Here comes my usual answer

It's been accepted now that since the use of verify = recipient in exim.conf that it is definitely best to use :fail: now.

The reasons are:

1. :blackhole: accepts the email and receives it, then sends it to /dev/null. This wastes your bandwidth and actually breaks the SMTP RFC because you're not notifying the sender that the email is undelivered.

2. :fail: stops the email from being received, because verify = recipient occurs at the RCPT phase of the SMTP exchange before any data has been received. No bounce is sent, the exchange simply termintates with an SMTP error code. This means much less processing resources on your SMTP server, much less bandwidth (you don't actually receive the email) and you maintain RFC compliance by notifying the senders SMTP server that the delivery failed (which spammers ignore and real people appreciate if they've made an addressing mistake).
__________________
Jonathan Michaelson
cPanel Forum Moderator

Need your cPanel servers secured and tuned?
cPanel Server Configuration, Security, Recovery and Antivirus/AntiSpam Services
Developers of the most effective (and free) Firewall & Security Solution for cPanel Servers - csf
http://www.configserver.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 10-21-2004, 06:51 PM
chirpy's Avatar
Moderator
 
Join Date: Jun 2002
Location: Go on, have a guess
Posts: 13,495
chirpy will become famous soon enough
Btw, just to back that up - I did extensive research on the use of :blackhole: and :fail: when I wrote the exim Dictionary Attack ACL over here:
http://www.webumake.com/free/eximdeny.htm

I also used to think that :blackhole: was best until it was pointed out to me that several months ago the ACL's were changed to use verify = recipient at the RCPT stage. So cynical me went and checked it out and found it to be perfectly true
__________________
Jonathan Michaelson
cPanel Forum Moderator

Need your cPanel servers secured and tuned?
cPanel Server Configuration, Security, Recovery and Antivirus/AntiSpam Services
Developers of the most effective (and free) Firewall & Security Solution for cPanel Servers - csf
http://www.configserver.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 10-22-2004, 07:45 PM
Registered User
 
Join Date: Sep 2004
Posts: 529
dezignguy is an unknown quantity at this point
Heh, chirpy, this seems to come up about once a week... I see why you have your usual answer saved and handy. heh.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 10-22-2004, 08:17 PM
PWSowner's Avatar
Registered User
 
Join Date: Nov 2001
Location: ON, Canada
Posts: 2,991
PWSowner is on a distinguished road
It does get asked a lot doesn't it?
__________________
Mike
WHM and cPanel Scripts (join our "Scripts Club")
D/A Photography
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 10-23-2004, 03:14 AM
Banned
 
Join Date: Feb 2004
Posts: 351
mr.wonderful has a little shameless behaviour in the past
Quote:
Originally Posted by chirpy
Btw, just to back that up - I did extensive research on the use of :blackhole: and :fail: when I wrote the exim Dictionary Attack ACL over here:
http://www.webumake.com/free/eximdeny.htm

I also used to think that :blackhole: was best until it was pointed out to me that several months ago the ACL's were changed to use verify = recipient at the RCPT stage. So cynical me went and checked it out and found it to be perfectly true
I looked at your dictionary attack rules, that you recommended, for exim.conf, and found it quite flawed. Your script however is another story. It works well to ban the ip however it needs to be used properly in exim.conf.

I will email you later, off this site and let you know the much better way to use your perl script with exim.conf
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 10-23-2004, 05:01 AM
chirpy's Avatar
Moderator
 
Join Date: Jun 2002
Location: Go on, have a guess
Posts: 13,495
chirpy will become famous soon enough
Quote:
Originally Posted by mr.wonderful
I looked at your dictionary attack rules, that you recommended, for exim.conf, and found it quite flawed. Your script however is another story. It works well to ban the ip however it needs to be used properly in exim.conf.

I will email you later, off this site and let you know the much better way to use your perl script with exim.conf
I wait with baited breath. It works perfectly well for me and all the people I've installed it for and those that have used it themselves. I did do extensive testing with it, using examples provided by the exim developers.

Since you're so highly critical of it, I do hope you will have the decency to post the problems with the implementation here as a matter of urgency, since it is so "flawed".
__________________
Jonathan Michaelson
cPanel Forum Moderator

Need your cPanel servers secured and tuned?
cPanel Server Configuration, Security, Recovery and Antivirus/AntiSpam Services
Developers of the most effective (and free) Firewall & Security Solution for cPanel Servers - csf
http://www.configserver.com

Last edited by chirpy; 10-23-2004 at 05:22 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 10-23-2004, 09:12 AM
Registered User
 
Join Date: Jun 2004
Posts: 76
picoyak
FWIW, the dictionary rules are working very well for me. I've noticed that among the bogus recipients there are often some valid ones, so along with reducing load, it's helped ditch a bit of spam.

Quote:
Originally Posted by mr.wonderful
I will email you later, off this site and let you know the much better way to use your perl script with exim.conf
Why? Chirpy has been generous enough to share his work with everyone here. If you have some addition, then for cryin' out loud, spit it out!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 11-29-2004, 09:25 AM
Registered User
 
Join Date: Jun 2002
Posts: 118
Valetia
Quote:
Originally Posted by chirpy
Btw, just to back that up - I did extensive research on the use of :blackhole: and :fail: when I wrote the exim Dictionary Attack ACL over here:
http://www.webumake.com/free/eximdeny.htm
How do you implement this on a secondary (backup MX) mail server?

The current version of the ACL doesn't work on such servers, since they don't even have the valias files on them. Help!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #11 (permalink)  
Old 11-29-2004, 10:24 AM
chirpy's Avatar
Moderator
 
Join Date: Jun 2002
Location: Go on, have a guess
Posts: 13,495
chirpy will become famous soon enough
You cannot implement it for email being queued on a secondary MX server because the email has not reached its final destination. This can only happen on the primary MX server. It's a limitation you have by imposing an additional hop in the mail delivery route by interrupting the direct SMTP delivery from the source.
__________________
Jonathan Michaelson
cPanel Forum Moderator

Need your cPanel servers secured and tuned?
cPanel Server Configuration, Security, Recovery and Antivirus/AntiSpam Services
Developers of the most effective (and free) Firewall & Security Solution for cPanel Servers - csf
http://www.configserver.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #12 (permalink)  
Old 11-29-2004, 11:24 AM
Roy@ENHOST's Avatar
Registered User
 
Join Date: Mar 2002
Location: Los Angeles California
Posts: 495
Roy@ENHOST is on a distinguished road
I think you have to add extra detection to the script.

From what I know, this script will also switch the pipings that are required by helpdesk softwares to :fail:
You have to use pregmatch regex to check that the destination is not a php,cgi or a binary.
Hope that helps.
__________________
= = = = = = = = = = = = = = = = = =
Cpanel XP Evolution (Add DOZENS of functions to your Cpanel NOW!!!) - 21 Languages, User Friendly Interface, Feature Enabled, Highly Customizable, Create Popup Once window, Language Aware, Flash Tutorials, Theme Changer,Integration with Modernbill,WHM AutoPilot,ClientExec,LPanel&WHOISCart
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #13 (permalink)  
Old 11-29-2004, 11:48 AM
chirpy's Avatar
Moderator
 
Join Date: Jun 2002
Location: Go on, have a guess
Posts: 13,495
chirpy will become famous soon enough
Hi Roy,

I completely agree. It was just thrown togther for those that wanted to splat all their domains, as someone asked for it. So they got it
__________________
Jonathan Michaelson
cPanel Forum Moderator

Need your cPanel servers secured and tuned?
cPanel Server Configuration, Security, Recovery and Antivirus/AntiSpam Services
Developers of the most effective (and free) Firewall & Security Solution for cPanel Servers - csf
http://www.configserver.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #14 (permalink)  
Old 12-18-2004, 09:18 AM
Registered User
 
Join Date: Apr 2003
Location: New Jersey, USA
Posts: 414
XPerties is on a distinguished road
You just take this script, place it in a new file on your server and access it to run the script?
__________________
eMax Hosting, LLC - Providing Reliable Hosting Services for the past 3 years
¨€ cPanel, MySQL, 24/7 Support, Money Back Guarantee, *Free Website Builder*,
¨€ Shared Hosting, Reseller Hosting, Dedicated Management, Site Monitoring Services, 97% Client Rating
¨€ Have a Sales Questions? Call us toll free at 1-800-770-eMax!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #15 (permalink)  
Old 12-18-2004, 11:03 AM
chirpy's Avatar
Moderator
 
Join Date: Jun 2002
Location: Go on, have a guess
Posts: 13,495
chirpy will become famous soon enough
Yes, bascially do this as root on the server:

pico -w defrep.pl
(paste in the script from the thread and exit)

perl defrep.pl

That should be it.
__________________
Jonathan Michaelson
cPanel Forum Moderator

Need your cPanel servers secured and tuned?
cPanel Server Configuration, Security, Recovery and Antivirus/AntiSpam Services
Developers of the most effective (and free) Firewall & Security Solution for cPanel Servers - csf
http://www.configserver.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 10:41 AM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© cPanel Inc