Is there a way to force hms headers?

Use this forum if you have installed hMailServer and want to ask a question related to a production release of hMailServer. Before posting, please read the troubleshooting guide. A large part of all reported issues are already described in detail here.
Post Reply
estradis
Normal user
Normal user
Posts: 156
Joined: 2014-09-09 10:47

Is there a way to force hms headers?

Post by estradis » 2018-03-11 09:49

hms is able to do own tests, including mx, dns and spf lookup. If there is a mismatch, hms will add headers like "hMailserver-Reason-...". Is there a way to force these headers, even if there is no fail?

My intention is to get headers, whether mx, dns and especially spf are ok or not. I want to use these headers to implement a better spam-server detection.

User avatar
jimimaseye
Moderator
Moderator
Posts: 8680
Joined: 2011-09-08 17:48

Re: Is there a way to force hms headers?

Post by jimimaseye » 2018-03-11 09:55

There is no known way without a modification to the source code. The only place such results may appear is in debug log (but then I'm not even sure about that without looking).
5.7 on test.
SpamassassinForWindows 3.4.0 spamd service
AV: Clamwin + Clamd service + sanesecurity defs : https://www.hmailserver.com/forum/viewtopic.php?f=21&t=26829

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

Re: Is there a way to force hms headers?

Post by mattg » 2018-03-11 12:37

Not quite jimimaseye

Those headers are added once the hMailserver MARK spam threshold is reached

If you set the MARK threshold to 0 then all mail that trigger any test will get these headers added
A message without these headers will not score on any SPAM tests

This detail is definitely available in debug logging
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

User avatar
jimimaseye
Moderator
Moderator
Posts: 8680
Joined: 2011-09-08 17:48

Re: Is there a way to force hms headers?

Post by jimimaseye » 2018-03-11 12:41

mattg wrote:
2018-03-11 12:37
Those headers are added once the hMailserver MARK spam threshold is reached

If you set the MARK threshold to 0 then all mail that trigger any test will get these headers added
A message without these headers will not score on any SPAM tests
Indeed. Sorry i didn't read his initial post correctly ("My intention is to get headers, whether.... ok or not.")

Lesson learnt.
5.7 on test.
SpamassassinForWindows 3.4.0 spamd service
AV: Clamwin + Clamd service + sanesecurity defs : https://www.hmailserver.com/forum/viewtopic.php?f=21&t=26829

User avatar
SorenR
Senior user
Senior user
Posts: 3706
Joined: 2006-08-21 15:38
Location: Denmark

Re: Is there a way to force hms headers?

Post by SorenR » 2018-03-11 16:07

mattg wrote:
2018-03-11 12:37
Not quite jimimaseye

Those headers are added once the hMailserver MARK spam threshold is reached

If you set the MARK threshold to 0 then all mail that trigger any test will get these headers added
A message without these headers will not score on any SPAM tests

This detail is definitely available in debug logging
This header "X-hMailServer-Spam" will loose it's meaning as it will be "YES" permanently.

"X-hMailServer-Reason-Score" will be the determining factor if message is to be marked as SPAM or not, and if Spamassassin is used, these two: "X-Spam-Flag: YES" and "X-Spam-Virus: No"

Anywho... For version 5.6.7B?? I believe you could just remark line 248 and 249 in SpamProtection.cpp to have all headers listed regardless...
Disclaimer

All of the scripts, languages, programs, links and content in this post are for self help only. They are not intended to diagnose or cure any problem you might have. What you do to your computer(s), server(s), and VMs is not my fault. I merely am here to show you what I have done in the past and what has worked for me. Everything in this post is for academic purposes only and is not intended to make your life easier. If, by some chance, you ruin something while doing anything in my post, it’s 100% your fault for doing it in the first place and I cannot and will not be held responsible for any trouble you might have.

Any names, places, addresses, or anything else listed in any type of file in this post or any of my posts on this site in general are 100% coincidental and they mean absolutely no offense. Also, this post and all of its opinions and information are not endorsed by anybody and they do not reflect the opinion of my employer.

I am a 100% an independent writer / blogger / instructor. I don’t represent anyone or anything except myself and the products that I recommend in here are awesome because I think they are awesome and that’s about it. If you don’t think they are awesome, it’s not my fault. Most of the stuff I recommend is free, and if it’s not free it probably has some type of trial available (which if it does, I suggest you try it first).

Just because I am proponent of Open Source / GNU software doesn’t mean that I deny non-free software. If you are one of those “Open Source Only or Die” people, I am sorry, but my feeling is that to deny non-free software is like denying that rated R movies exist to a 16 year old.
SørenR.

“Those who don't know history are doomed to repeat it.”
― Edmund Burke

estradis
Normal user
Normal user
Posts: 156
Joined: 2014-09-09 10:47

Re: Is there a way to force hms headers?

Post by estradis » 2018-03-12 11:20

Thank you all for your replies.

After reading all your comments the "short" answer seems to "No". The longer answer seems to be "By compiling an own branch", one of the things I'd like to avoid.

I'm going to try to setup spamassassin to analyze result headers. I know, SA can handle SPF, but I have no idea whether it can also test DNS records like IP, MX and PTR (especially mismatching records)

User avatar
jimimaseye
Moderator
Moderator
Posts: 8680
Joined: 2011-09-08 17:48

Re: Is there a way to force hms headers?

Post by jimimaseye » 2018-03-12 11:25

Using matts suggestion, you can set your 'Mark' threshold to Zero - that will add the 'reason' headers. (You dont need to have a subject "[SPAM]" word if you want to avoid confusion).
5.7 on test.
SpamassassinForWindows 3.4.0 spamd service
AV: Clamwin + Clamd service + sanesecurity defs : https://www.hmailserver.com/forum/viewtopic.php?f=21&t=26829

User avatar
SorenR
Senior user
Senior user
Posts: 3706
Joined: 2006-08-21 15:38
Location: Denmark

Re: Is there a way to force hms headers?

Post by SorenR » 2018-03-12 12:21

estradis wrote:
2018-03-12 11:20
Thank you all for your replies.

After reading all your comments the "short" answer seems to "No". The longer answer seems to be "By compiling an own branch", one of the things I'd like to avoid.

I'm going to try to setup spamassassin to analyze result headers. I know, SA can handle SPF, but I have no idea whether it can also test DNS records like IP, MX and PTR (especially mismatching records)
SpamAssassin have all sorts of testing, it just takes some time to find them all on The 'Net. You name it - someone probably already done it :mrgreen:

As a side note... According to RFC the sending MTA is NOT required to have MX records, A records will suffice. FCrDNS however is another matter, hardcore Postmasters will claim it is a requirement but real life have a more relaxed approach. :roll:

My own system is FCrDNS confirmed and I receive mail on @MX-record, @A-record and @IP-address 8) :mrgreen:

