hMailServer X

Use this forum if you want to discuss a problem or ask a question related to a hMailServer beta release.
User avatar
Dravion
Senior user
Senior user
Posts: 2060
Joined: 2015-09-26 11:50
Location: Germany
Contact:

hMailServer X

Post by Dravion » 2023-09-21 22:31

A little update on my work on hMailServer from my side.

As many of you know, it was always my plan to bring hMailServer to Linux but also other Platforms like Mac.

But the work is extremely hard Martin really wrote tons of good code.
So, you can imagine it's extremely difficult to change something so big and tightly bundled to the Windows Platform to make
it work on other Platforms, but there is some progress.

Status quo:
-Removal of the Windows Script Host System(VB/JS-Script) - succesful
-Removal of Microsoft COM/DCOM/OLE/ATL/ActiveX - succesful
-Removal of enforced admin permissions (for running the Server and for Visual Studio) - succesful
-Removing all possible NON C++ 2014 Standard Includes and binary libraries - succesful
-Rewrite of some parts of the functions regarding date formatting and utils - succesful
-Removal of the Windows Registry code for determining the current bin folder - succesful
-hMailServer X now can be started with it's own hMailServer.INI file - succesful
-All include are now ../ instead of sometimes .\ (Windows only)
-A basic TLSv1.3 TCP port access now works to access a hMailServer X instance to list for example Domains

**Regarding independent configs in X:
Any running hMailServer.exe has now it's own config file (hMailServer.INI)
This means, you can run this specific hMailServer version side by side without interference
with other hMailServer versions, even if you run the current stable/production version, X
doesn't need COM/DCOM/Registry etc. anymore.

Screenshots:

Startup:
hms_x_startup.png
hms_x_startup.png (77.62 KiB) Viewed 20422 times
New TLSv1.3 Admin protocol first look
tls_v1.3-access.png
tls_v1.3-access.png (28.58 KiB) Viewed 20422 times
The commands:

Right now you can connect with the openssl.exe utility (openssl v.1.1.x or higher)
Supported commands right now:
get_domains() - list all domains via the new API (work in progress)
get_startup_time - get the timestamp as hMailServer.exe was started.

Summary:
There is a lot todo but if you want to help, feel free to clone/fork the repo and do so
https://github.com/Dravion/hMailServerX

Hint:
Under Releases you can find a zipped C:\hMailServer folder, just unpack and run hMailServer
by Open a Windows command prompt (doesn't need to be as Admin) and cd to C:\hMailServer\Bin
and type in hMailserver.exe --setinifile=C:/hMailServer/Bin/hMailServer.INI

Hint 2:
A pre-prepared hMailServer PostgreSQL DB has to be setup to make hMailServer X run.
1) Install PostgreSQL (10 or higher)
2) import the hmailpg.sql script to create the required database.
Attachments
hmailpg.zip
(12.68 KiB) Downloaded 127 times

palinka
Senior user
Senior user
Posts: 4359
Joined: 2017-09-12 17:57

Re: hMailServer X

Post by palinka » 2023-09-22 12:23

Looks like you're making good progress. I hope this project is able to come to completion. Good work!

User avatar
Dravion
Senior user
Senior user
Posts: 2060
Joined: 2015-09-26 11:50
Location: Germany
Contact:

Re: hMailServer X

Post by Dravion » 2023-09-22 12:53

Thx.
Yes, its a lot of work. There are 3 areas left i have to figure out.

The StdString.h file is third party code which is 21 yrs old and used by hMailServer internally all over the place and i have to think about it how o get rid of it or re-write it in a way it works with C++ 2014 and C99 compliance.

The same goes for XMLite.cpp and XMLite.h
This is also used for all sorts of Configuration stuff like
Antispam settings and parsing. If you remove it you get a dozen of Syntax errors.

The last thing is WinDNS.h.
hMailServer uses the internal Windows DNS-Resolver API
which is Microsoft/Windows only. Right now i evaluate a small open source c library called "c-ares" which compiles fine and can do all the dns lookups we might need (mx records, a records etc).

This 3. subjects need to be adressed before i can try to built hMailServer on Linux.

User avatar
Dravion
Senior user
Senior user
Posts: 2060
Joined: 2015-09-26 11:50
Location: Germany
Contact:

Re: hMailServer X

Post by Dravion » 2023-09-22 17:46

A few example's to show how to access the new API via TCP/IP with sockets

Code: Select all


// A C programm 
hmsx_api_call_via_gcc.c (GCC C/C++ and CLANG) Linux and MacOS (OpenSSL v1 or v3 required)

// A MSVC C Program
hmsx_api_call_via_msvc.c (MSVC) (tested with MS-Visual Studio 2022) (OpenSSL v1 or v3 required)

// A Java program (tested with ORACLE JDK 21)
https://github.com/Dravion/hMailServerX/blob/main/Examples/hmsx_api_call_via_java.java

// A Perl script
hmsx_api_call_via_perl.pl

// A Python script
hmsx_api_call_via_python.py

// A PHP script
hmsx_api_call_via_php.php

// OpenSSL binary utility
openssl s_client -connect localhost:9999
now you can type in some commands like for example: "get_domains()".

https://github.com/Dravion/hMailServerX ... n/Examples

User avatar
Dravion
Senior user
Senior user
Posts: 2060
Joined: 2015-09-26 11:50
Location: Germany
Contact:

Re: hMailServer X

Post by Dravion » 2023-09-23 23:50

Added VBScript, C# and VB.NET Example code.

This is possible by using the hmailxcom.dll hMailSever X COM Client API DLL

Usage: regsvr32 hmailxcom.dll (Windows command prompt with admin permissions)

That way, a VBScript can call a hMailServer X Remote instance using this code:

Code: Select all

' Connect to hMailServer X instance via VBScript
' run it by typing: "cscript vbtest.vbs"
Dim obj
Set obj = CreateObject("hmailxcomLib.clientapi")
obj.sayhello
Set obj = Nothing
hmailxcom_vbs.png
hmailxcom_vbs.png (32.66 KiB) Viewed 20341 times
Result in this case is:[/b]

Updated examples:
https://github.com/Dravion/hMailServerX ... n/Examples

hmailxcom project:
https://github.com/Dravion/hmailxcom

User avatar
Dravion
Senior user
Senior user
Posts: 2060
Joined: 2015-09-26 11:50
Location: Germany
Contact:

Re: hMailServer X

Post by Dravion » 2023-10-05 15:54


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

Re: hMailServer X

Post by mattg » 2023-10-06 02:27

I really think you should change the name to one that doesn't include the word hmailserver
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
Dravion
Senior user
Senior user
Posts: 2060
Joined: 2015-09-26 11:50
Location: Germany
Contact:

Re: hMailServer X

Post by Dravion » 2023-10-06 10:15

mattg wrote:
2023-10-06 02:27
I really think you should change the name to one that doesn't include the word hmailserver
Why?

I named it the hMailServer X Portable

Main focus is:
*Make hMailServer run on Windows/Linux/Unix/MacOS and maybe other Systems (time will show)
*Make hMailServer even more known in the Open Source World to attract more Developers and Contributer's
*Preserve hMailServers known features and replace/substitute features which only works on Windows
*Ease of use. The Setup process gets streamlined and it gets a new GUI which will look almost like hMailAdmin
*Open Development - Everybody is encouraged to fork, enhance, file bugs, help others etc.
*All Copyright holders and Contributer's will be mentioned if not other wise requested

Basicly the code gets an overhaul and COM/DCOM VBScript gets replaced by other Open Source components
like the LUA Scripting Language instead of VBScript which is IMHO as easy to understand as VBScript.
Even the Database Structure and hMailServer.INI File Format will stay the same.

However:
If Martin explicitly says he don't like the Name "hMailServer X - Portable", then i consider a differen't name, if not i will stay that way.

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

Re: hMailServer X

Post by mattg » 2023-10-08 23:32

