Greylisting View Currently Delayed

This section contains scripts that hMailServer has contributed with. hMailServer 4 is needed to use these.
^DooM^
Site Admin
Posts: 13861
Joined: 2005-07-29 16:18
Location: UK

Post by ^DooM^ » 2007-11-27 14:33

I don't like ASSP ;)

While it is a great application and does exactly what it is designed to do I don't like using mail proxy services that sit between my mail server and the outside world. I have been waiting for SpamAssassin integration so I can scan email files without having anything sat between the net and my mailserver.

Besides that ASSP has like a myriad of options that I couldn't be bothered to go through. I like simple things like greylisting. 1 tick box and your up and running :D

Kaan1983
Senior user
Senior user
Posts: 595
Joined: 2007-01-30 16:26
Location: TÜRKIYE

Post by Kaan1983 » 2007-11-27 19:28

Thanks for confusing me :)

Can we build a comunity part on this or another website where we can share greylisting and blacklisting kind of informations? Cause I am going to ask for your greylisting white list entries now :D

^DooM^
Site Admin
Posts: 13861
Joined: 2005-07-29 16:18
Location: UK

Post by ^DooM^ » 2007-11-27 20:04


Kaan1983
Senior user
Senior user
Posts: 595
Joined: 2007-01-30 16:26
Location: TÜRKIYE

Post by Kaan1983 » 2007-11-28 11:29

:) Yep I made a post there

tnt2k03
New user
New user
Posts: 14
Joined: 2008-01-18 16:09

Post by tnt2k03 » 2008-02-11 21:56

I got this error while using the greylist.php, "Incorrect integer value: '' for column 'whiteid' at row 1". It gave me the list and when I submit some of the ip to the white list that is the error I got. Anyone has any idea? Thanks for helping.

Best Regards,

TNT

^DooM^
Site Admin
Posts: 13861
Joined: 2005-07-29 16:18
Location: UK

Post by ^DooM^ » 2008-02-12 03:00

What version of hmail are you using?

tnt2k03
New user
New user
Posts: 14
Joined: 2008-01-18 16:09

Post by tnt2k03 » 2008-02-12 15:16

Hi Doom,

Thank you for quick reply. I am using hmailserver ver. 4.4.1 B273. Thanks again for helping.

TNT

^DooM^
Site Admin
Posts: 13861
Joined: 2005-07-29 16:18
Location: UK

Post by ^DooM^ » 2008-02-12 15:17

Are you using the builtin MySQL server or do you have an external one?

tnt2k03
New user
New user
Posts: 14
Joined: 2008-01-18 16:09

Post by tnt2k03 » 2008-02-12 17:37

Hi again,

I am using an external mysql database. Thanks.

TNT

^DooM^
Site Admin
Posts: 13861
Joined: 2005-07-29 16:18
Location: UK

Post by ^DooM^ » 2008-02-12 19:30

Ok I am guessing you are running MySQL 5 in strict mode?

If that is the case then the SQL line I am using will probably throw an error.

I don't have an SQL5 version to test with so this is off the top of my head.

on line 524 change this line from

Code: Select all

$pQuery = mysql_query("INSERT INTO `hm_greylisting_whiteaddresses` VALUES('','{$strIPAddress}','{$strDescription}')") or die(mysql_error());
to

Code: Select all

$pQuery = mysql_query("INSERT INTO `hm_greylisting_whiteaddresses` (whiteid, whiteipaddress, whiteipdescription) VALUES (NULL, '{$strIPAddress}', '{$strDescription}')") or die(mysql_error());
The above code should be one single line and not wrapped as shown on the forum.

Let me know if this works.

Cheers!

tnt2k03
New user
New user
Posts: 14
Joined: 2008-01-18 16:09

Post by tnt2k03 » 2008-02-12 20:09

Hi Doom,

It worked great. Thank you so much for helping.

Sincerely,

TNT

^DooM^
Site Admin
Posts: 13861
Joined: 2005-07-29 16:18
Location: UK

Post by ^DooM^ » 2008-02-12 20:46

You are welcome. Please be aware though that whitelist entries that are placed directly into the database will not show up until the hMail service is restarted. Unfortunately this is a limitation with placing values directly into the database instead of using the COM API.

FiShBuRn
Normal user
Normal user
Posts: 88
Joined: 2007-06-29 16:43