FCrDNS means that A-record -> PTR and PTR -> A-record.
SørenR.

“Those who don't know history are doomed to repeat it.”
― Edmund Burke

estradis
Normal user
Normal user
Posts: 156
Joined: 2014-09-09 10:47

Re: Is there a way to force hms headers?

Post by estradis » 2018-03-16 10:03

SorenR wrote:
2018-03-12 12:21
estradis wrote:
2018-03-12 11:20
Thank you all for your replies.

After reading all your comments the "short" answer seems to "No". The longer answer seems to be "By compiling an own branch", one of the things I'd like to avoid.

I'm going to try to setup spamassassin to analyze result headers. I know, SA can handle SPF, but I have no idea whether it can also test DNS records like IP, MX and PTR (especially mismatching records)
SpamAssassin have all sorts of testing, it just takes some time to find them all on The 'Net. You name it - someone probably already done it :mrgreen:

As a side note... According to RFC the sending MTA is NOT required to have MX records, A records will suffice. FCrDNS however is another matter, hardcore Postmasters will claim it is a requirement but real life have a more relaxed approach. :roll:

My own system is FCrDNS confirmed and I receive mail on @MX-record, @A-record and @IP-address 8) :mrgreen:

FCrDNS means that A-record -> PTR and PTR -> A-record.
Ah, yes - You're right!

My intention was not to test mx on the delivering server. I want to test mx between the Received headers. Spam mails delivered to our company very often use multiple hops. The idea is to test the whole path. (Have the first server delivered to the second server by mx or not? And so on ...) The results should hopefully help to make the final decision whether the incoming mail is spam or not.

And of course I want to determine, whether A and PTR does fit together.

estradis
Normal user
Normal user
Posts: 156
Joined: 2014-09-09 10:47

Re: Is there a way to force hms headers?

Post by estradis » 2018-03-21 21:07

Meanwhile I've been testing a lot, but the results are a little bit confusing. :?

Somtimes I got these headers:

Code: Select all

X-hMailServer-Reason-1: The host name specified in HELO does not match IP address. - (Score: 3)
X-hMailServer-Reason-2: Tagged as Spam by SpamAssassin - (Score: 25)
Sometimes I got these headers:

Code: Select all

X-hMailServer-Reason-1: Tagged as Spam by SpamAssassin - (Score: 24)
X-hMailServer-Reason-2: The host name specified in HELO does not match IP address. - (Score: 3)
How is that going on? Any ideas?

User avatar
jimimaseye
Moderator
Moderator
Posts: 8680
Joined: 2011-09-08 17:48

Re: Is there a way to force hms headers?

Post by jimimaseye » 2018-03-21 21:37

What exactly are you asking? Whats confusing you?

If its the order, then it simply because of the order the results gets returned. The tests are asyncronous in that they are all submitted - they dont wait until the last test is completed before firing the next. The spamassassin tests will always take different lengths of time to complete (depending on the contents and origins of the email). It the results get returns before the HELO test completes, then it has an earlier number. If the HELO test gets returned first then the spam tests will be after.
5.7 on test.
SpamassassinForWindows 3.4.0 spamd service
AV: Clamwin + Clamd service + sanesecurity defs : https://www.hmailserver.com/forum/viewtopic.php?f=21&t=26829

estradis
Normal user
Normal user
Posts: 156
Joined: 2014-09-09 10:47

Re: Is there a way to force hms headers?

Post by estradis » 2018-03-21 22:13

Well explained!

It was exactly the order what was confusing me. Your answer helps me to understand.
Thank you.

Post Reply