Mail server but no mailboxes for new users by default

NethServer Version: 7.6.1810
Module: nethserver-mail, nethserver-webtop, account provider: LDAP (local)

Hi all,

I have the following scenario: a NS instance, with local LDAP account provider and a mailserver plus Webtop. I have already configured all the users that are entitled to have a mail address on the system, now I would like to modify the default behaviour of NS and deny the creation/configuration of a mailbox for a new user by default.

Of course, I should be able to enable the mailbox for a single user on demand (then it stays enabled) and (best if) via NethGUI. I already thought on disabling the Access to email services flag once the user is created, but:

  • A new mailbox is created anyways and the server will deliver mails to the mailbox even if not consulted;
  • The server should respond with a SMTP error message for user unknown instead;
  • It is an additional passage I have to remember to do every new user, and since I wouldn’t be the only one to administer the instance, I cannot trust that every administrator will do it.

Have you got any ideas on how to deal with it? What’s the correct way to implement this (completely reverse, I fully understand) behaviour within NS? If you can provide steps to do it, I may implement it somehow and release it :wink:

Thanks in advance :slight_smile:

1 Like

What about to create an action triggered with the user-create event to add the user address email as email rejected by rspamd.

Like this, email for this user will receive a smtp reject answer, of course maybe not the one you expect.

Not tested but it should work

Edit: you took me at the bed jump sorry :slight_smile:

Above is to check the ‘from’ field of email, we need to configure a new map to check the ‘rcpt’ in the multimap module of rspamd to check if the header ‘to’ is not the email address of your user

https://rspamd.com/doc/modules/multimap.html

Check /etc/rspamd/locale.d/multimap.conf to see how to create a ‘rcpt’ map. The map could be a file that you push each email adresses (>>) or a template from an esmith property (like we do for other map)