Dravion wrote:
2023-10-06 10:15
mattg wrote:
2023-10-06 02:27
I really think you should change the name to one that doesn't include the word hmailserver
Why?
Because others may see this as an official offshoot.

I really don't understand why you insist on calling your stuff with 'hmailserver' in the name, it just confuses the shit out of anyone trying to use it, and then those of us trying to (unknowingly) support it.

My question back to you is WHY NOT?
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
Dravion
Senior user
Senior user
Posts: 2060
Joined: 2015-09-26 11:50
Location: Germany
Contact:

Re: hMailServer X

Post by Dravion » 2023-10-08 23:51

I think i made my point clear.

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

Re: hMailServer X

Post by mattg » 2023-10-09 00:21

And yet, obviously, I didn't make my point clear

Is your insistence in using hMailserver in the name around trying to validate your work, to somehow obtain some reputation points by linked to hmailserver?

I can think of no other reason as why you WON'T stop using hMailserver in the name of your work.

Look at Heidi DB, or Maria DB
Both offshoots of MySQL community edition.
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
Dravion
Senior user
Senior user
Posts: 2060
Joined: 2015-09-26 11:50
Location: Germany
Contact:

Re: hMailServer X

Post by Dravion » 2023-10-09 11:55

mattg wrote:
2023-10-09 00:21
Look at Heidi DB, or Maria DB
Both offshoots of MySQL community edition.
Wrong.
MariaDB Project name was chosen bc MySQL is a registered Trademark of ORACLE Cooperation
and former MySQL Developers didn't like ORACLE's commercial course and wanted to stay OpenSource,
so it was named after the second Daughter of Michael Widenius, the Orginal Author of MySQL

HeidiSQL on the other Hand is not a Database or a clone of MySQL, it's a Client Software package to
edit Tables in a MySQL which isn't exclusive to MySQL (it supports Postgres and MS-SQL as well).

My Project name is what it says:
Making the existing hMailServer portable, so it runs in Linux/MacOS/Windows.

It's actually not that hard to understand ..

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

Re: hMailServer X

Post by jimimaseye » 2023-10-09 12:50

I have to say I am on the side of thinking it should be named differently.

HMailserver is specifically a package of source code:

Is an SMTP mailserver
written for and running on Windows
provide a GUI Admin interface
Provides ComAPI connectivity
allows VBS scripting for tailoring.


The 'unix portable version being provided here (unless Im worng - feel free to connect these statements):

is an SMTP mailserver
Doesnt run on Windows
Deosnt give a GUI admin interface
Doesnt provides ComAPI connectivity
Doesnt allow VBS scripting for tailoring.

That just leaves its similarity as being an SMTP server (albeit on the similar code base) but then all other SMTP servers are also 'just SMTP servers'. And therefore this makes it "an SMTP mail server (that runs on other platforms)" with no obvious similarity to Hmailserver.

The danger, when Matt says "it just confuses the shit out of anyone trying to use it, and then those of us trying to (unknowingly) support it." is that someone may well try to install and use it and then refer to THIS forum for help. And when we ask them "are you using "Hmailserver?" they answer "yes". At which point we fumble around until we relaise we cant help becuase:

a, they are running on Linux
b, they cant do VBS scripting
c, they cant 'point and click' where we expect them to be able to point and click
d, possibly they are without other 'features' or fixes that have since been provided in the Windows version (either official or by RvdH fork) that are not present in this version.

There is an opportunity here, Dravion, for you to take the credit and plaudits for your work and call it something unique and recognisable to you (for example," DravmailServer"). I dont undestand, after you have made such an effort doing the conversion, why you shouldnt. Not doing so will result in a whole load of confusion for people (both users and forum volunteers).
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
Dravion
Senior user
Senior user
Posts: 2060
Joined: 2015-09-26 11:50
Location: Germany
Contact:

Re: hMailServer X

Post by Dravion » 2023-10-09 22:47

jimimaseye wrote:
2023-10-09 12:50
I have to say I am on the side of thinking it should be named differently.

HMailserver is specifically a package of source code:

Is an SMTP mailserver
written for and running on Windows
provide a GUI Admin interface
Provides ComAPI connectivity
allows VBS scripting for tailoring.
Yes, but (as you know) it does even more like POP3/IMAP and Relaying, Transport layer Security SSL/TLS (via OpenSSL)
and ASIO which means it bundles and handles many many connections to the Server extremely well.
jimimaseye wrote: The 'unix portable version being provided here (unless Im worng - feel free to connect these statements):
Not at all :D

Portable (in this specific case) means that hMailServer's existing code will be modified in a way so it is more C/C++ Standard compliant, so it can be build and run on more then just Windows

How?

Standard compliant C/C++ code can be build and run on more then just Windows Systems.
But in order to do so, hMailServer's code must be cleaned up so it doesn't invoke Windows specific features (for example like COM/DCOM or
for example the Windows Registry) which simply doesn't exists on other Platforms.
jimimaseye wrote: is an SMTP mailserver
Doesnt run on Windows
Deosnt give a GUI admin interface
No.
This will be the same. But the new hMailAdmin program will run on more then just Windows but it will pretty much look the
same as the hMailAdmin program you know for years.

But this is true:
Doesnt provides ComAPI connectivity
Doesnt allow VBS scripting for tailoring.
Instead of a ComAPI we will have a TCP/IP TLSv1.3 secured Remote API which can be accessed by VBScript.

The only thing which will not work anymore is internal VB/JS Scripting. VBScript depends on the Microsoft COM/DCOM-System
and cannot work without it. So it needs to be replaced by a another Internal scripting language which is easy to learn, small and compact.
I think LUA fit's the bill perfectly. It's tiny, well documented and battle proven for internal scripting tasks and is well supported now and
in the future. VBScript on the other hand is very old and outdated and has no active development for years anymore.

However: If you wish you can further use VBScript via the new TCP/IP TLSv1.3 secured Remote API and it works like this:

Calling hMail X via VBScript

Code: Select all

Dim obj
Set obj = CreateObject("hmailxcomLib.clientapi")
obj.sayhello
Set obj = Nothing
This function call return a a List of Domains via the TCP/IP TLSv1.3 secured Remote protocol of hMailServer X portable (this already works) as you can see. This hMailServer X portable version has no COM/DCOM code anymore it it and as you can see, it works good without it.
hmailxcom_vbs.png
hmailxcom_vbs.png (32.66 KiB) Viewed 20020 times
Here is a bunch of examples how other Scripting/Programming languages like PHP or Python or Perl can query a hMailServer X portable Remote instance via TCP/IP.

New TCP/IP Remote API TLSv1.3 Scripting examples:
https://github.com/hMailServer-X/hmsx/t ... n/Examples
That just leaves its similarity as being an SMTP server (albeit on the similar code base) but then all other SMTP servers are also 'just SMTP servers'. And therefore this makes it "an SMTP mail server (that runs on other platforms)" with no obvious similarity to Hmailserver.
No.
The main advantage of hMailServer that it is compact intuitive.
It's true, there are powerful SMTP and POP3/IMAP Server Solution on Linux/Unix/MacOS like Postfix/Exim/Sendmail which are not available for Windows. But other then hMailServer they are far away from intuitive or easy to setup (you have a bunch of complex config files you have to
modify to make Postfix or Exim work - there is no easy built-in GUI Admin tool like hMailServer's hMailAdmin GUI).

In the end we will have hMailServer running on all important platforms, using the same code base.
The danger, when Matt says "it just confuses the shit out of anyone trying to use it, and then those of us trying to (unknowingly) support it." is that someone may well try to install and use it and then refer to THIS forum for help. And when we ask them "are you using "Hmailserver?" they answer "yes". At which point we fumble around until we relaise we cant help becuase:
Idk if people should seek help in the Developer's section of the forum.

However. As you know, hMailServer's official Development has halted. If we want new stuff we have to integrate it our self's.

