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

Greylisting View Currently Delayed

Post by ^DooM^ » 2006-11-27 21:50

Hi All,

I recently requested some features to greylisting where we could see/search for entries in the greylist for ease of viewing and quick lookups if someone is blocked and the addition of ip's to the whitelist from the filtered search results.

I have written this feature in PHP for those of you that are interested.

There is only one issue with this script ( That I know of ;) ). Whitelist entries seem to be cached by hmail so any addition to the database is not taken into account until hmail is restarted. There is nothing I can do about that except ask for the cache to have a disable option from martin (Pretty please) . :D

This is a beta release so if any of you find any bugs please let me know.

I am sure this could be done much better and a lot prettier than I have done it but it does what it's supposed to do with minimal fuss.

Please open up the php file and setup the config options at the top of the php file before blindly running it.

I hope you get some use from it.

Cheers!

Code: Select all

//-----------------------------------------------------------------------------
// Name : greylist.php
// Ver  : 0.9
// Desc : This Script allows you to search, display and add information held 
//        in the greylisting/whitlisting tables of hmailservers database.
//
// Todo : Add wildcard support to IP search (Not sure how to add this yet as IP is stored as LONG in DB)
// Todo : Figure out how to refresh hMail's Whitelist Cache. (Still not done as needs COM access)
//
// Added : Sort list order Newer/Older (Defalts to newest)
// Added : Made it a little more compliant. Shouldn't need short tags on anymore.
// Added : Wild Card Search for sender and receiver addresses
// Added : Refresh link to help if you are waiting for an email to show up.
// Added : Warning if you try to do a host lookup on more than 100 IP's
//-----------------------------------------------------------------------------
Download v0.9
Last edited by ^DooM^ on 2007-02-02 18:45, edited 4 times in total.
If at first you don't succeed, bomb disposal probably isn't for you! ヅ

GlenC
Senior user
Senior user
Posts: 680
Joined: 2004-08-17 23:31
Location: Santiago, Chile

Post by GlenC » 2006-11-28 00:15

Thanks for this... really handy tool I think. I was trying to create something along these lines but... let´s just say you saved me a LOT of frustration (and time) :)

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

Post by ^DooM^ » 2006-11-28 00:48

My Pleasure. Took around a day to write it. As I mentioned it's not completely finished yet as I want to add wildcard search to it and somehow get around the caching issue without having to interface the COM API as well.

mbreitba
Senior user
Senior user
Posts: 340
Joined: 2006-04-14 22:25

Post by mbreitba » 2006-12-01 00:37

Anything special that needs to be done to run that script? I'm getting a MySQL error when it tries to connect to localhost on our test box. PHP version that this requires? Anything else silly I'm overlooking?

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

Post by ^DooM^ » 2006-12-01 02:22

I connect over local network to MySQL 4. php short tags must be on. aside that its a pretty basic script. What is the mysql error?

Edit: I use the latest PHP 4.4.4. I will test this out tomorrow on PHP5 I will also test this out on a local version of MySQL. I have a feeling that you are using a later version of MySQL and strict mode is causing issues. If I get chance tomorrow I will setup the latest SQL in strict mode and see what happens.

mbreitba
Senior user
Senior user
Posts: 340
Joined: 2006-04-14 22:25

Post by mbreitba » 2006-12-01 03:00

Figured out the problem, hmail's dedicated MySQL instance is running on port 3307, rather than the default port.

mbreitba
Senior user
Senior user
Posts: 340
Joined: 2006-04-14 22:25

Post by mbreitba » 2006-12-01 03:16

Edit -

I think I figured it out.....one of our setup scripts overwrites the mysql connector DLL for PHP with an old version from 2003. I've restored the correct DLL, and am going to test again.

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

Post by ^DooM^ » 2006-12-01 11:10

Ahh excellent. I didn't take into account the port number difference on local hmail mysql as I use a dedicated sql server. A word of warning on that script. Please do not do tick hostname lookups until you have narrowed down your search as its extremely expensive and could cause the script to time out. I am going to hopefully have some time over the weekend to continue working on this.

Cheers!

olanjouw
Normal user
Normal user
Posts: 35
Joined: 2006-05-20 18:17

Post by olanjouw » 2006-12-08 17:49

cant find out how to use this
where do i put this file?
thanks?

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

Post by ^DooM^ » 2006-12-08 18:07

If you have PHP installed put it in your www root folder.

olanjouw
Normal user
Normal user
Posts: 35
Joined: 2006-05-20 18:17

