git clone https://gitweb.michael.orlitzky.com/mailshears.git
Managing a mail system with virtual users is annoying. The authoritative database of users is stored in one table, but every other piece of software keeps its own database of users.
If you're using PostfixAdmin to manage your users, what happens when you delete a user? Chances are, nothing happens: mail directories are left behind, webmail preferences are saved, address books become orphaned. That's what mailshears was designed to fix. It cleans up after you remove a user or domain.
Another stupidly difficult task is renaming a single email account. It's easy to move the user in one database, but then all of the remaining filesystem directories and databases need to be updated as well. Since these two tasks are related, mailshears does them both.
The main assumption we make is that your users are managed by postfix.admin. There are filesystem, DAViCal, and Roundcube plugins available but they can be disabled.
Download the Release at the top of the page, and use gem to install it:
user $ gem install mailshears-*.gem
Successfully installed mailshears-0.1.0
Parsing documentation for mailshears-0.1.0
Done installing documentation for mailshears after 0 seconds
1 gem installed
Or in Gentoo,
user $ emerge mailshears
Once installed, you should create a config file by copying
mailshears.example.conf.yml to
$XDG_CONFIG_HOME/mailshears/mailshears.conf.yml
and
editing it to fit your environment.
Each plugin knows how to do three actions: prune, rename, and remove. Depending on how you invoke mailshears, it figured out which plugins need to be run and runs them in succession.
The prune mode additionally needs to access the postfix.admin database, since that's where the authoritative list of users and domains lives.
By default, mailshears doesn't actually do anything. There's a variable in the config file that you'll need to set before mailshears will touch your junk.
Email them to me at michael@orlitzky.com.