Make it run on Linux was a frequent Feature request over the last years or having a Secure TCP/IP based Remote admin protocol or
having a simplified SSL-Certificate generation or Letsencrypt integration or a Per-domain SMTP host name etc. This can be done way
better if we use modern tools and more recent C/C++ Language standards in hMailServers code base.

My goal is to develop hMailServer to the next level, not splitting it or creating a new product or project.
The code will be OpenSource and open to everyone and hopefully attracts more active Developers from the Linux Open Source side.
bc. most Open Source Developers are at home on Linux.

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

Re: hMailServer X

Post by mattg » 2023-10-09 23:22

Dravion wrote:
2023-10-09 22:47
My goal is to develop hMailServer to the next level, not splitting it or creating a new product or project.
The code will be OpenSource and open to everyone and hopefully attracts more active Developers from the Linux Open Source side.
bc. most Open Source Developers are at home on Linux.
Your REFUSAL to change name to something else speaks volumes about you.

This is not about the product at all.

CHANGE THE NAME OF YOUR PRODUCT
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
Dravion
Senior user
Senior user
Posts: 2060
Joined: 2015-09-26 11:50
Location: Germany
Contact:

Re: hMailServer X

Post by Dravion » 2023-10-10 07:09

mattg wrote:
2023-10-09 23:22
Dravion wrote:
2023-10-09 22:47
My goal is to develop hMailServer to the next level, not splitting it or creating a new product or project.
The code will be OpenSource and open to everyone and hopefully attracts more active Developers from the Linux Open Source side.
bc. most Open Source Developers are at home on Linux.
Your REFUSAL to change name to something else speaks volumes about you.

This is not about the product at all.

CHANGE THE NAME OF YOUR PRODUCT
Yeah and for me your comments speaks volumes about you.

If you have a better idea to develop hMailServer any further, let me know.

User avatar
katip
Senior user
Senior user
Posts: 1115
Joined: 2006-12-22 07:58
Location: Istanbul

Re: hMailServer X

Post by katip » 2023-10-10 10:25

IMO change it to dMailServer, believe me it will attract more (better) attention.
if i'm not mistakening, h comes from Halvar which is somehow related personally to Martin (his company?).
Katip
--
HMS 5.7, MariaDB 10.4.10, SA 4.0.0, ClamAV 0.103.8

User avatar
Dravion
Senior user
Senior user
Posts: 2060
Joined: 2015-09-26 11:50
Location: Germany
Contact:

Re: hMailServer X

Post by Dravion » 2023-10-10 14:09

katip wrote:
2023-10-10 10:25
IMO change it to dMailServer, believe me it will attract more (better) attention.
if i'm not mistakening, h comes from Halvar which is somehow related personally to Martin (his company?).
@katip

What is wrong with developing hMailServer further?

What i do is to remove old legacy code which cannot run on other Platforms then Windows and replace it with code that works on all platforms
and not just Windows. 80% of the Remaining codebase is the same, it does the same stuff, it makes the same things.

If i really wanted to do a complete new Mailserver Project (and maybe this will happen in the future, trust me it will not be based in
any shape or form of hMailServers code or Postfix, or Exim or Sendmail or what ever already exists. I would chose a clean new design.

For me it's also a little bit of a challenge. I really want to know if it is possible to fully port hMailServer to a new platform.

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

Re: hMailServer X

Post by SorenR » 2023-10-10 14:19

hMailServer X = hMailServer Portable ... ?
SørenR.

To understand recursion, you must first understand recursion.

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

Re: hMailServer X

Post by SorenR » 2023-10-10 23:19

LUAScript for WSF anyone?? Yes, I know it is old but it should support COM ...

https://na-s.jp/LuaScript/
SørenR.

To understand recursion, you must first understand recursion.

palinka
Senior user
Senior user
Posts: 4359
Joined: 2017-09-12 17:57

Re: hMailServer X

Post by palinka » 2023-10-10 23:33

I don't understand what the uproar over COM is. If COM were removed and replaced by an http json interface or whatever using the same schema, would anyone even notice?

Also, I would prefer powershell as the scripting interface. Its cross platform too. And I wouldn't have to learn another scripting language. :mrgreen:

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

Re: hMailServer X

Post by mattg » 2023-10-11 00:51

Dravion wrote:
2023-10-10 07:09
If you have a better idea to develop hMailServer any further, let me know.
Dravion wrote:
2023-10-10 14:09
What is wrong with developing hMailServer further?
As usual, you've completely misread what is going on.

I don't have any better ideas, and as I've always said I'm happy to support what you do. That hasn't changed (yet).
You can develop hMailserver, but seriously you are creating a NEW competitor product (for linux), and using the good name that hMailserver has to do that.

Is the fact that you won't change the name based on the concept that you don't think you couldn't get enough support without the name 'hamilserver' included?
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
Dravion
Senior user
Senior user
Posts: 2060
Joined: 2015-09-26 11:50
Location: Germany
Contact:

Re: hMailServer X

Post by Dravion » 2023-10-11 02:01

@Soren
Your link is a little dated. LUA 3.x is very old.
Current version is v 5.4.x or higher.

@Palinka
You can use Powershell with hMailServer X by using the new COM client library "hmsxlib.dll". It provides a remote interface for any Scripting language which can understand Microsoft COM/DCOM. After executing "regsvr32 hmsxlib.dll" You can access it with VBScript or Powershell.or what ever can interact with COM/DCOM

But keep in mind: hmsxlib.dll is a COM convenient Library to make it easy for Windows Scipting lovers to connect with a hMailServer X Remote Admin server on port 9999. It abstracts all the complex TCP ip stuff so you can focus on your Powershell or VBScrpts instead.

@palinka
The remote Admin server is not based on JSON or REST or HTTPS. Instead its a encrypted TCP port which listens on port 9999 on all network ip addresses (in future versions you can restrict it to specific IPs) of your network card after hmailserverx.exe has started.

So basicly you can connect to port 9999 with anything which speaks SSL/TLS (TLSv1.3 protocol is mandatory TLSv1.1 or TLSv1.2 for example will fail).

If the connection was established you can then type in command verbs like for example "get_domains()" which will give you back all the Domains.

Its pretty analog to telnet. If you try to telnet to port 25.
A SMTP Server would typically respond with:
Welcome to blah blah and then expects you to type in HELO or EHLO and and then you can do other commands.
The admin server on port 9999 does pretty much the same but ofc with other commands then SMTP commands like HELO or EHLO.

There are a few examples for python, perl, php, java or powershell on github to show how a simple connect to the Admin server on port 9999 can be done.
See: https://github.com/hMailServer-X/hmsx/t ... n/Examples

To LUA. The cool thing about it is, it has it own scripting sandbox which can be fully integrated in hMailServer X , so it is a awesome replacement for internal VBScripting to do for example stuff like OnSubHelo.

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

Re: hMailServer X

Post by SorenR » 2023-10-11 15:42

Dravion wrote:
2023-10-11 02:01
@Soren
Your link is a little dated. LUA 3.x is very old.
Current version is v 5.4.x or higher.
The LUA binaries in the source appear to be 5.1, both x86 and x64.
SørenR.

To understand recursion, you must first understand recursion.

User avatar
Paulo Meireles
Normal user
Normal user
Posts: 86
Joined: 2005-04-16 13:09
Location: Lisbon - Portugal

Re: hMailServer X

Post by Paulo Meireles » 2023-10-16 18:39

Guys, may I invite you all for a (virtual) cold beer, hoping it will lower the testosterone level? :)

None of us can have what we all would prefer: hMailServer to be still supported and further enhanced by Martin, as Martin has made clear that he no longer has the time or energy for this. It still is, nonetheless, his "baby", and despite it being open source and free software, I wouldn't just fork it in a new direction without first asking Martin if he's OK with it, and if the name can be kept when it changes to this new direction. Think about what Apple did to System 7 went then went from Motorolla CPUs to PowerPC, or what Microsoft did to Windows when they deprecated Windows 95/98/Me and replaced it with Windows NT/2000/XP. Apple changed the OS name, Microsoft did not - it's still Windows, with some new things, and without some old ones.