Post by olanjouw » 2006-12-08 18:17

what am i doing wrong?
I see this in my browser:

Greylist Search.
Password

host, $strMySQL->user, $strMySQL->pass) or die(mysql_error()); $pSelect = mysql_select_db($strMySQL->dbase) or die(mysql_error()); // Select and count all records. $pQuery = mysql_query("SELECT COUNT(*) AS numrows FROM `hm_greylisting_triplets`"); $strTableCount = mysql_fetch_array($pQuery); mysql_free_result($pQuery); // Select and count all currently delayed records. $pQuery = mysql_query("SELECT COUNT(*) AS numrows FROM `hm_greylisting_triplets` WHERE `glpassedcount` = 0"); $strPendingCount = mysql_fetch_array($pQuery); mysql_free_result($pQuery); // Select all distinct ip address' and count. $pQuery = mysql_query("SELECT COUNT(DISTINCT glipaddress) AS numrows FROM `hm_greylisting_triplets`"); $strUniqueIPCount = mysql_fetch_array($pQuery); mysql_free_result($pQuery); // Close the connection mysql_close($pOpen); ?> Stats
Total number of records in greylisting table:
Total number of pending email messages:
Total number of unique IP's:


Greylist Search.
Sender Address
Recipient Address
IP Address
Limit Results
Delayed Only
Hostname Lookup


host, $strMySQL->user, $strMySQL->pass) or die(mysql_error()); $pSelect = mysql_select_db($strMySQL->dbase) or die(mysql_error()); // Depending on what is passed, Build the SQL statement. $strSQL = "SELECT * FROM `hm_greylisting_triplets`"; // If nothing is passed just select everything if( empty( $strSenderAddress ) && empty( $strRecipientAddress ) && empty( $strIPAddress ) ) $strSQL .= ""; elseif( !empty( $strSenderAddress ) && empty( $strRecipientAddress ) && empty( $strIPAddress ) ) $strSQL .= " WHERE `glsenderaddress` = '{$strSenderAddress}' "; elseif( empty( $strSenderAddress ) && !empty( $strRecipientAddress ) && empty( $strIPAddress ) ) $strSQL .= " WHERE `glrecipientaddress` = '{$strRecipientAddress}' "; elseif( empty( $strSenderAddress ) && empty( $strRecipientAddress ) && !empty( $strIPAddress ) ) $strSQL .= " WHERE `glipaddress` = '{$strLongIP}' "; elseif( !empty( $strSenderAddress ) && !empty( $strRecipientAddress ) && empty( $strIPAddress ) ) $strSQL .= " WHERE `glsenderaddress` = '{$strSenderAddress}' AND `glrecipientaddress` = '{$strRecipientAddress}' "; elseif( !empty( $strSenderAddress ) && empty( $strRecipientAddress ) && !empty( $strIPAddress ) ) $strSQL .= " WHERE `glsenderaddress` = '{$strSenderAddress}' AND `glipaddress` = '{$strLongIP}' "; elseif( empty( $strSenderAddress ) && !empty( $strRecipientAddress

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

Post by ^DooM^ » 2006-12-08 18:32

have you got PHP installed?

olanjouw
Normal user
Normal user
Posts: 35
Joined: 2006-05-20 18:17

Post by olanjouw » 2006-12-08 18:44


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

Post by ^DooM^ » 2006-12-08 19:11

You need to enable short tags in PHP.

I will make this script a little more compliant on the next release.

olanjouw
Normal user
Normal user
Posts: 35
Joined: 2006-05-20 18:17

Post by olanjouw » 2006-12-10 13:04

thanks, its running now.
im using a default installation with the internal mysql database.
i didnt managed to connect.
as mentioned above the database is running on another port.
What can i do to connect to the default installed database?
im not so familiar with databases and stuff, even dont know where i can find the name of my database.....
thanks for your help

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

Post by ^DooM^ » 2006-12-10 13:40

Hello,

In php.ini you need to uncomment the line (Remove the ; from the front of the line)

Code: Select all

extension=php_mysql.dll
Next find

Code: Select all

mysql.default_port =
and change it to

Code: Select all

mysql.default_port = 3307
This is because the internal MySQL hmail uses is installed on a non default port so as not to interfere with other instances of mysql that maybe running on the server.

Next you need to find out your password. To do this follow step one of these instructions.

http://www.hmailserver.com/documentatio ... pair_mysql

So your config should then look something like this.

Code: Select all

