Dovecot administration without headaches?
I've run Dovecot+Postfix mail servers in medium-to-large corporate environments, where email addresses are mostly generated via LDAP accounts, or passed down through some HR system or other. I also run that combination (Dovecot+Postfix) with a MariaDB back end on my personal server, which is home to a bunch of projects, a family member's small business, and so on.
I am not looking for help with how to install Dovecot and Postfix themselves. What I'd like to know is what tool or tools others use on small installations (command-line only, please) for managing domains, mailboxes, aliases, and so on in my Postfix+Dovecot install.
I had a web-based management panel in the past, but am tired of trying to pile eggshell security around something so badly put together. Nor do I want to hand query the DB to make changes.
I'm also not concerned with migration overhead...the number of domains, mailboxes, and aliases on this server that will need to go to its replacement are within the range that I could bribe my teenager to enter by hand if needed. ;)
Solution 1:
I have a similar small scale setup, with MySQL providing the virtual_domains and virtual_aliases to postfix and dovecot. I wrote my own web interface to manage them (primarily so I could hand it off to someone else to maintain).
Given that you're not interested in a web interface, or direct SQL the only other alternative I can think of would be shell scripts.
Essentially you'd have to write your SQL into a (bash) script to do certain jobs. Then you can then call the appropriate scripts to add, update or remove aliases/domains/users.
Something along the lines of this:
#!/bin/bash
## updatepassword.sh <email@address> <password>
## Update the password for an email account
mysql -u root -p forge -e "UPDATE users SET password = '$2' WHERE email= '$1'";
## Tell me if it's worked or not!
if [ $? -eq 0 ]
then
echo "$1 updated"
else
echo "Couldn't update password for $1"
fi
updatepassword.sh [email protected] newpass
Keep in mind this example is very basic and you'd need to encrypt the password using whatever mechanism you were using. You could easily expand upon it if you wanted to to add data validation for inevitable typos and sanity checks for deleting aliases/users/domains.
I'll admit, I'm interested in what other people come up with.
Solution 2:
I've created a set of simple bash scripts for managing multiple domains, accounts, users, aliases, but it's still not ready for publishing on GitHub. I'm and was using it with success for the last 3-4 years. I have all my dovecot/postfix configs file-based, no database. I see I'm not the only one in need for a simple and working command-line solution?