Dravion is, as far as I know, the only one that has rolled up his sleeves and actually did something to try to keep the product afloat - not in its current form, but in one that will (in my opinion) maximise its lifespan, by allowing it to run in more platforms. The name issue comes down to be a question of legitimacy: if the changes that Dravion is proposing had come from Martin, I'm sure none of us would bat an eye. So, I suggest we ask Martin what he thinks of those changes, and if they "have his blessing" - in the sense that the resulting product will not be a new product, but a new generation of the same product, and as such being allowed to keep the original name. hMailServer being dead, what do you want to keep it for? A tombstone?

Personally, I would absolutely love hMailServer to turn into Thunderbird Server - similar to what is happening with the k9 email client for Android. However, that can only happen if we have a clean, portable and maintainable codebase. Even if it doesn't happen, I would love to have hMailServer evolve into something I can run for the next 20 or 30 years, instead of having to migrate to another product. And I'd love us to focus on how to make this possible by supporting whoever is willing to roll up their sleeves... Can we?

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

Re: hMailServer X

Post by mattg » 2023-10-18 01:03

Paulo Meireles wrote:
2023-10-16 18:39
I wouldn't just fork it in a new direction without first asking Martin if he's OK with it, and if the name can be kept when it changes to this new direction.
I agree.
viewtopic.php?f=10&t=33837&p=213921&hil ... on#p213925
Paulo Meireles wrote:
2023-10-16 18:39
Dravion is, as far as I know, the only one that has rolled up his sleeves and actually did something to try to keep the product afloat
Not an accurate statement, not even close.
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
Dravion
Senior user
Senior user
Posts: 2060
Joined: 2015-09-26 11:50
Location: Germany
Contact:

Re: hMailServer X

Post by Dravion » 2023-10-18 04:12

Thanks for your encouraging words Pauolo :)

User avatar
Paulo Meireles
Normal user
Normal user
Posts: 86
Joined: 2005-04-16 13:09
Location: Lisbon - Portugal

Re: hMailServer X

Post by Paulo Meireles » 2023-10-18 12:25

mattg wrote:
2023-10-18 01:03
Paulo Meireles wrote:
2023-10-16 18:39
Dravion is, as far as I know, the only one that has rolled up his sleeves and actually did something to try to keep the product afloat
Not an accurate statement, not even close.
You're right, and it was unfair from my part, so let me rephrase and clarify what I meant. hMailServer is dead/orphaned at the moment, as I don't see anyone taking Martin's place and going forward with in in an evolutionary way. Some are still stying to "keep it afloat", by providing small patches; I don't, however, see much of a future in there, and its demise seems inevitable if something more substantial is not done. Dravion is the only one that, as far as I know, took it in a new direction - not just an evolution, but somewhat of a revolution that offers some possibility of it "coming back from the dead", even if, because the result feels alien to some, they see it as if hMailServer was thrown through "Pet Sematary"...

Martin seems to be done with hMailServer, and I bet he's more than willing to pass the wheel to someone else who does not just kill the product. We do not, however, want Dravion to be the next Martin, and burn out after a few years and let hMailServer be orphan again. This should not be a "one-man-show", but the result of team work instead. Otherwise, I don't see much future in it either.

hMailServer, despite being a great product, is built upon some dated technology. The price to port hMailServer to Linux (or anything else) is to drop Windows-specific components. Are we really that attached to these, especially when Microsoft is dropping some? What good would hMailServer be if we lo longer could run in on a modern Windows machine because it lacks these very technologies that hMailServer needs?

hMailServer is easy to set up, rock solid, full of features, has a very small footprint, and is easily integrated with other solutions. If we made it run on Windows it might actually turn into a much more widely adopted product - and that would be, in my opinion, the best scenario for all of us. If, however, some others are willing to take it in a different direction, now would be the moment for it to be known, and the community to discuss which path or paths to take, eventually reach some compromise, and then get behind whoever is willing to make it happen.

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

Re: hMailServer X

Post by jimimaseye » 2023-10-18 14:21

I still will always question the implications of this statement:
The price to port hMailServer to Linux (or anything else) is to drop Windows-specific components. Are we really that attached to these, especially when Microsoft is dropping some? What good would hMailServer be if we lo longer could run in on a modern Windows machine because it lacks these very technologies that hMailServer needs?
Hmailserver is a windows mailserver. It's even written on the home page of the product's website:
Welcome

hMailServer is a free, open source, e-mail server for Microsoft Windows. It's used by Internet service providers, companies, governments, schools and enthusiasts in all parts of the world.

Why are people hell bent on insisting it is "ported to linux"?! There are already products for Linux. This product was created because there was NOT (a similar) for windows. Windows isnt going away and it will still be missing a mailserver that currently hmailserver fills the hole of.

Sure, MAYBE a recode is in order to keep in touch with modern-day windows codebase or architecture (like .Net) but it certainly doesnt need to be for Linux as doing so would result in it not being hMailserver.
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
Dravion
Senior user
Senior user
Posts: 2060
Joined: 2015-09-26 11:50
Location: Germany
Contact:

Re: hMailServer X

Post by Dravion » 2023-10-18 14:27

Quote from Martin
by martin » 20 Jan 2006, 17:33

I wouldn't say it's a blank empty project to rewrite.. Around 80% of the server code should work directly on linux with only minor adjustments. Code that does TCP/IP communication, threading, and hMailServer administrator would have to be rewritten from scratch though.
And now guess what hMailServer X is all about...

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

Re: hMailServer X

Post by jimimaseye » 2023-10-18 15:56

Dravion wrote:
2023-10-18 14:27
Quote from Martin
by martin » 20 Jan 2006, 17:33

I wouldn't say it's a blank empty project to rewrite.. Around 80% of the server code should work directly on linux with only minor adjustments. Code that does TCP/IP communication, threading, and hMailServer administrator would have to be rewritten from scratch though.
And now guess what hMailServer X is all about...
And....?

What is the relevance of that? Because if it was in response to my prior post it is totally irrelevant.

A man designs a wheel barrow. The designer says "the majority of the metal work and the inclusion of its single wheel would fit all purposes but you would have to change the bodywork shape, add 3 more wheels and figure out how to power it with an engine and then it would suit to be a car". You wouldn't still then call it a wheel barrow - it would then be a car that can also carry stuff like a wheel barrow. The same way as hMailserver wouldnt be a 'Mailserver For Windows' if you changed some of it and ported it to run on Linux.

Martins quote is about what would need to be done (in 2006!) - its not an approval for doing it.
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
Dravion
Senior user
Senior user
Posts: 2060
Joined: 2015-09-26 11:50
Location: Germany
Contact:

Re: hMailServer X

Post by Dravion » 2023-10-18 16:17

jimimaseye wrote:
2023-10-18 15:56
Dravion wrote:
2023-10-18 14:27
Quote from Martin
by martin » 20 Jan 2006, 17:33

I wouldn't say it's a blank empty project to rewrite.. Around 80% of the server code should work directly on linux with only minor adjustments. Code that does TCP/IP communication, threading, and hMailServer administrator would have to be rewritten from scratch though.
And now guess what hMailServer X is all about...
And....?

What is the relevance of that? Because if it was in response to my prior post it is totally irrelevant.

A man designs a wheel barrow. The designer says "the majority of the metal work and the inclusion of its single wheel would fit all purposes but you would have to change the bodywork shape, add 3 more wheels and figure out how to power it with an engine and then it would suit to be a car". You wouldn't still then call it a wheel barrow - it would then be a car that can also carry stuff like a wheel barrow. The same way as hMailserver wouldnt be a 'Mailserver For Windows' if you changed some of it and ported it to run on Linux.

Martins quote is about what would need to be done (in 2006!) - its not an approval for doing it.

