Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 3 > Tips/Tricks/Mods

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 1st August 2011, 22:23
pititis pititis is offline
Senior Member
 
Join Date: Dec 2010
Location: Mnchen
Posts: 364
Thanks: 38
Thanked 86 Times in 68 Posts
Lightbulb More control over spam in shared hosting

Hi,

First tip

I'm sure you know the issue with the php function mail(). To disable globally the function can be a problem because not all php based apps and contact forms allow smtp auth.

By default ispconfig use fast-cgi for the sites you created. Don't forget activate suexec when work with fast-cgi because scripts are executed with the user and group of the site owner. Well, from php version 5.3.0 we can use the directive mail.log to log who is calling the function mail(). When someone call the function mail from a php script we will find some info about the sender in our log. In this example I use ubuntu.

First edit your /etc/php5/cgi/php.ini and set the directive properly:

Code:
mail.log = /var/log/phpmail.log
phpmail.log is the name used in my example.

Then create the file
Code:
touch /var/log/phpmail.log
...and restart apache daemon

Code:
/etc/init.d/apache2 restart
Now send a email using a form or a simple script and test your log:

Code:
cat /var/log/phpmail.log
...and we can see the output:

Code:
mail() on [/var/www/clients/client11/web33/web/mail.php:9]: To: muster@domain.net -- Headers: From: webmaster@yahoo.com  Reply-To: webmaster@example.com  X-Mailer: PHP/5.3.2-1ubuntu4.9
It work, we know exactly who are sending what...

Second tip

Well, but what about the email subject? Will be wonderful to log the subjects. No problem we can log email subject header from all emails, no matter if they are send using mail() function or as normal authenticated smtp. Using ispconfig, just go to email->Content filter. Click to add a new content filter and select Header Filter, then set the Action field to:

Code:
/^Subject:/
Now wait a few minutes and send a test email. After that run

Code:
grep "warning: header" /var/log/mail.log
...and we get the next output:

Code:
Aug  1 18:54:55 server postfix/cleanup[23308]: 99BDC16A11B: warning: header Subject: second test from mailout-muster.domain.net[111.111.111.111]; from=<musterman@ich.net> to=<webmaster@yahoo.com> proto=SMTP helo=<xxx.net>
Cheers
Reply With Quote
The Following 8 Users Say Thank You to pititis For This Useful Post:
commentator (21st July 2012), falko (2nd August 2011), itanium (24th July 2012), ngoyette (3rd April 2012), nokia80 (9th August 2011), radim_h (23rd August 2011), till (2nd August 2011), vaio (20th July 2012)
Sponsored Links
  #2  
Old 3rd April 2012, 18:11
ngoyette ngoyette is offline
Member
 
Join Date: Sep 2011
Posts: 40
Thanks: 15
Thanked 1 Time in 1 Post
Default

how should the content filter box look like, like this ? :
Reply With Quote
  #3  
Old 4th April 2012, 13:32
pititis pititis is offline
Senior Member
 
Join Date: Dec 2010
Location: Mnchen
Posts: 364
Thanks: 38
Thanked 86 Times in 68 Posts
Default

Yes just like this
Reply With Quote
  #4  
Old 20th July 2012, 20:53
vaio vaio is offline
Member
 
Join Date: Nov 2010
Posts: 48
Thanks: 21
Thanked 1 Time in 1 Post
Default

WOW, perfect!

This deserves sticky, or mention in next ISP manual
Reply With Quote
  #5  
Old 12th October 2012, 11:25
ressel ressel is offline
Senior Member
 
Join Date: Apr 2007
Location: Denmark
Posts: 128
Thanks: 18
Thanked 5 Times in 5 Posts
Default

does it work with suphp?
Reply With Quote
  #6  
Old 15th October 2012, 19:34
pititis pititis is offline
Senior Member
 
Join Date: Dec 2010
Location: Mnchen
Posts: 364
Thanks: 38
Thanked 86 Times in 68 Posts
Default

Quote:
does it work with suphp?
Yes, it should
Reply With Quote
  #7  
Old 16th October 2012, 06:29
Damieen Damieen is offline
Junior Member
 
Join Date: Sep 2012
Location: new york
Posts: 10
Thanks: 1
Thanked 0 Times in 0 Posts
 
Default

Indeed, you have done a great job by posting such great tips..Well I am going to check out all these and post you back whether I have done the perfect set up or not.
thanks
__________________
.
Reply With Quote
Reply

Bookmarks

Tags
fast-cgi, mail(), php.ini, spam control

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Webmail problems with only one domain? compner Installation/Configuration 14 16th February 2010 16:59
problems receiving mails Amorphous Installation/Configuration 2 15th October 2009 11:04
Ubuntu 8.04 Spamsnake - all SA scores 0.00 Thomas_Powers HOWTO-Related Questions 23 24th June 2008 17:37
Howto suggestion suse PhP ver 4 + Ver 5 wwparrish Suggest HOWTO 11 7th August 2006 13:29
Webmin docs missing namit Server Operation 11 5th January 2006 09:51


All times are GMT +2. The time now is 18:49.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.