This is a script I wrote to automate administration of virtual email
accounts and domains.  It is written for RedHat Linux, but should run
under any *nix environment with a couple of minor tweaks.

There are a few assumptions that this script makes:
 - maildrop delivery
 - userdb account storage
 - all email directories are under one main directory
 - maildir structure is <MAINDIR>/<DOMAIN>/<ACCOUNT>/Maildir
 - userdb should be a single file
 - hosteddomains should be a directory
 - domains for email accounts administered through this program
   should be in a file called 'auto' under hosteddomains and
   esmtpacceptmailfor.dir
 - domains not hosted locally should probably be in a separate file
   under esmtpacceptmailfor.dir.  This file will need to be updated
   manually.
 - mkpasswd should be available for generating random passwords

The script is written to be run from a normal user account.  It uses
sudo to run as root so it can change Courier's config files.  This is
NOT a secure setup.  I am sure there are quite a few holes that could
be used by a normal user to gain root privileges.  The program was
written for convenience, not security.  If you need security, either
remove the sudo checks and run it directly as root or add your own
taint checking to it.

To use the script, edit the configuration section at the top to match
your setup.  Edit /etc/sudoers to give the proper accounts permission
to run the script as root.  If you run the script directly, it will
handle the sudo call itself.

Please let me know if you have any comments or questions about this
script.

Bowie

Attachment: mailadmin
Description: Binary data

Reply via email to