mail-in-a-box / mailinabox

Mail-in-a-Box helps individuals take back control of their email by defining a one-click, easy-to-deploy SMTP+everything else server: a mail server in a box.
https://mailinabox.email/
Creative Commons Zero v1.0 Universal
14.02k stars 1.44k forks source link

Better domain management #2397

Open tognee opened 5 months ago

tognee commented 5 months ago

Currently domains are checked based on the users emails registered and there are no settings to manage them.

I want to make a PR to add this feature.

My proposal:

I'm making this issue to see if the PR could be considered for merging when submitted.

JoshData commented 4 months ago

I would accept that. It's something I've wanted to do.

The main thing I would want to discuss more is "Add the option to disable web hosting and A/AAAA records check on single domains":

But these don't have to stop you from starting.

tognee commented 4 months ago

Hi, thanks for your kind response

Database table schema:
Currently I've added a domains table with the fields domain and options. I've modelled the options field to work as the privileges fields in the table users. The options in options act as a boolean value, true if present and false if not. There is only one option for now, no-web that should do what I described in the OP.

What will be disabled:
Let's make an example with a domain example.com.

box.example.com can't enable this option as it's needed to show the admin panel, the webmail and nextcloud.
example.com and anotherexample.com can enable this option.

This option will:

As for the why:
The secondary domain is not connected via glue nameservers so the web hosting could be on another server. The primary domain should have an option to disable the web hosting if the box is using an external DNS without glue records or the user doesn't want to host a static website and wants to use their own server with their own instance of nginx. When using glue records the user could still remove the web server and add A AAAA or even CNAME records using the Custom DNS panel already present in the admin.

If any point is not clear enough let me know and I'll try to explain it better.

test2a commented 3 months ago

@JoshData similar to what tognee said, i want box.example.com to be the email server but example.com to be a different IP. is it possible to do that? i see an entry in external dns file example.com - box.example.com. how do i decouple box and primary domain?

JoshData commented 3 months ago

@test2a What you want is possible and not really related to this discussion. Please ask on the forum for help.

tognee commented 3 months ago

I've made some work on this feature on my own branch. It's still not ready for merging and development is proceeding slow as I need to destroy the VM and rebuild it every time I make a change (which takes quite a while).

https://github.com/tognee/mailinabox/tree/feat/domains

I might create a draft pull request when I get it working like I intended