Re: Greylisting View Currently Delayed

Post by FiShBuRn » 2008-09-12 12:01

Hi Doom,

Thanks for this excelent script helped me a lot!

Regards
Last edited by FiShBuRn on 2008-09-12 14:02, edited 1 time in total.

^DooM^
Site Admin
Posts: 13861
Joined: 2005-07-29 16:18
Location: UK

Re: Greylisting View Currently Delayed

Post by ^DooM^ » 2008-09-12 12:45

You're welcome.

I'm hoping to get some free time soon to update this script to allow users to login to check their own greylisting entries that can be integrated into a web portal or similar. I'll post it up here as and when i get it done :)
If at first you don't succeed, bomb disposal probably isn't for you! ヅ

joksi
Normal user
Normal user
Posts: 76
Joined: 2006-10-15 12:29

Re: Greylisting View Currently Delayed

Post by joksi » 2009-10-27 21:42

Code: Select all

   $com = new COM("hMailServer.Application");

	$com->Connect();
	$com->Authenticate("Administrator", "PASSWORD");
	$com->Reinitialize();
Will update the greylisting whitelist with no need to manually reboot the server. :)

^DooM^
Site Admin
Posts: 13861
Joined: 2005-07-29 16:18
Location: UK

Re: Greylisting View Currently Delayed

Post by ^DooM^ » 2009-10-27 21:48

Yes but I didn't want to use the COM API at all ;)
If at first you don't succeed, bomb disposal probably isn't for you! ヅ

User avatar
martin
Developer
Developer
Posts: 6834
Joined: 2003-11-21 01:09
Location: Sweden
Contact:

Re: Greylisting View Currently Delayed

Post by martin » 2009-10-27 22:02

Todo : Figure out how to refresh hMail's Whitelist Cache. (Still not done as needs COM access)
In 5.4, the white list won't be cached.

^DooM^
Site Admin
Posts: 13861
Joined: 2005-07-29 16:18
Location: UK

Re: Greylisting View Currently Delayed

Post by ^DooM^ » 2009-10-27 22:05

Sweet. Is there to be any whitelist improvements in 5.4? Per user whitelists perhaps?
If at first you don't succeed, bomb disposal probably isn't for you! ヅ

User avatar
martin
Developer
Developer
Posts: 6834
Joined: 2003-11-21 01:09
Location: Sweden
Contact:

Re: Greylisting View Currently Delayed

Post by martin » 2009-10-27 22:20

Nope, nothing such planned.

FiShBuRn
Normal user
Normal user
Posts: 88
Joined: 2007-06-29 16:43

Re: Greylisting View Currently Delayed

Post by FiShBuRn » 2009-11-03 11:27

^Doom^, in the last stable version of hmail the "IP Address's" are showed as "0.0.0.0" can you tell me what i need to change to fix it?

Regards

^DooM^
Site Admin
Posts: 13861
Joined: 2005-07-29 16:18
Location: UK

Re: Greylisting View Currently Delayed

Post by ^DooM^ » 2009-11-03 11:42

As far as I am aware no changes have been made to how IP's are stored. Can you post a row from the database for m so I can compare with what's expected. (I assume it has been working fine with previous versions?)
If at first you don't succeed, bomb disposal probably isn't for you! ヅ

joksi
Normal user
Normal user
Posts: 76
Joined: 2006-10-15 12:29

Re: Greylisting View Currently Delayed

Post by joksi » 2009-11-03 11:57

Yes there is a change in the database, 'glipaddress' is now named 'glipaddress1'.
Just do a search for 'glipaddress' and replace with 'glipaddress1' in the file and everything will work again.

I noticed this and solved this a couple of days ago, after not using your script for awhile and now running newer hmail installation.

^DooM^
Site Admin
Posts: 13861
Joined: 2005-07-29 16:18
Location: UK

Re: Greylisting View Currently Delayed

Post by ^DooM^ » 2009-11-03 11:59

Ahh probably to help with IPV6 addition at a later date. Thanks for the heads up joksi
If at first you don't succeed, bomb disposal probably isn't for you! ヅ

FiShBuRn
Normal user
Normal user
Posts: 88
Joined: 2007-06-29 16:43

Re: Greylisting View Currently Delayed

Post by FiShBuRn » 2009-11-03 12:31