// SQL Info
$strMySQL->host  = "localhost";   // Host Name
$strMySQL->user  = "root";        // Username (This is the default username)
$strMySQL->pass  = "";            // Password you gained from the above step.
$strMySQL->dbase = "hmailserver"; // Database Name (This is the default database name)
I hope this helps.

olanjouw
Normal user
Normal user
Posts: 35
Joined: 2006-05-20 18:17

Post by olanjouw » 2006-12-10 14:40

ok.
i have password, changed php.ini, changed greylist.php
i installed SQLyog and am able to connect to hmailserver database

butwhen i start greylist.php all i see is greylist search and password+ submit button
if i fill in my password, nothing happens, if i fill in the founded password nothing happens

getting closer but no success yet...

Thanks for your help.

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

Post by ^DooM^ » 2006-12-10 18:06

you need to define the greylist managers password at the top of the greylist.php file. It defaults to: Password and is CaSe SeNsItIvE :)

olanjouw
Normal user
Normal user
Posts: 35
Joined: 2006-05-20 18:17

Post by olanjouw » 2006-12-10 21:12

yes!
thanks for your patience...

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

Post by ^DooM^ » 2006-12-10 21:28

No Problem,

Hopefully if someone else runs into the same problem now this will help them too.

I will be updating it at some point to be more compliant and allow for wild card searches.

If you have any suggestions please feel free to ask.

olanjouw
Normal user
Normal user
Posts: 35
Joined: 2006-05-20 18:17

Post by olanjouw » 2006-12-10 23:52

is there a way to sort the list, newest on top ?

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

Post by ^DooM^ » 2006-12-11 02:12

Nope not currently but that's a nice idea. I will add it to the next release.

If you would like to change the way it works now until I add the option find this block of code thats starts on line 301

Code: Select all

    // Limit results?
    if( !empty( $strLimitResults ) )
        $strSQL .= " ORDER BY `glcreatetime` ASC LIMIT {$strLimitResults}";
    else
        $strSQL .= " ORDER BY `glcreatetime` ASC";
Replace with

Code: Select all

    // Limit results?
    if( !empty( $strLimitResults ) )
        $strSQL .= " ORDER BY `glcreatetime` DESC LIMIT {$strLimitResults}";
    else
        $strSQL .= " ORDER BY `glcreatetime` DESC";
Cheers!

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

Post by ^DooM^ » 2006-12-13 13:36

New Update v0.9

Code: Select all

//-----------------------------------------------------------------------------
// Name : greylist.php
// Ver  : 0.9
// Desc : This Script allows you to search, display and add information held 
//        in the greylisting/whitlisting tables of hmailservers database.
//
// Todo : Add wildcard support to IP search (Not sure how to add this yet as IP is stored as LONG in DB)
// Todo : Figure out how to refresh hMail's Whitelist Cache. (Still not done as needs COM access)
//
// Added : Sort list order Newer/Older (Defalts to newest)
// Added : Made it a little more compliant. Shouldn't need short tags on anymore.
// Added : Wild Card Search for sender and receiver addresses
// Added : Refresh link to help if you are waiting for an email to show up.
// Added : Warning if you try to do a host lookup on more than 100 IP's
//-----------------------------------------------------------------------------
Added a few more features to this and made it a little more compliant with PHP for those that don't wan't to use short tags.

Download v0.9
Last edited by ^DooM^ on 2007-02-02 15:10, edited 2 times in total.
If at first you don't succeed, bomb disposal probably isn't for you! ヅ

olanjouw
Normal user
Normal user
Posts: 35
Joined: 2006-05-20 18:17

Post by olanjouw » 2006-12-13 22:26

thanks, its working perfectly

User avatar
BOOZy
Normal user
Normal user
Posts: 80
Joined: 2006-05-25 01:25
Location: .nl
Contact:

PHP4 with buildin hMailServer database

Post by BOOZy » 2007-02-02 18:42

What to do when you're using PHP4 to connect to hMailServer with the build in database?


Step1:
Install a second instance of MySQL.
Yes, I'm not crazy, you can do this without any problems, as it'll run on the default port (3306), instead of 3307.
Make sure you get the same or a newer version of course.

Step 2:
Determine your root password.
Use the DecryptBlowfish.vbs in \Addons\Utilities with your admin password and the hash string found in hMailServer.ini

Step 3:
Connect to MySQL
Start a command prompt and type:
mysql -uroot -pyourpassword --port=3307
SET PASSWORD FOR 'root'@'localhost' = OLD_PASSWORD('yourpassword');
flush privileges;
exit

