2.1. majordomo 的安装

  1. 创建用户 majordom,属于用户组 daemon

    $ useradd -g daemon majordom

    You can create and use a group other id than "daemon" if you want, but if you do, that UID needs to be a "trusted" user as far as Sendmail is concerned (i.e., the user name needs to appear on a "T" line in your sendmail.cf file).

  2. 创建安装目录

    $ mkdir /usr/local/majordomo
  3. 创建安装目录

    $ mkdir /usr/local/majordomo
  4. 修改 Makefile

    Edit the Makefile, defining where Perl and the C compiler are, the Majordomo home directory (chosen in step 2), the location of the manual pages, the user and group that Majordomo will run under, and the permissions for the various files and directories. If running on a non-POSIX system, comment out the POSIX SECTION in the Makefile. Under POSIX, wrapper must be setuid "root", even if the programs will be running as something other than "root" (i.e., "daemon"), or it won't work. The symptom of this is that Perl starts complaining about security violations and "unsafe usages".

  5. 修改配置文件 majordomo.cf

    If this is a new install, copy sample.cf to majordomo.cf first.

    This .cf file is "require"ed into majordomo, so it needs to be valid Perl. Here are the important variables to set:

        $whereami		What machine am I on?
        $whoami		Who do users send requests to me as?
        $whoami_owner	Who is the owner of the above, for problems?
        $homedir		Where can I find my extra .pl files?
        $listdir		Where are the mailing lists?
        $log		Where do I write my log?
        $sendmail_command   Where the sendmail program resides.
        $mailer		What program and args do I use to send mail to the
        $bounce_mailer      What program and args do I use to send administrative
  6. make

    $ make wrapper
    $ make install
    $ make install-wrapper
  7. 增加单独的别名文件,由 majordomo 管理

    修改 sendmail.mc 配置文件,如下:

  8. 增加 majordomo 管理别名


    majordomo: "|/usr/local/majordomo/wrapper majordomo"
    owner-majordomo: root,
    majordomo-owner: root
    majordom: root


    $ touch /usr/local/majordomo/majordomo.aliases.db
    $ chmod 644 /usr/local/majordomo/majordomo.aliases.db
    $ newaliases
  9. 测试配置文件

    $ su - <another_user>    # 以其它用户身份登录,非 root,majordom 用户。
    $ cd /path/to/majordomo
    $ ./wrapper config-test
  10. 测试邮件列表功能

    $ touch /usr/local/majordomo/lists/test
    $ echo 'lists' | mail majordomo

    如果配置正确,就会收到 Majordomo,而非 Mailer-Daemon 发送的邮件,提示现在已有的邮件列表。目前只有一个邮件列表,就是我们创建的 test。

  11. 可能遇到的问题有:

    由于 sendmail 使用了 smrsh 作为 shell,导致 wrapper 程序不在 smrsh 允许之列,拒绝执行。 参见:Email Howto

    由于 lists 目录、别名文件、或者 majordomo 其它配置文件的权限设置太为宽松,导致 sendmail 拒绝执行。 参见:Email Howto

    邮件列表的名称必须是小写,且按照模式:"[a-z0-9_-]+" 组成。