Over the past couple weeks, @alento and myself have been working on a script to allow non-admins to manage a domain (example: a company running MIAB can give an HR department access to my script to add or remove users, without the need to give them full access to the MIAB instance). It does not use a traditional database, it uses a custom flat-file database that I have designed myself over the years. So the script can be drag and drop, however the config.php should be properly configured for maximum security.
git clone the repository to a webservers root directory (for Apache / Nginx the default is /var/www/html
copy config.example.php to config.php. Modify this to your config.
The db_location variable should not be anywhere inside, or under the webserver’s root. If you are using a default root, a good play is just /var/www. However anywhere is good as long as the webserver has read/write access.
In my use case … I have a domain which is being serviced by one of my MiaB instances and the owner of this domain demands the ability to add and delete mailboxes himself. This solves that issue without giving away access to the entire box.
Thanks again @murgero for this script - and dealing with my little fixes.
Very cool dude! I love your latest commit *shifty eyes*
I had started something like this a little while ago in Python but didn’t get very far.
I would suggest that the basic email setup info has a place on here too (I didn’t see it after a quick read through the code). And maybe even a link which opens up webmail. Perhaps I’ll try this out and submit a PR at the end of the month.
Do you think if something like this is hosted on the box, it would be possible to use the existing email account password?
You can sign in as any registered account (make sure to have a proper and secure path for the flat file db in config.php!) Just configure admin credentials in config.php and go. It can be on any server with PHP7 (should work on PHP5.X as well, but NOT TESTED OR SUPPORTED!)
This kinda goes outside the scope of this webapp. The web app is purely for admins to allow their end users (example: customers, managers, HR, etc etc) to manage email accounts. If you submit a PR and it looks clean and falls in line with my code, I’ll accept it. But otherwise I will not do it myself. But thank you for the suggestion!
Thanks @alento for your reply. I am exploring MIAB features and keen to learn more about this wonderful Mail server app. It is good to hear that you have a solution. Would you mind to share the steps to achieve this, PLEASE? Much appreciated.
Thanks so much for the reply.
What I ask is how do I change the @example.com email domain by default? Is there a place I can setup to choose my custom email domain.
It would be great if this script can sync with the main MIAB and listing the email domain for creating new users account.
I have set up email server for garden societies with their own email address:
You have missed something somewhere but I cannot remember exactly what.
Ok, I have looked at the code and during the install process you should have been prompted for the name of the domain that you want to manage.
During installation you must set the “registration” field in the config.php file to true. You will then need to register a user to manage each domain. Be sure to go back and edit config.php to change “registration” to false as you will not want it left on.
Each installation of this script, in its present form, can manage only one domain. This was true of the inital version of this script, but it was later updated to handle multiple domains. Let me see if there is a way to change the default domain without reinstallation.
Thanks for your quick reply.
I confirm that I did not see any code during the install process you should have been prompted for the name of the domain that you want to manage!
I noticed @murgero mentioned about the php-curl for the installation. I did sudo apt php7.2-curl. But I do not know how to command the curl bash script. This might be the reason which I did not have the installation process run correctly which also lead to my default @example.com!
Sorry for the late reply! Since I do not use MIAB anymore, my time on the forum is very very limited.
Changing the default domain is just changing the first domain listed in your MIAB instance. As for new users @alento is correct on how to do that. Just remember that user has full access to your instance and can modify the domain they get permission to access. The script, although tested by myself and @alento, has not been audited by a 3rd party to confirm that it is secure (as in no exploits to hack).
That said, I believe it to be safe, if you have any more issues, please let me know!
@alento - Thanks for taking command on this I’ll hop on Slack again if you need me for anything!