^DooM^ wrote:As far as I am aware no changes have been made to how IP's are stored. Can you post a row from the database for m so I can compare with what's expected. (I assume it has been working fine with previous versions?)
Yes, it has been working only with 5.3 this appears, i will change the value that joksi suggested.

Regards

Edit: it worked :D

xrkolovos
Normal user
Normal user
Posts: 45
Joined: 2008-07-04 12:13
Location: Greece

Re: Greylisting View Currently Delayed

Post by xrkolovos » 2010-02-17 15:39

i get this warings...

Code: Select all

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Inetpub\wwwroot\PHPWebAdmin\greylist\greylist.php on line 218

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in C:\Inetpub\wwwroot\PHPWebAdmin\greylist\greylist.php on line 219

^DooM^
Site Admin
Posts: 13861
Joined: 2005-07-29 16:18
Location: UK

Re: Greylisting View Currently Delayed

Post by ^DooM^ » 2010-02-17 15:43

what version of MySQL are you running?
If at first you don't succeed, bomb disposal probably isn't for you! ヅ

xrkolovos
Normal user
Normal user
Posts: 45
Joined: 2008-07-04 12:13
Location: Greece

Re: Greylisting View Currently Delayed

Post by xrkolovos » 2010-02-18 10:23

Mysql 5.1

^DooM^
Site Admin
Posts: 13861
Joined: 2005-07-29 16:18
Location: UK

Re: Greylisting View Currently Delayed

Post by ^DooM^ » 2010-02-18 10:52

That current section of code just counts how many unique ip's there are in the database. I can only assume some syntax from MySQL4 to 5 has changed when using DISTINCT.

Aside those warnings does the script work?
If at first you don't succeed, bomb disposal probably isn't for you! ヅ

xrkolovos
Normal user
Normal user
Posts: 45
Joined: 2008-07-04 12:13
Location: Greece

Re: Greylisting View Currently Delayed

Post by xrkolovos » 2010-02-18 11:23

yes it works fine as i see.
It just doesn't count Total number of unique IP's i think. Because of this.


if you want to check it send a pm and i will show you the page to test it.

^DooM^
Site Admin
Posts: 13861
Joined: 2005-07-29 16:18
Location: UK

Re: Greylisting View Currently Delayed

Post by ^DooM^ » 2010-02-18 12:08

Well i can't see anything wrong with the syntax and i don't have an SQL5 server to test on currently.

You could try altering line 217 from this

Code: Select all

$pQuery = mysql_query("SELECT COUNT(DISTINCT glipaddress) AS numrows FROM `hm_greylisting_triplets`");
to this

Code: Select all

$pQuery = mysql_query("SELECT COUNT(DISTINCT glipaddress) AS 'numrows' FROM `hm_greylisting_triplets`");
However I don't see why this small change would make any difference.

That count doesn't really do anything to be totally honest, you could just remove line 217, 218, 219 and 228 if that change does not work.
If at first you don't succeed, bomb disposal probably isn't for you! ヅ

xrkolovos
Normal user
Normal user
Posts: 45
Joined: 2008-07-04 12:13
Location: Greece

Re: Greylisting View Currently Delayed

Post by xrkolovos » 2010-02-18 12:47

i checked the table hm_greylisting_triplets and there is no field glipaddress.

that's all the fields

hm_greylisting_triplets.glid,
hm_greylisting_triplets.glcreatetime,
hm_greylisting_triplets.glblockendtime,
hm_greylisting_triplets.gldeletetime,
hm_greylisting_triplets.glipaddress1,
hm_greylisting_triplets.glsenderaddress,
hm_greylisting_triplets.glrecipientaddress,
hm_greylisting_triplets.glblockedcount,
hm_greylisting_triplets.glpassedcount,
hm_greylisting_triplets.glipaddress2

^DooM^
Site Admin
Posts: 13861
Joined: 2005-07-29 16:18
Location: UK

Re: Greylisting View Currently Delayed

Post by ^DooM^ » 2010-02-18 14:38

joksi wrote:Yes there is a change in the database, 'glipaddress' is now named 'glipaddress1'.
Just do a search for 'glipaddress' and replace with 'glipaddress1' in the file and everything will work again.

I noticed this and solved this a couple of days ago, after not using your script for awhile and now running newer hmail installation.
If at first you don't succeed, bomb disposal probably isn't for you! ヅ

XucruT
New user
New user
Posts: 4
Joined: 2010-05-26 00:25