As you know, Martin decided to implement the hMailServer Core System in C/C++.
C/C++ has it 's origins not on Windows but on Unix/Linux long before Windows even existed, even long before DOS existed. C/C++ are from the ground up designed to run code independent of it's underlying Operating system platform, if you implement your Software according to the official
C/C++ Language Standards. This is exactly why Martin stated in 2006 that around 80% of hMailServers code will run on Linux bc this portion of
hMailServers C/C++ is already Language compliant. It's a bit of work but it's possible to close the gap and we lose nothing else then VBScript,
but regarding hMailServer VBScript future, it's also doomed if you do nothing, as you can see here.

VBScript deprecation investigation results
viewtopic.php?f=10&p=249817#p249817

palinka
Senior user
Senior user
Posts: 4359
Joined: 2017-09-12 17:57

Re: hMailServer X

Post by palinka » 2023-10-18 17:03

Its certainly doomed if no one does anything.

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

Re: hMailServer X

Post by jimimaseye » 2023-10-18 17:08

For the record, MY comment is purely based on (re)writing to be Liniux compatible and still calling it 'hMailserver'. I said (above) that there is need for rewriting to ensure its functionailty on the Windows Platform which is what hMailserver is designed for.
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
Dravion
Senior user
Senior user
Posts: 2060
Joined: 2015-09-26 11:50
Location: Germany
Contact:

Re: hMailServer X

Post by Dravion » 2023-10-18 18:14

I think we are basicly on the same page.
It's not my intention to favor hMailServer Linux over hMailServer on Windows.

The most powerful feature of hMailServer is it's simplicity and intuitive User interface and i will do anything in my power to preserve it in hmsx, so the ordinary User of hMailServer should not have big problem using it. Maybe we can even simplify a few things even more we learned over the years.

The next thing is Scripting. We cannot forever continue with VBScript so we need a reasonable replacement which is
1) Easy to integrate into the server
2) Easy to learn for VBScript users
3) Behave the same way on all platfroms
4) Not getting abandoned, deprecated or removed

For all i know and found out, LUA is the best candidate which fits all 4) points. It's not that i have special feelings for LUA it's just the last amount of work and it fits the bill best IMHO.

Some maybe favor Powershell, python or php but its harder to integrate it inside the server itself. But as far as API Scripting goes, you can basicly use any scripting language you like, there isn't any form of restriction.

The last point is:
I never wanted to split our community in any way. The hmsx repo is hosted as Organizational Open Source account, so interrested developers and testers can join the org and all others can publicly access anything or fork it, there is nothing to hide or a commercial agenda to make money out of it.

I don't want to be the Boss or Guru of anything but someone has to do the first step. Right now there is still a lot of work todo to rewrite some peaces of existing code, test it and build a new Installer. It will need time and patients and a lot of Coffee.

mikedibella
Senior user
Senior user
Posts: 828
Joined: 2016-12-08 02:21

Re: hMailServer X

Post by mikedibella » 2023-10-18 18:38

Dravion wrote:
2023-10-18 18:14
The next thing is Scripting. We cannot forever continue with VBScript so we need a reasonable replacement which is
1) Easy to integrate into the server
2) Easy to learn for VBScript users
3) Behave the same way on all platfroms
4) Not getting abandoned, deprecated or removed
Perhaps an approach that moves all of the API and scripting functionality to web interfaces? APIs exposed via REST interfaces and extended to include webhook registration, with the event model dispatching web requests to hooked subscribers.

This would allow any language that can be hosted on top of a webserver to be used for scripting.

User avatar
Paulo Meireles
Normal user
Normal user
Posts: 86
Joined: 2005-04-16 13:09
Location: Lisbon - Portugal

Re: hMailServer X

Post by Paulo Meireles » 2023-10-18 19:24

jimimaseye wrote:
2023-10-18 17:08
For the record, MY comment is purely based on (re)writing to be Liniux compatible and still calling it 'hMailserver'. I said (above) that there is need for rewriting to ensure its functionailty on the Windows Platform which is what hMailserver is designed for.
As far as I could understand, Dravion is not preventing "hMailServer X" from running in Windows. On the contrary: it will still run in Windows for those who like Windows, but it will also run in Linux (and maybe BSD, and even MacOS) for those who prefer these. Making it run on more OSs will make it more visible and prevalent, not less. Many products started on a certain platform and were then ported to others; I see that as an enhancement. Whoever wants to run it in Windows will still be able to do so; only some components, and some functionality, will change - like scripting. With time, if we manage to attract the right devs, it may even turn into a much better product than it is today - for the benefit of all of us, whether we run it on Windows, Linux or some bizarre OS.

But this is how I see it; what possible bad outcome can you see here that I'm overlooking?

User avatar
Dravion
Senior user
Senior user
Posts: 2060
Joined: 2015-09-26 11:50
Location: Germany
Contact:

Re: hMailServer X

Post by Dravion » 2023-10-18 19:38

mikedibella wrote:
2023-10-18 18:38
Perhaps an approach that moves all of the API and scripting functionality to web interfaces? APIs exposed via REST interfaces and extended to include webhook registration, with the event model dispatching web requests to hooked subscribers.

This would allow any language that can be hosted on top of a webserver to be used for scripting.
External API access for all sorts of Programming languages and Scripts isn't the Problem.
You can easily access hmsx from NodeJS, ASP.NET, PHP, PERL, Python or Java, take a look into the examples:

HMSX API Remote examples:
https://github.com/hMailServer-X/hmsx/t ... n/Examples

The Problem is Internal scripting which makes it possible to let hMailServer react to events like Email client logins via IMAP or SMTP, to
respond to specific text tokens inside a Email or automate all sorts of stuff.

User avatar
Dravion
Senior user
Senior user
Posts: 2060
Joined: 2015-09-26 11:50
Location: Germany
Contact:

Re: hMailServer X

Post by Dravion » 2023-10-18 19:40

Paulo Meireles wrote:
2023-10-18 19:24
jimimaseye wrote:
2023-10-18 17:08
For the record, MY comment is purely based on (re)writing to be Liniux compatible and still calling it 'hMailserver'. I said (above) that there is need for rewriting to ensure its functionailty on the Windows Platform which is what hMailserver is designed for.
As far as I could understand, Dravion is not preventing "hMailServer X" from running in Windows. On the contrary: it will still run in Windows for those who like Windows, but it will also run in Linux (and maybe BSD, and even MacOS) for those who prefer these. Making it run on more OSs will make it more visible and prevalent, not less. Many products started on a certain platform and were then ported to others; I see that as an enhancement. Whoever wants to run it in Windows will still be able to do so; only some components, and some functionality, will change - like scripting. With time, if we manage to attract the right devs, it may even turn into a much better product than it is today - for the benefit of all of us, whether we run it on Windows, Linux or some bizarre OS.

But this is how I see it; what possible bad outcome can you see here that I'm overlooking?
You are 100% right, that's the plan :)

mikedibella
Senior user
Senior user
Posts: 828
Joined: 2016-12-08 02:21

Re: hMailServer X

Post by mikedibella » 2023-10-18 20:07

Dravion wrote:
2023-10-18 19:38
The Problem is Internal scripting which makes it possible to let hMailServer react to events like Email client logins via IMAP or SMTP, to respond to specific text tokens inside a Email or automate all sorts of stuff.
Agree. That's where the webhooks come in. Processes register to subscribe to the events (OnAcceptMessage, etc) by providing a URI of a sink. hMailserver then calls the sink with payload describing the type of event and related data. The sink processes the payload and makes callbacks to the hMailserver's API interfaces as needed, then responds the HTTP request with a result.

User avatar
Dravion
Senior user
Senior user
Posts: 2060
Joined: 2015-09-26 11:50
Location: Germany
Contact:

Re: hMailServer X

Post by Dravion » 2023-10-18 21:04

Yes, its easy for a Client to use REST but it's hard to make a secure REST API, especially for something like hMailServer.

