Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mailbox auto aliases #179

Merged
merged 9 commits into from
May 16, 2020
Merged

Conversation

mfechner
Copy link
Contributor

A plugin that will create required aliases if a mailbox for a domain is created.
Plugin is by default disabled and has to be enabled in application.ini.
Also define default aliases that should be created, see application.ini.dist for an example.

@PhrozenByte
Copy link
Contributor

see #119, especially #119 (comment), why this IMHO is not a good solution for non-skilled users - even though the plugin is disabled by default. 😕

btw, the list should also contain admin, administrator and root as optional aliases 😉

@mfechner
Copy link
Contributor Author

The RFC enforces some aliases, please see here:
https://www.ietf.org/rfc/rfc2142.txt

The aliases must exist for the domain.
To which mailbox you route this can be changed, but the addon will not allow you to deactivate or delete the aliases. To make it as simple as possible for the user, the addon will create the enforced aliases with the first mailbox created (before mail will not work).

To make it more clear, I added to the error message a link to the RFC. See next commit to the branch.

I do not really understand, why you are against a plugin that makes sure that your mail system is compliant to RFCs. A normal user is not aware of that and with the plugin the must not, as the plugin will handle it for you.

@PhrozenByte
Copy link
Contributor

As I explained in the linked comment, I'm not against solving this problem, but the solution you've chosen. You silently assume that the first created mailbox/alias is an administrative address, but why should a user, who isn't aware that there are required administrative addresses at all, create a administrative mailbox/alias first? The result is unexpected behavior: a user creates a mailbox for Joe Bloggs and isn't aware that Joe Bloggs now receives all administrative emails of this domain - just because it was the first mailbox/alias he created for this domain. A user would never expect something like this to happen.

IMHO this should be solved with a static configuration parameter. You set e.g. admin@other-domain.com in your application.ini and the plugin creates the administrative aliases in conjunction with the domain and admin@other-domain.com as goto address. The plugin can still disallow deleting those aliases.

@bitcloud suggested a even simpler solution: Just add a notice about those required administrative addresses. However, personally I prefer a technical solution, too.

@mfechner
Copy link
Contributor Author

What do you think if I would add a default email address that could be used as target email if a new mailbox is created.
Something like:
vimbadmin_plugins.MailboxAutomaticAliases.defaultAliases["postmaster"] = "admin@example.com"

If it is defined, that email is used as target for the newly created alias.
If it is not defined the mailbox is used is is just created.

@PhrozenByte
Copy link
Contributor

IMHO this can still lead to confusion, but personally I think that it could be a reasonable compromise. Let us see what @barryo says. 😃

@nysander
Copy link

@idefix6 for me this is great plugin I was just looking for. Is it possible to add option to make predefined destination addreses for this, as you suggested above?

On my mail server I am the only administrator and the other person administers only his domains / mailboxes but does not do any other administrative job. I have now one mailbox to which all domains RFC aliases are forwarded, so this will be great addon for me to maintain RFC compatibility and have all forwards to not random mailbox but only mine

@mfechner
Copy link
Contributor Author

@nysander could you please review the commit I just pushed into the the banch mailbox_auto_aliases.
The commit adds the possibility to stored fixed admin emails for each enforced alias.
Please have a look in application.ini.dist for an example.

@mfechner mfechner force-pushed the mailbox_auto_aliases branch from bc98370 to 21908f2 Compare June 18, 2016 11:37
@nysander
Copy link

@idefix6 it looks promising. I will check this later today. One question we got there 4 aliases defined. Will this new code also work if I define my own global aliases for example admin@example.com

@mfechner
Copy link
Contributor Author

mfechner commented Jun 18, 2016

@nysander you have to create for each enforced alias a line where this enforced alias should be forwarded.

@nysander
Copy link

nysander commented Jun 19, 2016

@idefix6 I've tested out the plugin and it works very well. If i predefine destination addresses (on another domain) purging mailbox on the domain does not do anything with them so I have then domain without mailbox and rfc aliases set.

I got some idea to make this plugin more general in case of messages displayed and delete protection (now any additional alias predefined gets into RFC 2142 message.

My idea is to set warning message in application.ini for aliases which should be protected from deletion but for that defined without protection message deletion after creating should be possible.

let's look at examples (3 aliases - abuse from RFC, dmarc from "host policy", admin as additional one)

vimbadmin_plugins.MailboxAutomaticAliases.defaultAliases[] = "abuse"
vimbadmin_plugins.MailboxAutomaticAliases.defaultAliases[] = "dmarc"
vimbadmin_plugins.MailboxAutomaticAliases.defaultAliases[] = "admin"

vimbadmin_plugins.MailboxAutomaticAliases.protected.abuse = "RFC 2142"
vimbadmin_plugins.MailboxAutomaticAliases.protected.dmarc = "Host Policy"
;vimbadmin_plugins.MailboxAutomaticAliases.protected.admin = "" // commented - no delete protection

this code can be invalid in terms of vimbadmin architecture. treat this as proof of concept.

what do you think?

@PhrozenByte
Copy link
Contributor

PhrozenByte commented Jun 19, 2016

If i predefine destination addresses (on another domain) purging mailbox on the domain does not do anything with them so I have then domain without mailbox and rfc aliases set.

Took me some time to understand what @nysander is trying to say... @idefix6, you should add a mailbox_purge_preRemove hook (ViMbAdmin doesn't check the return value at the moment) to ensure that you can't delete a mailbox which is the goto address of one of the pre-defined aliases (otherwise you get non-functional aliases). Same applies to aliases as goto address (i.e. alias_delete_preRemove should be extended to do the same check as mailbox_purge_preRemove) and for toggling/disabling them.

All in all, personally I'm completely fine with this solution, it's a reasonable compromise. Great work @idefix6 and thank you for taking the feedback into consideration! 👍

@mfechner
Copy link
Contributor Author

mfechner commented Jun 24, 2016

I will try to implement this if the weather is bad again ;)
But I put it to my todo list.

@nysander
Copy link

great :) the weather does not help mental work now ... 45 C on sun side today :P

@mfechner
Copy link
Contributor Author

I started to implement the wanted feature but to get it fully implemented I have to wait till pull request #203 is accepted and merged. I think this is the cleanest way to present to user a good to ready error message why the deletion of the mailbox was denied.

@mfechner mfechner force-pushed the mailbox_auto_aliases branch from ce9930d to da81f87 Compare August 27, 2016 11:02
@extremeshok
Copy link

#203 was merged

How about if there is a button for the user account, which when clicked will create the default admin alaias;s ? Or possibly a checkbox when the user account is created. ie [ ] Create Admin Aliases

That button / checkbox is hidden once the aliases exist for the domain.

@mikakoivisto
Copy link

mikakoivisto commented Oct 21, 2016

Awesome job @idefix6. I just tested this and works like a charm. I really like it how it doesn't allow to remove them.

@nysander
Copy link

where this pull will be merged into master?

@mfechner mfechner force-pushed the mailbox_auto_aliases branch from da81f87 to 6e910f9 Compare February 18, 2017 10:38
@barryo
Copy link
Member

barryo commented May 16, 2020

Thanks @mfechner and everyone else for working on this. Merging now.

@barryo barryo merged commit e021eef into opensolutions:master May 16, 2020
@mfechner mfechner deleted the mailbox_auto_aliases branch May 16, 2020 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants