Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7683366
  • 博文数量: 637
  • 博客积分: 10265
  • 博客等级: 上将
  • 技术积分: 6165
  • 用 户 组: 普通用户
  • 注册时间: 2004-12-12 22:00
文章分类

全部博文(637)

文章存档

2011年(1)

2010年(1)

2009年(3)

2008年(12)

2007年(44)

2006年(156)

2005年(419)

2004年(1)

分类:

2005-12-02 23:06:31

Liferay Portal Enterprise can integrate with Washington IMAP+Sendmail, Cyrus IMAP+Postfix, and Dovecot+Postfix. Support for integration with Microsoft Exchange and other IMAP servers are planned and will be implemented in the near future.

The portal synchronizes with the mail server's user authentication by adding a mail server account when a portal account is added, deleting a mail server account when a portal account is deleted, and updating a mail server account when a portal account is updated. To do this, the portal must have privileges to modify and to update the mail server's user database.

The portal must also keep track of how email addresses map to certain accounts. For example, in the default installation, the portal maps the user id liferay.com.1 to the email address test@liferay.com.

One possible deployment scenario is to run the mail EJBs on the mail server and run the portal EJBs on the web server. In this case, the mail server and web server are two different machines. The portal EJBs will give abstract commands (add/delete/update user) to the remote mail EJBs to carry out. The mail EJBs then run the appropriate system commands for the specific mail server and operating system.

Another possible deployment scenario is to have the mail EJBs and portal EJBs run on the same machine. This can all be configured by editing portal.properties.