For a REST API's, you first and for most need a full blown HTTPS Server which (to have secure connection requires a SSL-Certificate configured) but this is only for the Transport layer security. Then you need a Authentication mechanism wich is in most REST cases OAuth2, then you need something which will track your connections bc REST is in it's very nature is stateless, so you have to authenticate every access to a REST API URI resource again and again, you can't just rely on ASP.NET or PhpSessions so you need something like JWST (JSON Web tokens) which have to be placed at the HTTPS-Client side and invalidated from time to time. You also need all sorts of Cross Site Request forgery prevention and you need to sanitize all your URI requests to prevent XSS. And we didn't mention yet a easy to use Setup program which configures and setup all the steps above automatically and correctly.

No, there is already a way to access hmsx remotely in a most secure and easy way, even for WebApps so it will stay that way.
But if you fancy, you can grab the code and implement a REST API yourself, nobody is holding you back :D

But what we really need is a sustainable, compact and easy to integrate Scripting Engine which can replace VBScript. Integrating LUA in hMailServer code is easy. The hMailServer.exe just gets a few bytes bigger, that's it. The rest is just coding and making LUA do what VBScript did all the years in hMailServer. It's basicly stuff like this:

*OnClientConnect
*OnAcceptMessage
*OnBackupCompleted
*OnBackupFailed
*OnDeliverMessage
*OnDeliveryFailed
*OnDeliveryStart
*OnError
*OnExternalAccountDownload
*OnSMTPData

And maybe later more "On_xyz events".

User avatar
Dravion
Senior user
Senior user
Posts: 2060
Joined: 2015-09-26 11:50
Location: Germany
Contact:

Re: hMailServer X

Post by Dravion » 2023-10-18 21:28

And to ease the fear for LUA, here is a small Fibonacci example for VBScript and a LUA Script.

Fibonacci.vbs

Code: Select all

' Fibonacci

Function Fibonacci(n)
    If n <= 0 Then
        Fibonacci = 0
    ElseIf n = 1 Then
        Fibonacci = 1
    Else
        Fibonacci = Fibonacci(n - 1) + Fibonacci(n - 2)
    End If
End Function

Dim mycount
mycount = 10 

For i = 0 To mycount - 1
    WScript.Echo "Fibonacci(" & i & ") = " & Fibonacci(i)
Next


Fibonacci.lua

Code: Select all

-- Fibonacci 

function Fibonacci(n)
    if n <= 0 then
        return 0
    elseif n == 1 then
        return 1
    else
        return Fibonacci(n - 1) + Fibonacci(n - 2)
    end
end

local mycount= 10  
for i = 0, mycount- 1 do
    print("Fibonacci(" .. i .. ") = " .. Fibonacci(i))
end

Output result:
Fibonacci.png
Fibonacci.png (24.76 KiB) Viewed 19524 times

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

Re: hMailServer X

Post by SorenR » 2023-10-18 23:37

palinka wrote:
2023-10-18 17:03
Its certainly doomed if no one does anything.
I'm experimenting with LUA running in Windows Active Script Engine ... viewtopic.php?p=249830#p249830
SørenR.

To understand recursion, you must first understand recursion.

palinka
Senior user
Senior user
Posts: 4359
Joined: 2017-09-12 17:57

Re: hMailServer X

Post by palinka » 2023-10-19 06:46

SorenR wrote:
2023-10-18 23:37
palinka wrote:
2023-10-18 17:03
Its certainly doomed if no one does anything.
I'm experimenting with LUA running in Windows Active Script Engine ... viewtopic.php?p=249830#p249830
Image

mats
Normal user
Normal user
Posts: 46
Joined: 2018-05-06 20:58

Re: hMailServer X

Post by mats » 2023-10-25 20:04

I still think lua is a mistake.
Will Microsoft provide functionality for Lua or Powershell only?
With Windows as the main plattform - The main scripting language on that plattform (and therefore the one what most people know) is Powershell

Therefore I'm afraid it's another dead end.
I don't code pure c/C++ so I have no Idea of the complexity. I tend to do things in VB.Net (Yes I cheat ;)). There it's just a few lines to integrate Powershell

palinka
Senior user
Senior user
Posts: 4359
Joined: 2017-09-12 17:57

Re: hMailServer X

Post by palinka » 2023-10-25 20:19

Dravion wrote:
2023-10-18 21:04
Yes, its easy for a Client to use REST but it's hard to make a secure REST API, especially for something like hMailServer.

For a REST API's, you first and for most need a full blown HTTPS Server which (to have secure connection requires a SSL-Certificate configured) but this is only for the Transport layer security. Then you need a Authentication mechanism wich is in most REST cases OAuth2, then you need something which will track your connections bc REST is in it's very nature is stateless, so you have to authenticate every access to a REST API URI resource again and again, you can't just rely on ASP.NET or PhpSessions so you need something like JWST (JSON Web tokens) which have to be placed at the HTTPS-Client side and invalidated from time to time. You also need all sorts of Cross Site Request forgery prevention and you need to sanitize all your URI requests to prevent XSS. And we didn't mention yet a easy to use Setup program which configures and setup all the steps above automatically and correctly.

No, there is already a way to access hmsx remotely in a most secure and easy way, even for WebApps so it will stay that way.
But if you fancy, you can grab the code and implement a REST API yourself, nobody is holding you back :D

But what we really need is a sustainable, compact and easy to integrate Scripting Engine which can replace VBScript. Integrating LUA in hMailServer code is easy. The hMailServer.exe just gets a few bytes bigger, that's it. The rest is just coding and making LUA do what VBScript did all the years in hMailServer. It's basicly stuff like this:

*OnClientConnect
*OnAcceptMessage
*OnBackupCompleted
*OnBackupFailed
*OnDeliverMessage
*OnDeliveryFailed
*OnDeliveryStart
*OnError
*OnExternalAccountDownload
*OnSMTPData

And maybe later more "On_xyz events".
Would it be possible for hmailserver to initiate the command of your choice for each internal trigger (OnClientConnect, etc)? That way you can use any scripting you want. For example, in the settings, there would be an option for each trigger to launch a command. I could put, for example, "powershell -file C:\scripts\OnClientConnect.ps1" and hmailserver would run that command with the oClient collection as a parameter AND a session number or some other unique session ID also as a parameter. Then the C:\scripts\OnClientConnect.ps1 could process whatever and return the unique ID and a collection of other simple commands, such as result.value, etc. Then it wouldn't matter what the internal script engine is as long as it can receive a collection of commands back from the external script. The whole thing could be json based or whatever.

User avatar
Dravion
Senior user
Senior user
Posts: 2060
Joined: 2015-09-26 11:50
Location: Germany
Contact:

Re: hMailServer X

Post by Dravion » 2023-10-26 04:26

The Challenge for internal scripting is it has to be Internal :)
Would it be possible for hmailserver to initiate the command of your choice for each internal trigger (OnClientConnect, etc)?
In theory yes. I think it's possible for a LUA Script to call another script or *.exe

For hmsx we need a Internal Scrpting Environment which can be integrated into the Service itself with no strings attached to the underlying Operating system and don't create unecessary dependencies. LUA is independent and stands completely on its own, so you don't have to call external processes like EXE, DLL's or COM objects. It has what is required for the Job which is mainly reacting on the Internal On* events which is normally the Job of VBScript. It's also battle proven for all sorts of embedded scripting task's and many Developers use it exactly for this specific reason. There is a very active LUA Community out there. It's also easy to understand for someone with a VBScript background.

But Powershell is 100% supported for external scripting :)

mats
Normal user
Normal user
Posts: 46
Joined: 2018-05-06 20:58

Re: hMailServer X

Post by mats » 2023-10-26 11:41

Dravion wrote:
2023-10-26 04:26
The Challenge for internal scripting is it has to be Internal :)
Would it be possible for hmailserver to initiate the command of your choice for each internal trigger (OnClientConnect, etc)?
In theory yes. I think it's possible for a LUA Script to call another script or *.exe

