cyrus-user-map : Generate a Cyrus user map for Postfix

This program creates a Postfix map table listing all valid email Cyrus Imap user accounts available in the Cyrus Imap database.

This script works both with or without Cyrus Imap's Virtual Domain feature.

The map uses the Postfix hash format by default.

DOWNLOAD

USAGE

Execute this script periodically with cron, under the root user. It will create a user map of all the valid Cyrus Imap accounts. There is not need to restart Postfix.

PREREQUISITES

Both Postfix and Cyrus Imap must be running locally.

CONFIGURATION

1) Edit the configuration section of the script:

  • Set USERS_MAPFILE to the map's full path, usually in /etc/postfix.
  • Set CYRUS_CMD to Cyrus' ctl_mboxlist command's full path (/usr/sbin/ctl_mboxlist
    on Debian Linux).

2) Copy the script into the server's PATH.

3) Add the following line to Postfix's /etc/postfix/main.cf:

local_recipient_maps = hash:/etc/postfix/cyrus_usermap

and reload the postfix configuration :

postfix reload

3) Periodically execute the script via cron.

  • If you're running a modern cron, like Linux's cron, copy the file
    cron/create_cyrus_user_map to /etc/cron.d.
  • Otherwise adapt the cron file to you system in order to run the script
    periodically.
  • Don't forget to change the script's path if you're not installing it in
    /usr/local/sbin.

4) Enjoy.

REFERENCES