Re: Greylisting View Currently Delayed

Post by XucruT » 2010-05-26 00:34

So first I want to know if, using this script, when I put a register to the whitelist, does the message automaticaly will be delivered ?

I thik greylisting is a nice job, but I´m having a lot of claims with the users for emails not delivered in time. What I want to do is a script that, when the message arrives, the server send an e-mail to the sender asking that he confirms the send maybe typing a confirmation number and if its correct, the message is delivered and then the sender automaticaly goes to the whitelist.

Can you show me the way to do this ?

^DooM^
Site Admin
Posts: 13861
Joined: 2005-07-29 16:18
Location: UK

Re: Greylisting View Currently Delayed

Post by ^DooM^ » 2010-05-26 00:47

You can't do that with this script neither with greylisting. What you want is called challenge response anti spam. This type of anti spam is a royal pain and causes excess un-needed bandwidth usage. There maybe a script to do it somewhere, i can't recall one off the top of my head though.
If at first you don't succeed, bomb disposal probably isn't for you! ヅ

XucruT
New user
New user
Posts: 4
Joined: 2010-05-26 00:25

Re: Greylisting View Currently Delayed

Post by XucruT » 2010-05-26 00:59

I agree that chalenge antispam cause an un-needed bandwidth usage, but I beleave too that the sender must being able to prove yours authenticity.

And second option that I´m thinking about is give to my users a way to see what messages (not only the senders eg) are in greylist and can choose deliver it... It´s less complicated ?

^DooM^
Site Admin
Posts: 13861
Joined: 2005-07-29 16:18
Location: UK

Re: Greylisting View Currently Delayed

Post by ^DooM^ » 2010-05-26 01:09

The problem with challenge/response is automated mailers that send out things like receipts, newsletters, welcome messages, forum verification links etc are never delivered because C/R sends the email back to the sender which 90% of the time is a no-reply account which is never checked, so your users lose out in the end. It's a lame solution to the spam problem in my opinion.

Greylisting is automatic, my script will show you what's delayed waiting for a second try from the sending mail server. Currently it's not very user configurable, i am waiting for a new hmail update that will allow greylist whitelist entries to be added without the cache needing to be re-populated. Also there is a request to add user added whitelist entries too that once added i will be able to update my script to allow users to login check/change/add entries.

Neither of these two solutions are what you are asking for though. Basically you want some kind of delayed queue and if user wants email then they can choose to have it delivered. That seems like a lot of work for the end user. I suggest just enabling greylisting and see how you go. From my own statistics it has stopped around 95% of incoming spam. See this link for my figures http://damnation.org.uk/glist/
If at first you don't succeed, bomb disposal probably isn't for you! ヅ

XucruT
New user
New user
Posts: 4
Joined: 2010-05-26 00:25

Re: Greylisting View Currently Delayed

Post by XucruT » 2010-05-26 01:26

I´m already using Greylisting for 3 months and I receive calls daily with users saying "Somebody send me an e-mail has 1 hour and its not arrives to me"............ And I´m crazying...

I don´t know there but here some e-mails don´t arrives never again... E-mails that I saw in the database and was in greylist but I think that the server don´t try to send again or send very quickly again an the hmail blocks again... I lowered the time to defer delivey atemps to 1 minute to feel how will work however If the user could to liberate the message in greylist will give more years of life...

^DooM^
Site Admin
Posts: 13861
Joined: 2005-07-29 16:18
Location: UK

Re: Greylisting View Currently Delayed

Post by ^DooM^ » 2010-05-26 01:31

The actual email is not stored. hMail delays the email before it is even sent with a 451 delayed code.

http://www.hmailserver.com/forum/viewto ... 20&t=13682

The script above may help some, whenever a user emails someone their mail address is automatically whitelisted. so when they reply it comes through without delay.
If at first you don't succeed, bomb disposal probably isn't for you! ヅ

XucruT
New user
New user
Posts: 4
Joined: 2010-05-26 00:25

Re: Greylisting View Currently Delayed

Post by XucruT » 2010-05-26 01:42

Whats the diference between disable greylisting and automaticaly put incoming senders in the whitelist ?

User avatar
mattg
Moderator
Moderator
Posts: 19979
Joined: 2007-06-14 05:12
Location: 'The Outback' Australia

Re: Greylisting View Currently Delayed