For hmsx we need a Internal Scrpting Environment which can be integrated into the Service itself with no strings attached to the underlying Operating system and don't create unecessary dependencies. LUA is independent and stands completely on its own, so you don't have to call external processes like EXE, DLL's or COM objects. It has what is required for the Job which is mainly reacting on the Internal On* events which is normally the Job of VBScript. It's also battle proven for all sorts of embedded scripting task's and many Developers use it exactly for this specific reason. There is a very active LUA Community out there. It's also easy to understand for someone with a VBScript background.

But Powershell is 100% supported for external scripting :)
I cant find an example for a basic task like creating a windows fw rule, can it even be done without having external Com or Exe calls?
Last time we tried using lua it couldnt read a proxy.pac - do you know if that has been fixed?

That is the kind of functionalty that is used in events today with vbscript. On Connect, a check is made to abuseipdb, if its a baddie, a firewall rule is created to block them. On a small testsystem - 500 - 1000 fw rules/day is created. It more than halves the number of connections made to hmailserver.
Having to load up an external Powershell environment for each of those sessions will be a performance and memory usage problem

User avatar
Dravion
Senior user
Senior user
Posts: 2060
Joined: 2015-09-26 11:50
Location: Germany
Contact:

Re: hMailServer X

Post by Dravion » 2023-10-26 13:58

Then you looked not hard enough :)


Add a ip to Windows Firewall block list

Code: Select all

-- Example: Block a ip address on Windows 

local ip = '198.51.100.108' -- replace this with the IP you want to block
local ruleName = 'Block IP ' .. ip
local command = 'netsh advfirewall firewall add rule name="' .. ruleName .. '" dir=in interface=any action=block remoteip=' .. ip .. '/32 > NUL'

local success = os.execute(command)

if success then
    print('IP blocking rule added successfully')
else
    print('Failed to add IP blocking rule')
end

Delete a ip from the Windows Firewall block list

Code: Select all

-- Example: Deleting a blocked ip from the Windows Firewall

local ip = '198.51.100.108' -- The IP you want to unblock
local ruleName = 'Block IP ' .. ip
local command = 'netsh advfirewall firewall delete rule name="' .. ruleName .. '" > NUL'

local success = os.execute(command)

if success then
    print('IP was successfully unblocked')
else
    print('Provided ip is not on the block list')
end

This is just the out of the box approach which works fine on Windows.

But there will also be a hmsx specific COM Library (called hmailxcom.dll) which will provide advanced features for scripts which want's to stay in COM/DCOM land, but it has no priority now.

mats
Normal user
Normal user
Posts: 46
Joined: 2018-05-06 20:58

Re: hMailServer X

Post by mats » 2023-10-26 15:11

Dravion wrote:
2023-10-26 13:58
Then you looked not hard enough :)
Or one of us needs to polish our glasses ;)
I asked for without having external Com or Exe calls just because Netsh is an external exe - a slowly dying one. (if I have to call an exe it will be pwsh)

If you run netsh followed by advfirewall you get

Code: Select all

In future versions of Windows, Microsoft might remove the Netsh functionality
for Windows Firewall with Advanced Security.

Microsoft recommends that you transition to Windows PowerShell if you currently
use netsh to configure and manage Windows Firewall with Advanced Security.

Hence I'm worried about future proofing the design if we have to be dependent on dying code.
MS seems to be dropping exe and com based tools replacing them with Powershell cmdlets. The later mostly runs cross plattform. With VBscript officially dead I think this will be an accelerating process since the need for the old way will be reduced.

I fully respect that it might be hard to impossible to use Powershell inline from C/C++. I only do very small C# programs when I'm not doing it in VB.net or Powershell or if forced to VBScript but I want to give it a run for the money because it's where MS is going andthe rest of the market will follow

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

Re: hMailServer X

Post by SorenR » 2023-10-26 16:04

SørenR.

To understand recursion, you must first understand recursion.

User avatar
Dravion
Senior user
Senior user
Posts: 2060
Joined: 2015-09-26 11:50
Location: Germany
Contact:

Re: hMailServer X

Post by Dravion » 2023-10-26 16:49

Ok, good to know that netsh is also on the deprecation list.

It really looks like we are haunted lately with such Microsoft policy changes.
We should double our efforts to stay away from unnecessary Windows API usage to minimize such code breaking changes in the
future. I also noticed that Visual C/C++ has some deprecation areas as well while the GNU GCC Compilers still supports even
Windows 2000 and XP if you need it. I think we should at least not only focus on Visual Studio but also start using the GNU GCC
Compiler for Windows. It supports the Language Standards better and causes less headache.

Regarding Windows Firewall. Powershell itself just interfaces with the Windows Firewall COM Object's to access the Windows Firewall.
This is basicly nothing different then a VBScript or a C# Program would do.

More freedom regarding the Windows Firewall would be direct access to the underlying Windows Filtering Platform (WFP), which is the
Core of the Windows Firewall System. A while ago i wrote a little buggy tool which blocked IP's via WFP but it had some bugs and i never updated it.

I think it would be worth adding a bunch of internal LUA API function's so you can add/check/delete Windows Firewall rules via WFP directly,
so we don't have to deal with COM/DCOM registry at all, so less attack surface for Microsoft deprecation changes.

User avatar
Paulo Meireles
Normal user
Normal user
Posts: 86
Joined: 2005-04-16 13:09
Location: Lisbon - Portugal

Re: hMailServer X

Post by Paulo Meireles » 2023-10-26 17:01

The more Microsoft deprecates old stuff, the fewer reasons there are to keep hMailServer Windows-centric. I would say this is the perfect opportunity to make hMailServer run everywhere.

We will have to change the way we do some things we're used to, and for some who have heaviily invested on deprecated technology it will be particularly painful.

As much as they have my solidarity, that should not become a hindrance preventing hMailServer from going forward.

The alternative is a "death by a thousand cuts", with a small bit being deprecated every few months, until it finally breaks for good.

> But there will also be a hmsx specific COM Library (called hmailxcom.dll) which will provide advanced features for scripts which want's to stay in COM/DCOM land, but it has no priority now.

This is the kind of thing that will make the transition smooth - that, and a well-supported migration procedure to machines running the new code. At least, backup/restore to/from ZIP should work.

User avatar
Dravion
Senior user
Senior user
Posts: 2060
Joined: 2015-09-26 11:50
Location: Germany
Contact:

Re: hMailServer X

Post by Dravion » 2023-10-27 09:42

@Paulo

Yes, i see it the same way.

The GNU Compiler has a pretty good compatibility record.
I was able a year or so ago to build OpenSSL 1.1.1 even on a MacOS 10.0 System for Power PC 32-Bit which was released 23 yrs ago. You can even build NT4 (released 1996) or DOS Apps in a supported way with modern C/C++ language support with it.

PS: I don't say we should support hmsx on such old platforms but it shows it could be done if someone really want it.

However:
I think Microsoft does this sort of deprecation just bc to sell you new Windows licenses and other stuff.

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

Re: hMailServer X

Post by SorenR » 2023-10-27 16:46

Dravion wrote:
2023-10-27 09:42
@Paulo

Yes, i see it the same way.

The GNU Compiler has a pretty good compatibility record.
I was able a year or so ago to build OpenSSL 1.1.1 even on a MacOS 10.0 System for Power PC 32-Bit which was released 23 yrs ago. You can even build NT4 (released 1996) or DOS Apps in a supported way with modern C/C++ language support with it.

PS: I don't say we should support hmsx on such old platforms but it shows it could be done if someone really want it.

However:
I think Microsoft does this sort of deprecation just bc to sell you new Windows licenses and other stuff.
Their marketing dept. is jealous on the phone/gadget market, they discovered that even though Android has a 70% market share and Apple only hold a 28% market share, Apple is capable of selling "sand in Sahara" into their cult.