Users access their email through an IMAP server. Access is limited to IMAP so that the portal does not have to be programmed to know where to persist the mail.

  1. Washington IMAP+Sendmail
  2. Cyrus IMAP+Postfix
  3. Dovecot+Postfix
  4. Microsoft Exchange
  1. Washington IMAP+Sendmail

    1. Install and on your mail server. Expect allows you to add, delete, or update users in one command. An example script for Red Hat is included in /mail-ejb/scripts/redhat.

    2. Configure /portal-ejb/classes/portal.properties for your mail server.

    3. Follow the instructions from this on our forums.

  2. Cyrus IMAP+Postfix

    1. Install .

      For a minimal installation, choose to install a custom server. Deselect all packages groups. Select the package groups: Text-based Internet, Mail Server, DNS Name Server, FTP Server, MySQL Database, Network Servers, Development Tools, Legacy Software Development, Administration Tools, and System Tools.

      Make sure the following RPMs are also selected. The packages cyrus-imapd and cyrus-imapd-utils are only available in Fedora Core 2 and Fedora Core 4. They were not part of Fedora Core 1 and needed to be compiled manually. In Fedora Core 4, they were moved to Extras and you will need to use yum to install these packages.

      Mail Server: +cyrus-imapd, +cyrus-imapd-utils

      MySQL Database: +mysql-server

      Development Tools: +expect

    2. Update Fedora. This may take a while even if you have a fast connection.

      rpm --import /usr/share/rhn/RPM-GPG-KEY-fedora
      yum list
      yum upgrade


    3. Turn off Sendmail.

      chkconfig --level 3 sendmail off
      /etc/rc.d/init.d/sendmail stop


    4. Edit /etc/sysconfig/saslauthd.

      Replace MECH=shadow with MECH=pam.

      Turn on Cyrus SASL.

      chkconfig --level 3 saslauthd on
      /etc/rc.d/init.d/saslauthd start


    5. Download Cyrus IMAP. If you are using Fedora Core 2 or later, you can use the RPMs from Fedora: cyrus-imapd and cyrus-imapd-utils. If you are using Fedora Core 1 or an earlier version of Red Hat, download and build the RPM for your environment from the source distribution.

      Build Cyrus IMAP.

      rpmbuild --rebuild cyrus-imapd-2.1.16-6.src.rpm

      Install Cyrus IMAP.

      rpm -i cyrus-imapd-2.1.16-6.i386.rpm
      rpm -i cyrus-imapd-utils-2.1.16-6.i386.rpm


      Turn on Cyrus IMAP.

      chkconfig --level 3 cyrus-imapd on
      /etc/rc.d/init.d/cyrus-imapd start


    6. Download the source distribution of .

      Install Postfix with support for MySQL and Cyrus SASL.

      rpm -ivh postfix-2.1.6-1.src.rpm

      cd /usr/src/redhat/SOURCES

      bash

      export POSTFIX_MYSQL_REDHAT=1
      export POSTFIX_SASL=2
      export POSTFIX_TLS=1

      sh make-postfix.spec

      exit

      cd /usr/src/redhat/SPECS

      rpmbuild -ba postfix.spec

      cd /usr/src/redhat/RPMS/i386

      rpm -i --force postfix-2.1.6-1.mysql.sasl2.tls.fc4.i386.rpm


    7. Download the source distribution of .

      Install PAM MySQL.

      rpm -ivh pam_mysql-0.5-0.src.rpm

      cd /usr/src/redhat/SPECS

      rpmbuild -ba pam_mysql.spec

      cd /usr/src/redhat/RPMS/i386

      rpm -i pam_mysql-0.5-0.i386.rpm


    8. Copy /mail-ejb/scripts/fedora/cyrus/mysql_virtual.cf to /etc/postfix/mysql_virtual.cf. Modify mysql_virtual.cf to point to your MySQL database.

      Edit /etc/postfix/virtual. Add the line yourdomain.com anything for each virtual domain that Postfix will manage. A correspending entry is needed in the MySQL database so that email to postmaster@yourdomain.com can be delivered to a Cyrus IMAP account.

      Transform /etc/postfix/virtual to a format Postfix can read.

      postmap /etc/postfix/virtual

      Edit /etc/postfix/master.cf. Replace the two instances of /cyrus/bin/deliver with /usr/lib/cyrus-imapd/deliver. Add these two lines:

      procmail  unix  -       n       n       -       -       pipe
        flags=R user=cyrus argv=/usr/bin/procmail -t -m USER=${user} EXTENSION=${extension} /home/cyrus/procmailrc

      Edit /etc/postfix/main.cf. Add these lines:

      #
      # Custom Settings
      #

      mynetworks = 127.0.0.0/8, 192.168.0.0/16, 128.135.12.7/32

      mailbox_command = /usr/bin/procmail -t -a "$EXTENSION"
      mailbox_transport = procmail

      virtual_maps = hash:/etc/postfix/virtual, mysql:/etc/postfix/mysql_virtual.cf

      smtpd_recipient_restrictions = permit_mynetworks, check_client_access hash:/etc/postfix/pop-before-smtp, check_relay_domains

      Set mynetworks to the IPs that are allowed to connect to Postfix.

      Turn on Postfix.

      chkconfig --level 3 postfix on
      /etc/rc.d/init.d/postfix start


    9. Copy /mail-ejb/scripts/fedora/cyrus/procmailrc to /home/cyrus/procmailrc. Make sure the cyrus user can access the script.

      chown cyrus:mail /home/cyrus
      chown cyrus:mail /home/cyrus/procmailrc.


      Copy /mail-ejb/scripts/fedora/cyrus/cyrus_adduser to /usr/bin/cyrus_adduser. Edit cyrus_adduser and replace localhost with the mail server's host name. Make sure the script can be executed.

      chmod u+x /usr/bin/cyrus_adduser.

      Copy /mail-ejb/scripts/fedora/cyrus/cyrus_userdel to /usr/bin/cyrus_userdel. Edit cyrus_userdel and replace localhost with the mail server's host name. Make sure the script can be executed.

      chmod u+x /usr/bin/cyrus_userdel.

      Note: If you copy cyrus_adduser and cyrus_userdel from a Windows environment to a Linux environment, you need to run dos2unix cyrus_adduser to convert the file so that Linux can read the file correctly.

    10. Edit /etc/pam.d/pop so that POP authentication is checked via MySQL. Remove the current lines and add these lines:

      #%PAM-1.0
      auth sufficient pam_mysql.so user=dbuser passwd=dbpassword host=127.0.0.1 db=cyrus table=CyrusUser usercolumn=userId passwdcolumn=password_ crypt=0

      account required pam_mysql.so user=dbuser passwd=dbpassword host=127.0.0.1 db=cyrus table=CyrusUser usercolumn=userId passwdcolumn=password_ crypt=0

      Edit /etc/pam.d/imap so that IMAP authentication is checked via MySQL. Remove the current lines and add these lines:

      #%PAM-1.0
      auth sufficient pam_mysql.so user=dbuser passwd=dbpassword host=127.0.0.1 db=cyrus table=CyrusUser usercolumn=userId passwdcolumn=password_ crypt=0

      account required pam_mysql.so user=dbuser passwd=dbpassword host=127.0.0.1 db=cyrus table=CyrusUser usercolumn=userId passwdcolumn=password_ crypt=0

    11. Turn on MySQL.

      chkconfig --level 3 mysqld on
      /etc/rc.d/init.d/mysqld start


      Configure MySQL so that it can be accessed by the username dbuser and password dbpassword.

      use mysql;

      insert into user values ('127.0.0.1', "dbuser", password("dbpassword"), "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y");


      Create the database and tables that will be used to authenticate IMAP users.

      create database cyrus;
      use cyrus;

      create table CyrusUser (
      userId varchar(75) not null primary key,
      password_ varchar(75) not null
      );

      create table CyrusVirtual (
      emailAddress varchar(75) not null primary key,
      userId varchar(75) not null
      );


      The Expect scripts cyrus_adduser and cyrus_userdel that are used to add and delete Cyrus IMAP users require a default cyrus user to authenticate with.

      insert into CyrusUser (userId, password_) values ('cyrus', 'cyrus_password');

      Every virtual domain requires a postmaster@yourdomain.com entry so that email to postmaster@yourdomain.com can be delivered to a Cyrus IMAP account.

      insert into CyrusVirtual (emailAddress, userId) values ('postmaster@yourdomain.com', 'your_domain_1');

      Create a default account for your_domain_1.

      insert into CyrusUser (userId, password_) values ('your_domain_1', 'your_password');

      insert into CyrusVirtual (emailAddress, userId) values ('joe.blogs@yourdomain.com', 'your_domain_1');

      quit;

      cyrus_adduser cyrus_password your_domain_1


    12. Turn on SpamAssassin.

      chkconfig --level 3 spamassassin on
      /etc/rc.d/init.d/spamassassin start


    13. Download .

      Install ClamAV.

      rpm -i clamav-0.86.1-1.i386.rpm

      Turn on ClamAV.

      chkconfig --level 3 clamd on
      /etc/rc.d/init.d/clamd start


      Download .

      Install ClamAssassin.

      gunzip clamassassin-1.2.2.tar.gz
      tar xvf clamassassin-1.2.2.tar

      cd clamassassin-1.2.2

      ./configure
      cp clamassassin /usr/local/bin


      Edit /usr/local/bin/clamassassin.

      Set SUBJECTHEAD to "[VIRUS] ".

    14. Copy /mail-ejb/scripts/fedora/cyrus/procmail_vacation to /usr/local/bin/procmail_vacation. Make sure the script can be executed.

      chmod u+x /usr/local/bin/procmail_vacation.

      Download .

      Install SendEmail.

      gunzip sendEmail-v1.52.tar.gz
      tar xvf sendEmail-v1.52.tar

      cd sendEmail-v1.52

      chmod u+x sendEmail
      chown cyrus:mail sendEmail
      cp sendEmail /usr/local/bin


    15. Download the source distribution of .

      Pop-before-smtp requires perl-TimeDate and perl-Net-Netmask.

      Install perl-TimeDate from the distributed RPM.

      Install perl-Net-Netmask.

      perl -MCPAN -e 'install Net::Netmask'

      Install Pop-before-smtp.

      gunzip pop-before-smtp-1.38.tar.gz
      tar xvf pop-before-smtp-1.38.tar

      cd pop-before-smtp-1.38

      chown root:root *
      cp pop-before-smtp.init /etc/rc.d/init.d/pop-before-smtp
      cp pop-before-smtp /usr/sbin/
      cp pop-before-smtp-conf.pl /etc


      Edit /etc/pop-before-smtp-conf.pl by uncommenting and modifying certain sections so it matches the following information.

      $dbfile = '/etc/postfix/pop-before-smtp';

      $grace = 120*60;

      # Set the log file we will watch for pop3d/imapd records.
      $file_tail{'name'} = '/var/log/maillog';

      # For Cyrus (including a tweak for IP addrs that don't resolve):
      $pat = '^(... .. ..:..:..) S+ (?:pop3d|imapd)[d+]: ' .

      Turn on Pop-before-smtp.

      chkconfig --level 3 pop-before-smtp on
      /etc/rc.d/init.d/pop-before-smtp start


    16. Restart your mail server.

      shutdown -r now

  3. Dovecot+Postfix

    1. Follow the instructions from this on our forums.

  4. Microsoft Exchange

    1. Coming soon.
阅读(3590) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~