Yeah, i posted the code for it earlier in the other topic as a replacement for cports...can't find the specific topic though

Yeah, i posted the code for it earlier in the other topic as a replacement for cports...can't find the specific topic though
Result.Value = 3 will send errorcode 453 ... if it follows my initial code.
Ditto
https://github.com/hmailserver/hmailserver/pull/150
Yes we should - I use this one too
@insomniac2k2insomniac2k2 wrote: ↑2019-04-25 02:13Should I assume that this is your most recent build (obvious question, i know..) RvdH?
Thats right, but i can provide"the uptodate" SSL buils with OpenSSL builds max. til 12/31/2019.
Probably postfix & courier, but also possibly a standalone 'cipher mail' VM
I'm not happy to read that!mattg wrote: ↑2019-04-26 01:19...
Martin's input has been limited since about 2012. For a couple of years we didn't hear anything ... Then Martin came back for a few months ... seem to disappear again.
Martin has really only done security related updates since 5.5 was released, with some fairly significant changes in 5.6 that were all security related.
5.7 has been promised for over 3 years >> https://www.hmailserver.com/forum/viewt ... 10&t=29686
with not much development being visible
...
Hey, I'd be in. It's been years (ok, decades) since I did anything serous in c/c++, but I'd be up for testing, documentation, and the odd bit of grunt coding. Do we need to be invited to the HCD Github org? It looks private.
+1mattg wrote: ↑2019-04-26 01:19As I said above, I have a lot of time invested here, and I'd like to see it work, but there comes a time where I need to protect my actual income, and move on to a product that continues to be updated. When I first started using hMailserver I wasn't keen on config file and Linux command line stuff, but someone told me recently that I've evolved into a grumpy old Linux Zealot. It seems that is correct.
katip wrote: ↑2019-04-27 09:03+1mattg wrote: ↑2019-04-26 01:19As I said above, I have a lot of time invested here, and I'd like to see it work, but there comes a time where I need to protect my actual income, and move on to a product that continues to be updated. When I first started using hMailserver I wasn't keen on config file and Linux command line stuff, but someone told me recently that I've evolved into a grumpy old Linux Zealot. It seems that is correct.
frankly spoken, nowadays i'm trying to teach myself Postfix/Dovecot & co.
you know, it isn't an easy job to get things together now on a black screen, after a "Next, Next... Done" world for some decades. i must learn almost all from scratch, line by line in config files in rawest form. not just installing an iRedMail combo and pay 500 bucks/year for a fancy WebUI. nonsense. same as a 365 or Gmail "Business Plan".
i don't know if Martin will appear, maybe we'll never hear from him again - like Nico and his brilliant ClamAV builds once. anyway, i hope both are doing fine.
currently i appreciate Dravion's endeavors and have an eye on them. however, the portrait he describes isn't very promising to me, YMMV.
that said, after +10 happy years with HMS both at home and office, i have a feeling that i'm approaching a crossroad where i must choose a long term path at least for another decade. i must be prepared. particularly to what concerns our production server.
You mean create a Github account?Dravion wrote: ↑2019-04-27 08:32Soinds good!
The HCD Project on Github is splitted ofi in 4
Teams. Core, Client, Testers and Documrntation
so you can choose where you wanna participate.
To join the Github HCD Organization you need to
1} Create an Gizhub Account
2) Let one of the HCD Admins know you want to join
Is this normal? I'm referring to the "The read operation failed" It happens after every successful OnHELO event. I'm not sure if the event was actually successful or if the bot just gets cut off because it doesn't know how to respond to the 453 message sent back to it.SorenR wrote: ↑2016-08-11 17:47Hmm... There has been a development... Something works when it really should not![]()
When I initially made this for my 5.4.2 I could not use "Result.Value" and "Result.Message" as the server would crash ...![]()
When I ported my changes to a fresh 5.6.5-B2367 I assumed (I know... Assumption Is The Mother Of All Fuckups!) it would behave the same way but I left the code in there. Well, just played a bit with it - no errors!
Code: Select all
"DEBUG" 868 "2016-08-11 17:30:02.649" "Executing event OnHELO" "DEBUG" 868 "2016-08-11 17:30:02.649" "Event completed" "SMTPD" 868 166 "2016-08-11 17:30:02.649" "127.0.0.1" "SENT: 554 Whooa... Whaz' up?"
If someone wants to try it out I have a fresh compiled 5.6.5-B2367.1 "hMailServer.exe" on my webserver...Code: Select all
Sub OnHELO(oClient) Result.Message = "Whooa... Whaz' up?" Result.Value = 2 End Sub
http://www.lolle.org/images/hmailserver/hmailserver.rar
Code: Select all
"DEBUG" 5952 "2019-05-01 16:15:36.721" "TCP connection started for session 255"
"SMTPD" 5952 255 "2019-05-01 16:15:36.721" "98.25.157.112" "SENT: 220 mydomain.tld"
"SMTPD" 6060 255 "2019-05-01 16:15:37.033" "98.25.157.112" "RECEIVED: EHLO cpe-098-025-157-112.sc.res.rr.com"
"DEBUG" 6060 "2019-05-01 16:15:37.033" "Executing event OnHELO"
"DEBUG" 6060 "2019-05-01 16:15:37.049" "Event completed"
"SMTPD" 6060 255 "2019-05-01 16:15:37.049" "98.25.157.112" "SENT: 453 530 CODE10 Your access to this mail system has been rejected due to the sending MTA's poor reputation. If you believe that this failure is in error, please contact the intended recipient via alternate means."
"DEBUG" 5952 "2019-05-01 16:15:37.236" "The read operation failed. Bytes transferred: 0 Remote IP: 98.25.157.112, Session: 255, Code: 2, Message: End of file"
"DEBUG" 5952 "2019-05-01 16:15:37.236" "Ending session 255"
palinka wrote: ↑2019-05-02 00:28
Is this normal? I'm referring to the "The read operation failed" It happens after every successful OnHELO event. I'm not sure if the event was actually successful or if the bot just gets cut off because it doesn't know how to respond to the 453 message sent back to it.
Code: Select all
"DEBUG" 5952 "2019-05-01 16:15:36.721" "TCP connection started for session 255" "SMTPD" 5952 255 "2019-05-01 16:15:36.721" "98.25.157.112" "SENT: 220 mydomain.tld" "SMTPD" 6060 255 "2019-05-01 16:15:37.033" "98.25.157.112" "RECEIVED: EHLO cpe-098-025-157-112.sc.res.rr.com" "DEBUG" 6060 "2019-05-01 16:15:37.033" "Executing event OnHELO" "DEBUG" 6060 "2019-05-01 16:15:37.049" "Event completed" "SMTPD" 6060 255 "2019-05-01 16:15:37.049" "98.25.157.112" "SENT: 453 530 CODE10 Your access to this mail system has been rejected due to the sending MTA's poor reputation. If you believe that this failure is in error, please contact the intended recipient via alternate means." "DEBUG" 5952 "2019-05-01 16:15:37.236" "The read operation failed. Bytes transferred: 0 Remote IP: 98.25.157.112, Session: 255, Code: 2, Message: End of file" "DEBUG" 5952 "2019-05-01 16:15:37.236" "Ending session 255"
Code: Select all
"DEBUG" 11016 "2019-04-22 00:17:55.600" "Creating session 30"
"TCPIP" 11016 "2019-04-22 00:17:55.600" "TCP - 185.100.87.250 connected to 192.168.1.2:995."
"DEBUG" 11016 "2019-04-22 00:17:55.600" "Executing event OnClientConnect"
"DEBUG" 11016 "2019-04-22 00:17:55.865" "Event completed"
"DEBUG" 11016 "2019-04-22 00:19:56.365" "Ending session 30"
Code: Select all
"DEBUG" 5952 "2019-05-01 19:25:08.266" "Creating session 569"
"TCPIP" 5952 "2019-05-01 19:25:08.266" "TCP - 170.79.73.111 connected to 192.168.1.2:25."
"DEBUG" 5952 "2019-05-01 19:25:08.266" "Executing event OnClientConnect"
"DEBUG" 5952 "2019-05-01 19:25:08.375" "Event completed"
"DEBUG" 5952 "2019-05-01 19:26:09.203" "TCP connection started for session 569"
"SMTPD" 5952 569 "2019-05-01 19:26:09.203" "127.0.0.1" "SENT: 220 mydomain.tld"
"DEBUG" 6424 "2019-05-01 19:26:09.203" "The write operation failed. Bytes transferred: 0 Remote IP: 127.0.0.1, Session: 569, Code: 10054, Message: An existing connection was forcibly closed by the remote host"
"DEBUG" 5952 "2019-05-01 19:26:09.203" "Ending session 569"
Code: Select all
"The write operation failed. Bytes transferred: 0 Remote IP: 127.0.0.1, Session: 569, Code: 10054, Message: An existing connection was forcibly closed by the remote host"
We had a lot of errors like this, but I never figured out why. Where can I adjust that?SorenR wrote: ↑2019-05-02 08:41Are you using the 20 second delay? That would certainly account for most of the "The write operation failed"...
I am a bit worried about this though...
Localhost bailing out on you?Code: Select all
"The write operation failed. Bytes transferred: 0 Remote IP: 127.0.0.1, Session: 569, Code: 10054, Message: An existing connection was forcibly closed by the remote host"
Good catch. Yes, I'm using the 20 second wait, but localhost and lan are exempted. That's actually the first time i saw that issue with localhost.SorenR wrote: ↑2019-05-02 08:41Are you using the 20 second delay? That would certainly account for most of the "The write operation failed"...
I am a bit worried about this though...
Localhost bailing out on you?Code: Select all
"The write operation failed. Bytes transferred: 0 Remote IP: 127.0.0.1, Session: 569, Code: 10054, Message: An existing connection was forcibly closed by the remote host"
Ok, but that doesn't explain why the OnClientConnect event was ignored.Dravion wrote: ↑2019-05-02 11:35A quote from Wikipedia:
In computer science, asynchronous I/O (also non-sequential I/O) is a form of input/output processing that permits other processing to continue before the transmission has finished.
...
Asio is a freely available, open-source, cross-platform C++ library for network programming. It provides developers with a consistent asynchronous I/O model
hMailServer.exe uses ASIO for any SMTP, POP3 and IMAP Connection.
But any VBScript COM API operation is synchronously. If you try to react on a HELO SMTP
Command verb which is handled Asynchronously, you cant react on it reliable in a Synchrnous way
Thats why you get the Error Message:
"The read operation has failed".
I just re-read this to make sure i understand. I think possibly my question is a little muddy.
Sorry for cross posting. I type slow on my phone.Dravion wrote: ↑2019-05-02 12:35
OnClientConnect is nothing what comes from official hMailServer code.
It must been inserted by RdvH.
Bottom line is, before the first SMTP Command token is even processed, ASIO is allready in charge, it even happends before TLS negotation
tooks place or the first Bytes are read from the Socket connections (you can see it yourself in your Error Message "0 Bytes read".
This means, there was no Data from the Client avaiable to process OnClientConnect. It would be helpfull to see on what event OnClientConnect
is fired. If its an SMTP Command verb, its allready to late.
I got it too... It's perfectly normal, I just don't see them in my log as I don't do "debug"palinka wrote: ↑2019-05-02 12:45Sorry for cross posting. I type slow on my phone.Dravion wrote: ↑2019-05-02 12:35
OnClientConnect is nothing what comes from official hMailServer code.
It must been inserted by RdvH.
Bottom line is, before the first SMTP Command token is even processed, ASIO is allready in charge, it even happends before TLS negotation
tooks place or the first Bytes are read from the Socket connections (you can see it yourself in your Error Message "0 Bytes read".
This means, there was no Data from the Client avaiable to process OnClientConnect. It would be helpfull to see on what event OnClientConnect
is fired. If its an SMTP Command verb, its allready to late.![]()
Add soon as i can sit down at my laptop I'll post my eventhandlers.
Are you sure about OnClientConnect? It was definitely working with official hmailserver. It's Soren's script.
Code: Select all
"DEBUG" 2312 "2019-05-02 12:37:29.134" "Creating session 2941"
"SMTPD" 2312 2941 "2019-05-02 12:37:29.134" "185.130.56.208" "SENT: 220 mx.acme.inc ESMTP"
"SMTPD" 2312 2941 "2019-05-02 12:37:50.446" "185.130.56.208" "RECEIVED: EHLO voucherholiday.icu"
"DEBUG" 2312 "2019-05-02 12:37:50.446" "ScriptServer::FireEvent-OnHELO"
"DEBUG" 2312 "2019-05-02 12:37:51.180" "ScriptServer:~FireEvent"
"SMTPD" 2312 2941 "2019-05-02 12:37:51.180" "185.130.56.208" "SENT: 554 Rejected"
"DEBUG" 2928 "2019-05-02 12:37:51.180" "The write operation failed. Remote IP: 185.130.56.208, Session: 2941, Code: 10054, Message: An existing connection was forcibly closed by the remote host"
"DEBUG" 2080 "2019-05-02 12:37:51.180" "The read operation failed. Bytes transferred: 0 Remote IP: 185.130.56.208, Session: 2941, Code: 10054, Message: An existing connection was forcibly closed by the remote host"
"DEBUG" 2080 "2019-05-02 12:37:51.180" "Ending session 2941"
Is this log from a OnHELO event or OnClientConnect event?SorenR wrote: ↑2019-05-02 13:12I got it too... It's perfectly normal, I just don't see them in my log as I don't do "debug"AND... Sub OnClientConnect(oClient) IS default hMailServer!
Code: Select all
"DEBUG" 2312 "2019-05-02 12:37:29.134" "Creating session 2941" "SMTPD" 2312 2941 "2019-05-02 12:37:29.134" "185.130.56.208" "SENT: 220 mx.acme.inc ESMTP" "SMTPD" 2312 2941 "2019-05-02 12:37:50.446" "185.130.56.208" "RECEIVED: EHLO voucherholiday.icu" "DEBUG" 2312 "2019-05-02 12:37:50.446" "ScriptServer::FireEvent-OnHELO" "DEBUG" 2312 "2019-05-02 12:37:51.180" "ScriptServer:~FireEvent" "SMTPD" 2312 2941 "2019-05-02 12:37:51.180" "185.130.56.208" "SENT: 554 Rejected" "DEBUG" 2928 "2019-05-02 12:37:51.180" "The write operation failed. Remote IP: 185.130.56.208, Session: 2941, Code: 10054, Message: An existing connection was forcibly closed by the remote host" "DEBUG" 2080 "2019-05-02 12:37:51.180" "The read operation failed. Bytes transferred: 0 Remote IP: 185.130.56.208, Session: 2941, Code: 10054, Message: An existing connection was forcibly closed by the remote host" "DEBUG" 2080 "2019-05-02 12:37:51.180" "Ending session 2941"
If it is a really nasty BOT they can be really difficult to get rid of. As per RFC the caller has to hang up, you cannot kick them out ... or can youpalinka wrote: ↑2019-05-02 13:27Is this log from a OnHELO event or OnClientConnect event?SorenR wrote: ↑2019-05-02 13:12I got it too... It's perfectly normal, I just don't see them in my log as I don't do "debug"AND... Sub OnClientConnect(oClient) IS default hMailServer!
Code: Select all
"DEBUG" 2312 "2019-05-02 12:37:29.134" "Creating session 2941" "SMTPD" 2312 2941 "2019-05-02 12:37:29.134" "185.130.56.208" "SENT: 220 mx.acme.inc ESMTP" "SMTPD" 2312 2941 "2019-05-02 12:37:50.446" "185.130.56.208" "RECEIVED: EHLO voucherholiday.icu" "DEBUG" 2312 "2019-05-02 12:37:50.446" "ScriptServer::FireEvent-OnHELO" "DEBUG" 2312 "2019-05-02 12:37:51.180" "ScriptServer:~FireEvent" "SMTPD" 2312 2941 "2019-05-02 12:37:51.180" "185.130.56.208" "SENT: 554 Rejected" "DEBUG" 2928 "2019-05-02 12:37:51.180" "The write operation failed. Remote IP: 185.130.56.208, Session: 2941, Code: 10054, Message: An existing connection was forcibly closed by the remote host" "DEBUG" 2080 "2019-05-02 12:37:51.180" "The read operation failed. Bytes transferred: 0 Remote IP: 185.130.56.208, Session: 2941, Code: 10054, Message: An existing connection was forcibly closed by the remote host" "DEBUG" 2080 "2019-05-02 12:37:51.180" "Ending session 2941"
Did you see my example of OnClientConnect log that doesn't disconnect?
Code: Select all
Function Disconnect(strIP)
Const WshRunning = 0
Const WshFinished = 1
Const WshFailed = 2
Dim strOut
Dim oShell : Set oShell = CreateObject("WScript.Shell")
Dim oExec : Set oExec = oShell.Exec("CPorts /close * * " & strIP & " *")
Result.Value = 1
While oExec.Status = WshRunning
Wait(1)
Wend
If oExec.Status = WshFailed Then
strOut = oExec.StdErr.ReadAll
Else
strOut = oExec.StdOut.ReadAll
End If
Set oExec = Nothing
Set oShell = Nothing
End Function
Code: Select all
"DEBUG" 11016 "2019-04-22 00:17:55.600" "Creating session 30"
"TCPIP" 11016 "2019-04-22 00:17:55.600" "TCP - 185.100.87.250 connected to 192.168.1.2:995."
"DEBUG" 11016 "2019-04-22 00:17:55.600" "Executing event OnClientConnect"
"DEBUG" 11016 "2019-04-22 00:17:55.865" "Event completed"
"DEBUG" 11016 "2019-04-22 00:19:56.365" "Ending session 30"
Code: Select all
"DEBUG" 5952 "2019-05-01 19:25:08.266" "Creating session 569"
"TCPIP" 5952 "2019-05-01 19:25:08.266" "TCP - 170.79.73.111 connected to 192.168.1.2:25."
"DEBUG" 5952 "2019-05-01 19:25:08.266" "Executing event OnClientConnect"
"DEBUG" 5952 "2019-05-01 19:25:08.375" "Event completed"
"DEBUG" 5952 "2019-05-01 19:26:09.203" "TCP connection started for session 569"
"SMTPD" 5952 569 "2019-05-01 19:26:09.203" "127.0.0.1" "SENT: 220 mydomain.tld"
"DEBUG" 6424 "2019-05-01 19:26:09.203" "The write operation failed. Bytes transferred: 0 Remote IP: 127.0.0.1, Session: 569, Code: 10054, Message: An existing connection was forcibly closed by the remote host"
"DEBUG" 5952 "2019-05-01 19:26:09.203" "Ending session 569"
I modified your original script to use a different geoip lookup service because it was throwing too many null responses.SorenR wrote: ↑2019-05-02 14:01OnClientConnect only support Result.Value = 1 and it should show as "SENT: 554 Rejected" in your SMTP log.
Using the 20 second delay will mostly result in the "caller" disconnecting if "caller" is not a normal mailserver. BOT's make money, time is money and the 20 second delay will cause them to loose money - thus they disconnect the hard way.
Code: Select all
If Lookup(strBase, oGeoip("countryCode")) Then
Result.Value = 0
EventLog.Write(strPort & " Connection accepted" & Chr(34) & vbTab & oClient.IPAddress & vbTab & Chr(34) & oGeoip("countryCode") & Chr(34) & vbTab & Chr(34) & oGeoip("country") & Chr(34))
Exit Sub
Else
Result.Value = 1
EventLog.Write(strPort & " Connection REJECTED" & Chr(34) & vbTab & oClient.IPAddress & vbTab & Chr(34) & oGeoip("countryCode") & Chr(34) & vbTab & Chr(34) & oGeoip("country") & Chr(34))
End If
Oh man... That was sooooo long ago... Anyways, it does not make sense to do "Exit Sub" on "Result.Value = 0", it would make more sense to do "Exit Sub" on "Result.Value = 1" ... BECAUSE:palinka wrote: ↑2019-05-02 14:16I modified your original script to use a different geoip lookup service because it was throwing too many null responses.SorenR wrote: ↑2019-05-02 14:01OnClientConnect only support Result.Value = 1 and it should show as "SENT: 554 Rejected" in your SMTP log.
Using the 20 second delay will mostly result in the "caller" disconnecting if "caller" is not a normal mailserver. BOT's make money, time is money and the 20 second delay will cause them to loose money - thus they disconnect the hard way.
OnClientConnectCode: Select all
If Lookup(strBase, oGeoip("countryCode")) Then Result.Value = 0 EventLog.Write(strPort & " Connection accepted" & Chr(34) & vbTab & oClient.IPAddress & vbTab & Chr(34) & oGeoip("countryCode") & Chr(34) & vbTab & Chr(34) & oGeoip("country") & Chr(34)) Exit Sub Else Result.Value = 1 EventLog.Write(strPort & " Connection REJECTED" & Chr(34) & vbTab & oClient.IPAddress & vbTab & Chr(34) & oGeoip("countryCode") & Chr(34) & vbTab & Chr(34) & oGeoip("country") & Chr(34)) End If
Code: Select all
strBase = "^(US|CA|GB|BE|DK|FR|GR|GL|IS|IE|IT|LI|NO|PL|PT|RO|SK|SI|ES|SE)$"
Code: Select all
strBase = "^(US)$|^(HU)$"
If Lookup(strBase, oGeoip("countryCode")) Then
EventLog.Write(strPort & " Connection accepted" & Chr(34) & vbTab & oClient.IPAddress & vbTab & Chr(34) & oGeoip("countryCode") & Chr(34) & vbTab & Chr(34) & oGeoip("country") & Chr(34))
Exit Sub
End If
Result.Value = 1
EventLog.Write(strPort & " Connection REJECTED" & Chr(34) & vbTab & oClient.IPAddress & vbTab & Chr(34) & oGeoip("countryCode") & Chr(34) & vbTab & Chr(34) & oGeoip("country") & Chr(34))
End Sub
Yup ... and ... "^(US|HU)$" = "^(US)$|^(HU)$"palinka wrote: ↑2019-05-02 15:44oy vey! Sorry for hijacking the thread with my poor scripting!But that explains everything.
So It should be like this instead? If connection from "good" country, go ahead and process; if from "bad" country, disconnect. I reversed your script for reasons I wrote in the other thread.
Code: Select all
strBase = "^(US)$|^(HU)$" If Lookup(strBase, oGeoip("countryCode")) Then EventLog.Write(strPort & " Connection accepted" & Chr(34) & vbTab & oClient.IPAddress & vbTab & Chr(34) & oGeoip("countryCode") & Chr(34) & vbTab & Chr(34) & oGeoip("country") & Chr(34)) Exit Sub End If Result.Value = 1 EventLog.Write(strPort & " Connection REJECTED" & Chr(34) & vbTab & oClient.IPAddress & vbTab & Chr(34) & oGeoip("countryCode") & Chr(34) & vbTab & Chr(34) & oGeoip("country") & Chr(34)) End Sub
Searched logs back to 2011... Aparently it only says so when debug logging is enabled.
So conclusion? You f***ked up your scripting, and still you need to rollback to the official build? That doesn't make sense
RvdH wrote: ↑2019-05-03 11:03So conclusion? You f***ked up your scripting, and still you need to rollback to the official build? That doesn't make sense![]()
![]()
Nothing is changed in OnClientConnect so I refuse to believe that any of my custom builds here causes the behavior 'only' you seem to have issues with