E.g. my (Android) phones usually last 5'ish years before they break down or OS deprecates itself... My daughter (and a few stray friends) usually buys EVERY new iPhone when they are released - just like all the other sheeple. New Apple device/iOS version => supporting devices no longer supported, need to buy new iWatch and iPod's ... $$$$ ... This is where Microsoft pulled a "Windows 11 not supported" on their customers.

To some extend we could also include Tesla owners ... New model? => sell car, buys new car.

I had to scrap my XP powered laptop last year due to a head crash. I had a spare just a few years old 64bit quad-core i7 6500U, 250 GB SSD, laptop with Windows 10 that I used on/off and this now became my new "daily driver" ... Only, now it seems hardware (CPU) does not support Windows 11.

I also do 3D printing and I needed an easy way to access my printer across the network as swapping SD-Cards was getting tedious... In comes OctoPrint. Great, went through my stash in the attic and found an old AMD CPU powered Acer laptop with 2GB RAM, downloaded the _latest_ Ubuntu Server, set up WiFi, installed OctoPrint - USB cable from laptop to printer ... Job done! Now I just need to add a webcam so I can monitor the job without being in the room. All this did not cost me a f'ing cent!

I know how the first settlers in America felt... I felt the same when The Internet got opened up universities and later to the public. Ever since that day Big Corp and State has been trying to control us and make money on our work!

It's time we take back control and go 100% Open Source!

Ehrm... or something to that effect :mrgreen:

NB: End Rant.
SørenR.

To understand recursion, you must first understand recursion.

User avatar
Paulo Meireles
Normal user
Normal user
Posts: 86
Joined: 2005-04-16 13:09
Location: Lisbon - Portugal

Re: hMailServer X

Post by Paulo Meireles » 2023-10-28 03:49

@SorenR
Loved the rant. Made me feel just a tad less old, and glad not to be alone. :D

@Dravion
I think everyone would be more comfortable if Martin gave his blessing to your approach.

@Everyone else
As much as we are all forever grateful to Martin for offering his time and work for so many years, and to the few others that have been keeping hMailServer afloat by offering support here, I think the ultimate homage would be not to let hMailServer die.
Martin himself has, in the past, ventured into the idea of porting hMailServer to Linux, so it's not such a big anathema as long as it also runs in Windows. In a world a bit more perfect than this one, maybe Martin would make it happen and then pass the helm to the next captain. Martin has, however, made it abundantly clear that he's done with this.
We are a small community and less than a handful have the skills to support and evolve hMailServer. It would be beneficial to us all to help at least decide in which direction we would like to go. Of course, there's always the possibility of letting the product die. For those who support this option, if you write the epitaph and arrange for flowers to be sent, please let me know how to contribute. However, I invite those unwilling to give up to share their views and concerns. Maybe we can, in the end, establish some goals, reach some compromise, establish priorities, and even draft a roadmap for whatever we want to accomplish. I would start by stating that hMailServer should be expunged of all deprecated technology, and proper replacements should be found. Anyone disagrees with this?

User avatar
Dravion
Senior user
Senior user
Posts: 2060
Joined: 2015-09-26 11:50
Location: Germany
Contact:

Re: hMailServer X

Post by Dravion » 2023-10-28 07:57

@Paulo

I am on it
The plan for now is to rip all the non-standard code out of it while at the same time the basic features like delivering Emails and SSL/TLS still it's doing its Job.

So far i reached the point where anything related to COM/DCOM/ActiveX/OLE/ATL/Registry plus VBScript and JScript which also included to cut of MS-SQL Server and MS-SQL-CE support (both are using COM code).

However, the MySQL connection code was also removed
bc Martin modified the MySQL connection libs in a way that its not possible to upgrade even to MySQL v8 (we talked about it in the past).

However:
PostgreSQL works surprisingly fine plus i was able to build it from source in a minimal configuration so the complete, embedded PostgreSQL server just increases the installer by 7 MBytes and can be automatically installed and configured to make the Server run after Install. There is no extra DBSetup step necessary right now. I will focus on PostgreSQL only for now and maybe in future re-add MySQLv8 and MariaDB support in a upgrade safe way.

But there is also now new replacement code in it.
All file path to includes and libraries is now cross platform ready by replacing it with POSIX compliant file path.

Necessary Windows dependent headers includes are now invoked from a central location, from pch.h and encapsulated by a windows specific pre processor macro so they will be ignored if the platform is not Windows and not MSVC.

Windows specific Datatypes (for example: __int64 are now replaced with the standard compliant substitute of "long long" as well as TCHAR to it's substitute wchar_t*.

But there are a few nasty spots left.
1) The DNS-Resolver code (uses WinDNS.h)
2) INI handling (uses Win APi code)
3) XMLite (uses Windows Datatypes)
4) StdString.h (old safe string handling code).

There was also new feature code added by inserting
the fundamentals of a new TCP/IP based and TLSv1.3 encrypted remote protocol which fills the COM API spot but right now its just a proof of concept for the new TCP based API.

My task now is to replace WinDNS Windows API dependent code with the C-ARES Open Source Client resolver library.
This also will add the feature to choose a DNS-Server explicitly for hMailServer X and later maby per Domain (not sure if we need this). Right now C-ARES code is already integrated and compiles fine. It's adds the cares.dll to the hMailServer/Bin folder.

#Cross compile
There is also now a CMakeLists.txt Make file which can configure the code to target the desired platform and compiler toolchain (MSVC or GCC or CLANG) while not relying on MSBuild or the Visual Studio Environment. This makes the code independent from Visual Studio but is also necessary to build the code for all Platforms and not just for Windows and with MSVC.

Cross compile also means we can build the Windows version side by side with the Linux and MacOS version from a Linux VM. In that case we could simple ship the VM for hmsx Developers which can do custom builds and add features in a way its compliant to all platforms.

Maybe Github Actions is also a good method to provide automatic builds (compiled and packaged on Github). This could also increase the trust that only the code seen on Github is inside the compiled hmsx binaries and nothing else.

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

Re: hMailServer X

Post by SorenR » 2023-11-01 22:38

@Dravion

What are your experiences with Perl??

https://perlhelp.web.cern.ch/Components ... cript.html

Code: Select all

PerlScript is an ActiveX scripting engine that allows you to use Perl with any ActiveX scripting host. At this time, ActiveX scripting hosts include:

Internet Information Server 3.0/4.0/5.0
Peer Web Services 3.0/4.0
Microsoft Internet Explorer 5.0x
Windows Scripting Host
SørenR.

To understand recursion, you must first understand recursion.

User avatar
Dravion
Senior user
Senior user
Posts: 2060
Joined: 2015-09-26 11:50
Location: Germany
Contact:

Re: hMailServer X

Post by Dravion » 2023-11-01 23:25

Hmm, Perl is ok i think.

But a ActiveX Perl is basicly a COM dependent version while normal perl versions are not.

The decision for LUA (for internal scripting purposes only, not the COM API replacement) is just bc it extremely
compact and has anything it needs running from your own App without any strings attached to the underlying OS.

This basicly means, we can do for example a OnConnect() event function which triggers a LUA Script which runs
the same on Windows, Linux or MacOS (or Unix or other exotic platforms).

Reducing unnecessary OS dependencies also makes sure we do not fall again in a deprecation trap that easy.

If you want to run Perl or Python, you always have a big environment to package and config or side by side install
on the target Computer. In terms of LUA, we don't have to think about any of this, it just works^^

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

Re: hMailServer X

Post by SorenR » 2023-11-02 00:52

The japanese company that made LUAScript (WSH) claim the same code (functionality) runs 35 times faster as LUA compared to VBS.

If we can maintain the "eventhandlers.lua" file (and structure) we can share the script between the "official" hMailServer with the WSH LUAScript add-on and hMailServer_X with the embedded LUA engine.

I really need to look into modifying 5.6.9 to accept LUA. The LUA script is version 5.1 so not really that old. LUAScript source code is built with Visual Studio 2008 around 2011 or 2012.
SørenR.

To understand recursion, you must first understand recursion.

Locked