Post by mattg » 2010-05-26 01:52

With recipients from local senders being added to the whitelist, when they reply they won't be greylisted. (what the script does)

Greylisting affects ALL incoming mail
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

Bill48105
Developer
Developer
Posts: 6189
Joined: 2010-04-24 23:16
Location: Michigan, USA

Re: Greylisting View Currently Delayed

Post by Bill48105 » 2010-05-26 02:27

Hi XucruT,
I have similar complaints from users. With my current mail server I just disable greylisting for them & they beg me to turn it back on after they get tons of spam & suddenly they stop complaining so much. hehe (Too bad hMail doesn't have per-user option to disable greylisting but it does allow per domain at least)

Would it be helpful to just whitelist IP's of 'important' senders mail servers then no worries about delays from them? If you trust that server why not add them to whitelist and you get less grief. Take some time to build up whitelist but eventually you'll have good set of common senders you trust.

Btw, so the 'bypass' options in hMail don't help any? You'd think many people use SPF these days & more so have MX/A record although spammers could too so perhaps that allows some more spam but at least maybe it helps cut down on annoying delays.
Bill
hMailServer build LIVE on my servers: 5.4-B2014050402
#hmailserver on FreeNode IRC https://webchat.freenode.net/?channels=#hmailserver
*** ABSENT FROM hMail! Those in IRC know how to find me if urgent. ***

gfbaggio
New user
New user
Posts: 2
Joined: 2010-06-28 03:08

Re: Greylisting View Currently Delayed

Post by gfbaggio » 2010-06-28 03:16

I am fairly new to php and would like to know how to modify your script to add not the IP address but the sender email to the whitelist.

By the way your script rocks.

Thanks

^DooM^
Site Admin
Posts: 13861
Joined: 2005-07-29 16:18
Location: UK

Re: Greylisting View Currently Delayed

Post by ^DooM^ » 2010-06-28 10:32

This should do what you need.

I have briefly tested it and it does add the data to the whitelist table. Let me know if you come across any oddities.

Cheers
greylisteml.zip
Greylist script that adds email addresses to global whitelist instead of whitelisting server IP.
(5.23 KiB) Downloaded 418 times
If at first you don't succeed, bomb disposal probably isn't for you! ヅ

gfbaggio
New user
New user
Posts: 2
Joined: 2010-06-28 03:08

Re: Greylisting View Currently Delayed

Post by gfbaggio » 2010-06-29 01:57

This work very good, it adds the information to the database, but it does not appear in the hmailserver administrator.
I even tried to stop and restart the mailserver but nothing.

Any help.

Thanks

^DooM^
Site Admin
Posts: 13861
Joined: 2005-07-29 16:18
Location: UK

Re: Greylisting View Currently Delayed

Post by ^DooM^ » 2010-06-29 09:36

This is the same issue as the old script. hMail will not currently pick up changes to the database unless you restart the service or use the COM API to force a refresh. I believe this functionality will be changing in 5.4 where whitelist details are always pulled from the database instead of being cached in memory. 5.4 is hopefully just a few weeks away so until then just restart the service from Start -> Administrative tools -> Services -> hmailserver
If at first you don't succeed, bomb disposal probably isn't for you! ヅ

FiShBuRn
Normal user
Normal user
Posts: 88
Joined: 2007-06-29 16:43

Re: Greylisting View Currently Delayed

Post by FiShBuRn » 2012-12-02 20:57

hey ^DooM^ thanks once again for this script. Now i have one problem, just upgraded to php 5.4.9 and i get this error "PHP Fatal error: Cannot re-assign auto-global variable _POST".

Do you think that is possible to fix this?

Regards

^DooM^
Site Admin
Posts: 13861
Joined: 2005-07-29 16:18
Location: UK

Re: Greylisting View Currently Delayed

Post by ^DooM^ » 2012-12-02 23:45

Give this version a try and let me know. I believe I fixed the issue.
greylistv09.a.zip
(5.31 KiB) Downloaded 378 times
If at first you don't succeed, bomb disposal probably isn't for you! ヅ

FiShBuRn
Normal user
Normal user
Posts: 88
Joined: 2007-06-29 16:43

Re: Greylisting View Currently Delayed

Post by FiShBuRn » 2012-12-03 00:07

wow fast :) yeap, its fixed! thanks again!!!!

regards

Post Reply