Add Domain\Country Restrictions in user account like MDaemon.

Use this forum if you want to suggest a new feature to hMailServer. Before posting, please search the forum to confirm that it has not already been suggested.
Post Reply
hjbg1976
New user
New user
Posts: 3
Joined: 2020-01-15 19:07

Add Domain\Country Restrictions in user account like MDaemon.

Post by hjbg1976 » 2020-01-15 19:55

I would like if it is possible to add in hMail the function or feature that allows you to configure filtering by inbound and outbound domains\countries at the mailbox or email account level, as Alt-N Mdaemon satisfactorily does in the part of restrictions on mailbox configuration, all reflected in the guardian.dat file in the \ mdaemon\app folder. Any clue or suggestions please.

Below I give an example of how it looks more or less in this configuration file (of course I would like it to be seen with a graphical interface)

The example in question denies access to all domains except for all those ending in *.xx

[test@domain.xx-Outbound]
Action=Returned to sender
Restrict=Yes
Address0=*.xx
[test@domain.xx-Outbound]
Action=Returned to sender
Restrict=Yes
Address0=*.xx
Attachments
Restrict messages in Mdaemon.jpg

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

Re: Add Domain\Country Restrictions in user account like MDaemon.

Post by palinka » 2020-01-15 21:15

This can be done with account rules. No scripting required, unless you want to get really fancy.

For ".xx", ".cn", ".co.uk"

IF: To [regular expression] = ^.*([a-zA-Z0-9-]{2,253}\.(xx|cn|co.uk))>?$
THEN: delete email, or forward or whatever

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

Re: Add Domain\Country Restrictions in user account like MDaemon.

Post by mattg » 2020-01-15 23:26

OR

use zz.countries.nerd.dk as a DNSBL and score appropriately if you want to use GeoLocation data, rather than rely on domain naming conventions
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

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

Re: Add Domain\Country Restrictions in user account like MDaemon.

Post by palinka » 2020-01-16 00:13

He doesn't want to do scripting. But yes, geoip is absolutely a better option. More accurate and more flexible.

On second look, you could trim the regex down to this: ^.*(xx|cn|co.uk)>?$

I guess I was thinking finding domains when all I needed was TLDs.

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

Re: Add Domain\Country Restrictions in user account like MDaemon.

Post by mattg » 2020-01-16 03:57

Setting up a DNSBL doesn't use scripting
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

hjbg1976
New user
New user
Posts: 3
Joined: 2020-01-15 19:07

Re: Add Domain\Country Restrictions in user account like MDaemon.

Post by hjbg1976 » 2020-07-04 03:45

Thanks for all. Ill try yours suggestions later. Perhaps in a near future a GUI Domain/IP/TLD filter its demanded for people that don´t feel very comfortable with scripts or logic operators.

hjbg1976
New user
New user
Posts: 3
Joined: 2020-01-15 19:07

Re: Add Domain\Country Restrictions in user account like MDaemon.

Post by hjbg1976 » 2020-07-04 04:16

Thanks for all. Ill try yours suggestions later. Perhaps in a near future a GUI Domain/IP/TLD filter its demanded for people that don´t feel very comfortable with scripts or logic operators.

The main idea its restrict the world and permit only certain domains for some accounts each one. Not the opposed like https://beaukey.blogspot.com/2015/07/co ... erver.html that sounds like a global script and restrict some TLDs or domains.

Is for use in a business level where the supervision and control is very necessary for an efficient and secure use of the limited resources.

Best regards;

Post Reply