Step 4:
Replace the password hash in hMailServer.ini with above password, and change passwordencryption to 0.
Restart the hMailServerMySQL service.

Step 5:
Enter above found password in greylist.php
and for easy use, add :3307 to the host addres, so you don't have to edit php.ini to use a different port number.

Step 6:
Be Happy!

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

Post by ^DooM^ » 2007-02-02 18:44

Thanks for the writeup boozy.

Most helpful

brashquido
Normal user
Normal user
Posts: 249
Joined: 2006-06-26 07:14
Location: Melbourne, Australia
Contact:

Post by brashquido » 2007-03-19 02:52

Cool :)

large
Normal user
Normal user
Posts: 33
Joined: 2004-12-31 12:47
Contact:

Post by large » 2007-08-02 10:09

I got a small error on a SQL error here on my Windows MySQL machine. Here is a small fix:

Goto line 527:

Code: Select all

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

Code: Select all

$pQuery = mysql_query("INSERT INTO `hm_greylisting_whiteaddresses` VALUES(null,'{$strIPAddress}','{$strDescription}')") or die(mysql_error());
Edit:
I guess default auto increment values need be null, atleast in windows!

The adm console did not refresh the whitelist, I guess a:
Settings -> GreyListingWhiteAddresses -> Refresh() should be added to the script also! :)

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

Post by ^DooM^ » 2007-08-02 10:34

I am pretty sure it has more to do with being ran in strict mode and doesn't have anything to do with it being on a windows platform. You are the first person I know about that has had this issue so far.

Also to your second point. My script is purely SQL driven. To refresh the whitelist cache you would need to access the COM API
// Todo : Figure out how to refresh hMail's Whitelist Cache. (Still not done as needs COM access)
;)

large
Normal user
Normal user
Posts: 33
Joined: 2004-12-31 12:47
Contact:

Post by large » 2007-08-02 10:49

^DooM^ wrote:It depends on if you are running in strict mode or not and doesn't have anything to do with it being on a windows platform. You are the first person I know about that has had this issue so far.

Also to your second point. My script is purely SQL driven. To refresh the whitelist cache you would need to access the COM API
// Todo : Figure out how to refresh hMail's Whitelist Cache. (Still not done as needs COM access)
;)
lol, I didn't read that todo stuff, hehe... The MySQL installation is a default installation directly from mysql.com, so I guess others might get the same failure.


Now for the way further with this script. Here are some ideas:
1. A user get at the end of the day a list over greylisted e-mails with addresses and subjects based on logon name or alias(es).
2. Each user can simply logon to the greylist based on their logon name or alias(es) and whitelist known adresses (if needed)
3. The user can also edit whitelist based on its e-mail (Guess the description field can be used to filter that out)

That way you have a selfcontaining spam-system that can be modified by users. Should be pretty cool, and even better if martin implement a blacklist on ip/host/e-mail later on :)
Lars Werner
http://lars.werner.no
Check out my tools:
http://lars.werner.no/unpacker/ - 100% automated extraction tool
http://lars.werner.no/sizeme/ - Maximize the output on a given media (like CD/DVD ect)

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

Post by ^DooM^ » 2007-08-02 10:53

For your ideas to be implemented the script would need to be re-written from scratch using the COM API instead of accessing the database directly. Might be a cool project to do in the future but I have no time to expand on this currently. Maybe something like this can be added to phpWebAdmin as a plugin or similar

lonney
New user
New user
Posts: 7
Joined: 2007-11-13 08:24

Can`t connect to MySQL server

Post by lonney » 2007-11-13 08:49

Hi all,

Trying to get this php script to work, after tweaking the script settings as requiredt:

Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on '127.0.0.1' (10061) in e:\programs\apache\htdocs\xxxxx\greylist.php on line 205
Can't connect to MySQL server on '127.0.0.1' (10061)

Reading carefully through the posts in this thread, I have the hmailserver password right (made a note of it at install time).

Checked php.ini for extension=php_mysql.dll, not found. http://www.php.net/mysql says the PHP MySQL extension is compiled into PHP 4 for Windows.

Tried setting mysql.default_port = 3307, no joy. telnet localhost 3307 connects, so something is listening on that port.

Running Windows 2003 Server, hmailserver 4.4.B270, Apache 1.3.37, php 4.4.7.

Any suggestions?

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

Post by ^DooM^ » 2007-11-13 10:45

You need to use the MySql password not the hmailserver password.

You can find the sqlserver's password by following step 1's instructions here

lonney
New user
New user
Posts: 7
Joined: 2007-11-13 08:24

Post by lonney » 2007-11-13 10:51

I did wonder about that. When I followed that step the result I got from the vbscript was garbage characters. I'll give it another go tomorrow. Good to know whats what the issue will be. Thanks for your help :)

lonney
New user
New user
Posts: 7
Joined: 2007-11-13 08:24

Post by lonney » 2007-11-14 09:54

Managed to decrypt the password. double checked everything, still getting cant connect error.

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

Post by ^DooM^ » 2007-11-14 11:13

Are you running the script locally on the same machine as hmail?

lonney
New user
New user
Posts: 7
Joined: 2007-11-13 08:24

Post by lonney » 2007-11-14 19:33

yes same machine, standard hmail install using its own sql server + squirrel mail. only thing I can think of is the password is still wrong, going to look for a commandline sql client I can use to test thelogin.

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

Post by ^DooM^ » 2007-11-14 21:32

ok, let me know how you get on.

lonney
New user
New user
Posts: 7
Joined: 2007-11-13 08:24

Post by lonney » 2007-11-15 06:26

mysql --port=3307 --user=root -p
Enter password: ********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 20
Server version: 4.1.18-nt

Looks like the issue is with php connecting to mysql. my feeling is its not trying on the right port. I have updated php.ini with mysql.default_port = 3307. Not sure what to look at next...

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

Post by ^DooM^ » 2007-11-15 10:24

Are you sure your editing the correct PHP.ini?

lonney
New user
New user
Posts: 7
Joined: 2007-11-13 08:24

Post by lonney » 2007-11-17 01:22

Seems I wasnt! All sorted now, however still no joy:

Client does not support authentication protocol requested by server; consider upgrading MySQL client

I'm running php 4.4.7 and im guessing its too old.

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

Post by ^DooM^ » 2007-11-17 12:29

Yeah but you can get round it.

Create another user on your SQL server with same privileges as hmail then you need to change the password to an oldstyle password

Start a cmd prompt and type the following (Changing the values of course)

Code: Select all

mysql -p
mysql> set password for 'user'@'ipaddress' = OLD_PASSWORD('passwordyouwanttouse');
mysql> flush privileges;
exit
Change your mysql details in the script to use the new users details and all should be groovy...

AlanSilver
Normal user
Normal user
Posts: 190
Joined: 2007-04-22 17:06

Post by AlanSilver » 2007-11-24 23:52

Hello,

I have hMailserver running against Microsoft SQL Server 2000, not MySql. Can I still use this script? If so, how?

Thanks

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

Post by ^DooM^ » 2007-11-25 03:53

No this script is not compatible with MSSQL server I am afraid.

AlanSilver
Normal user
Normal user
Posts: 190
Joined: 2007-04-22 17:06

Post by AlanSilver » 2007-11-25 14:20

OK, thanks anyway.

Any tips how I can emulate the same ideas directly? I'm quite happy working with SQL queries, so if you can point me to the specific queries that are used for the reports, I should be able to get an idea form that.

Thanks

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

Post by ^DooM^ » 2007-11-25 14:47

If you do searches for the following terms in the script you should see where all the mysql statements are and be able to replace them with mssql ones.

mysql_
SELECT
WHERE
ORDER BY

I have never used mssql before so cannot give you precise instructions on how to alter it.

AlanSilver
Normal user
Normal user
Posts: 190
Joined: 2007-04-22 17:06

Post by AlanSilver » 2007-11-25 14:53

Thanks, but that wasn't what I meant ;-)

Unless your script does anything weird, I imagine that the queries themselves will be compatible without modification. I was more meaning to ask which queries give the information I want. Remember, I've never seen the script running, so I'm not 100% sure what info is reported.

I'm interested in seeing what is going on with the grey listing. I enabled it a few days ago, but would like to see what hMailserver is actually doing, partly to make sure I'm not losing any real mail. If you could tell me which queries give the relevant info, I can just try those.

Thanks

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

Post by ^DooM^ » 2007-11-25 15:51

My apologies I miss-understood what you were asking.

The script is dynamic depending on what it is exactly you are looking for there is not just one SQL statement to get the results.

If you want to see all results then a simple

SELECT * FROM `hm_greylisting_triplets` WHERE 1;

will suffice.

I hope this is what you were looking for. :lol:

AlanSilver
Normal user
Normal user
Posts: 190
Joined: 2007-04-22 17:06

Post by AlanSilver » 2007-11-25 23:04

Thanks, that's great.

Just a clarification if you don't mind. If I want to see all the e-mails that didn't pass, do I just look for the records where glpassedcount is zero? Looking at the code, it seems that this should be the case, but then it also seems that these are delayed ones.

Please can you clarify what criteria I need in the where clause for e-mails that passed, and for those that didn't pass.

Thanks again

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

Post by ^DooM^ » 2007-11-25 23:16

Yes you are correct.

glpassedcount >= 1 then marked as passed. 0 == delayed.

AlanSilver
Normal user
Normal user
Posts: 190
Joined: 2007-04-22 17:06

Post by AlanSilver » 2007-11-26 00:47

What about if it was rejected? What would be the value then?

Thanks

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

Post by ^DooM^ » 2007-11-26 03:16

As far as I am aware it was either passed or delayed. If it was rejected after greylisting I would assume it would be marked as passed for the triplet record.

I will look into that actually. Might be a nice feature request to help cut down on even more spam. If triplet passed but was then subsequently rejected via SURBL DNSBL etc then delete the triplet record.

Marking it back to 0 wouldn't work as on the next try it would pass again anyway.

AlanSilver
Normal user
Normal user
Posts: 190
Joined: 2007-04-22 17:06

Post by AlanSilver » 2007-11-26 17:27

Thanks for the reply.

I think I'm a bit confused (nothing new!) about how this works. I thought the idea was that e-mails were rejected (unless on the whitelist), and only accepted if the sender tried again, proving that it's a real originator. In that case, you would have e-mails that passed (ie were confirmed as being from a genuine source), failed (ie not confirmed), and pending (ie waiting for the confirmation).

Is this wrong? You said that they can only be passed or delayed. Please can you clarify what actually happens as I think I've missed the point.

Thanks

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

Post by ^DooM^ » 2007-11-26 18:16

Ok greylisting happens before any other spam protection mechanism.

Email server connects and hmail places the following three peices of information into the triplets table

Connecting IP address
To Address
From Address

After this hmail delays the email with a 451 Try again later.

When another server connects the whole process begins again but hMail will try to match those 3 pieces of info first.

If it finds a row with all three matching bits of info it marks that record as passed and allows the email to continue at which point the other spam mechanisms are implemented.

If it doesn't find a matching row it will add the three pieces of info to the triplets table and delay the email.

There is no concept of a failed record within the current greylisting mechanism as far as I am aware.

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

Post by martin » 2007-11-26 19:45

Actually, grey listing happens after for example DNS blacklist checks.
I thought the idea was that e-mails were rejected (unless on the whitelist), and only accepted if the sender tried again, proving that it's a real originator. In that case, you would have e-mails that passed (ie were confirmed as being from a genuine source), failed (ie not confirmed), and pending (ie waiting for the confirmation).
As ^DooM^ writes, "failed" and "pending" is the same from a grey listing perspective. A triplet is either "pending" or it's not. There's no 3'rd state. If a triplet has expired (after a certain number of days), it's removed from the database

From the doc's:
When a sender tries to deliver a message for the first time to your server, hMailServer will save the senders IP adderss, the senders email address and the recipient email address. This information is called a triplet. hMailServer will reject the message and kindly ask the sending server to retry later. The next time the sending server tries to deliver an email which matches the triplet, hMailServer will accept the message.
That pretty much sums it up. :)

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

Post by ^DooM^ » 2007-11-26 20:02

You know I would of bet 100 quid greylisting was first. Either way the result is still the same :)

So with the new V5 score system for spam will there be any changes to the triplets table?

AlanSilver
Normal user
Normal user
Posts: 190
Joined: 2007-04-22 17:06

Post by AlanSilver » 2007-11-27 00:35

Thanks to both of you, I understand it a lot better now.

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

Post by mattg » 2007-11-27 02:01

^DooM^ wrote:You know I would of bet 100 quid greylisting was first.
Me too.
^DooM^ wrote:Either way the result is still the same :)
End result yes, but workload??

Wouldn't the workload of the server be less to perform greylisting than to perform DNS Blacklist checks? Certainly I'd imagine that the internet bandwidth should be less and the time taken too. But t hen I guess the triplets table would increase dynamically in size too.

Not that it matters to me at all with my small installation. :D

Matt

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

Post by ^DooM^ » 2007-11-27 02:39

Perhaps there is a reason it is done the way it is. To me greylisting first seems to make more sense but then that doesn't mean anything :D

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

Post by Kaan1983 » 2007-11-27 13:27

So you just use ASSP right ans I guess ASSP does this greylisting?

Post Reply