• FreeBSD装openwebmail

    post by Holmesian / 2009-4-17 14:14 Friday
    搞了一个多小时  

    终于搞定了webmail    刚好域名也解析成功

    mail.ecjtu.net
    在FreeBSD下装OpenWebmail的资料还是比较少的

    其实配置文件也挺简单的   看看就应该OK 了




    [quote]ecjtu# install make
    usage: install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
                   [-o owner] file1 file2
           install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
                   [-o owner] file1 ... fileN directory
           install -d [-v] [-g group] [-m mode] [-o owner] directory ...
    ecjtu# make install
    ===>  Found saved configuration for openwebmail-2.53
    => openwebmail-2.53.tar.gz doesn't seem to exist in /usr/ports/distfiles/.
    => Attempting to fetch from http://ports.cn.freebsd.org/.
    openwebmail-2.53.tar.gz                       100% of 8678 kB  851 kBps 00m00s
    ===>  Extracting for openwebmail-2.53
    => MD5 Checksum OK for openwebmail-2.53.tar.gz.
    => SHA256 Checksum OK for openwebmail-2.53.tar.gz.
    ===>   openwebmail-2.53 depends on file: /usr/local/bin/perl5.8.8 - found

    ===>  Patching for openwebmail-2.53
    ===>   openwebmail-2.53 depends on file: /usr/local/bin/perl5.8.8 - found
    ===>   openwebmail-2.53 depends on file: /usr/local/bin/perl5.8.8 - found
    ===>  Configuring for openwebmail-2.53
    ===>  Installing for openwebmail-2.53
    ===>   openwebmail-2.53 depends on file: /usr/local/lib/perl5/site_perl/5.8.8/mach/Text/Iconv.pm - found
    ===>   openwebmail-2.53 depends on file: /usr/local/lib/perl5/site_perl/5.8.8/mach/MIME/Base64.pm - found
    ===>   openwebmail-2.53 depends on file: /usr/local/bin/perl5.8.8 - found
    ===>   Generating temporary packing list
    ===>  Checking if mail/openwebmail already installed
    Fixing /usr/local/www/cgi-bin/openwebmail/openwebmail-abook.pl
    Fixing /usr/local/www/cgi-bin/openwebmail/openwebmail-advsearch.pl
    Fixing /usr/local/www/cgi-bin/openwebmail/openwebmail-cal.pl
    Fixing /usr/local/www/cgi-bin/openwebmail/openwebmail-folder.pl
    Fixing /usr/local/www/cgi-bin/openwebmail/openwebmail-main.pl
    Fixing /usr/local/www/cgi-bin/openwebmail/openwebmail-prefs.pl
    Fixing /usr/local/www/cgi-bin/openwebmail/openwebmail-read.pl
    Fixing /usr/local/www/cgi-bin/openwebmail/openwebmail-saprefs.pl
    Fixing /usr/local/www/cgi-bin/openwebmail/openwebmail-send.pl
    Fixing /usr/local/www/cgi-bin/openwebmail/openwebmail-spell.pl
    Fixing /usr/local/www/cgi-bin/openwebmail/openwebmail-tool.pl
    Fixing /usr/local/www/cgi-bin/openwebmail/openwebmail-vdomain.pl
    Fixing /usr/local/www/cgi-bin/openwebmail/openwebmail-viewatt.pl
    Fixing /usr/local/www/cgi-bin/openwebmail/openwebmail.pl
    Fixing /usr/local/www/cgi-bin/openwebmail/openwebmail-webdisk.pl

    creating db /usr/local/www/cgi-bin/openwebmail/etc/maps/b2g ...done.
    creating db /usr/local/www/cgi-bin/openwebmail/etc/maps/g2b ...done.
    creating db /usr/local/www/cgi-bin/openwebmail/etc/maps/lunar ...done.

    Creating UTF-8 locales...
    langconv ar_AE.CP1256 -> ar_AE.UTF-8
    langconv ar_AE.ISO8859-6 -> ar_AE.UTF-8
    langconv bg_BG.CP1251 -> bg_BG.UTF-8
    langconv ca_ES.ISO8859-1 -> ca_ES.UTF-8
    langconv cs_CZ.ISO8859-2 -> cs_CZ.UTF-8
    langconv da_DK.ISO8859-1 -> da_DK.UTF-8
    langconv de_DE.ISO8859-1 -> de_DE.UTF-8
    langconv el_GR.ISO8859-7 -> el_GR.UTF-8
    langconv en_US.ISO8859-1 -> en_US.UTF-8
    langconv es_AR.ISO8859-1 -> es_AR.UTF-8
    langconv fi_FI.ISO8859-1 -> fi_FI.UTF-8
    langconv fr_FR.ISO8859-1 -> fr_FR.UTF-8
    langconv he_IL.CP1255 -> he_IL.UTF-8
    langconv hr_HR.ISO8859-2 -> hr_HR.UTF-8
    langconv hu_HU.ISO8859-2 -> hu_HU.UTF-8
    langconv id_ID.ISO8859-1 -> id_ID.UTF-8
    langconv it_IT.ISO8859-1 -> it_IT.UTF-8
    langconv ko_KR.eucKR -> ko_KR.UTF-8
    langconv lt_LT.CP1257 -> lt_LT.UTF-8
    langconv nl_NL.ISO8859-1 -> nl_NL.UTF-8
    langconv no_NO.ISO8859-1 -> no_NO.UTF-8
    langconv pl_PL.ISO8859-2 -> pl_PL.UTF-8
    langconv pt_BR.ISO8859-1 -> pt_BR.UTF-8
    langconv pt_PT.ISO8859-1 -> pt_PT.UTF-8
    langconv ro_RO.ISO8859-2 -> ro_RO.UTF-8
    langconv ru_RU.KOI8-R -> ru_RU.UTF-8
    langconv sk_SK.ISO8859-2 -> sk_SK.UTF-8
    langconv sl_SI.CP1250 -> sl_SI.UTF-8
    langconv sr_CS.ISO8859-2 -> sr_CS.UTF-8
    langconv sv_SE.ISO8859-1 -> sv_SE.UTF-8
    langconv th_TH.TIS-620 -> th_TH.UTF-8
    langconv tr_TR.ISO8859-9 -> tr_TR.UTF-8
    langconv uk_UA.KOI8-U -> uk_UA.UTF-8
    ...done.

    OS: FreeBSD 7.0-RELEASE i386
    Perl: 5.008008
    WebMail: OpenWebMail 2.53 20080123

    No site report sent.

    Thank you.

    ===>   Registering installation for openwebmail-2.53
    ===> SECURITY REPORT:
          This port has installed the following binaries which execute with
          increased privileges.
    /usr/local/www/cgi-bin/openwebmail/openwebmail-saprefs.pl
    /usr/local/www/cgi-bin/openwebmail/openwebmail.pl
    /usr/local/www/cgi-bin/openwebmail/openwebmail-viewatt.pl
    /usr/local/www/cgi-bin/openwebmail/openwebmail-prefs.pl
    /usr/local/www/cgi-bin/openwebmail/openwebmail-folder.pl
    /usr/local/www/cgi-bin/openwebmail/openwebmail-webdisk.pl
    /usr/local/www/cgi-bin/openwebmail/openwebmail-tool.pl
    /usr/local/www/cgi-bin/openwebmail/openwebmail-read.pl
    /usr/local/www/cgi-bin/openwebmail/openwebmail-abook.pl
    /usr/local/www/cgi-bin/openwebmail/openwebmail-send.pl
    /usr/local/www/cgi-bin/openwebmail/openwebmail-cal.pl
    /usr/local/www/cgi-bin/openwebmail/openwebmail-main.pl
    /usr/local/www/cgi-bin/openwebmail/openwebmail-advsearch.pl
    /usr/local/www/cgi-bin/openwebmail/openwebmail-spell.pl
    /usr/local/www/cgi-bin/openwebmail/openwebmail-vdomain.pl

          If there are vulnerabilities in these programs there may be a security
          risk to the system. FreeBSD makes no guarantee about the security of
          ports included in the Ports Collection. Please type 'make deinstall'
          to deinstall the port if this is a concern.

          For more information, and contact details about the security
          status of this software, see the following webpage:
    http://openwebmail.org/


    [/quote]



    #ee /usr/local/www/cgi-bin/openwebmail/etc/defaults/auth_unix.conf
    显示如下的配置信息:
    [quote]# config file for auth_unix.pl
    #

    # passwdfile_plaintext
    # -----------------------------------------------------------------------
    # the plaintext file containing all usernames and related uid, gid,
    # homedir, shell info. The default is /etc/passwd on most unix systems.

    # passwdfile_encrypted
    # -----------------------------------------------------------------------
    ……………………
    ……………………
    # ***** IMPORTANT *****
    #
    # If you are going to use this option for check then the webmail on your
    # Cobalt MUST be accessed via the the FQDN 'http://HOST.DOMAIN.COM'.
    # Using 'http://DOMAIN.COM' will fail the user security check.

    # change_smbpasswd
    # -----------------------------------------------------------------------
    # if this option is set to yes, openwebmail will also change the
    # smbpasswd after changing the unix password successfully

    passwdfile_plaintext    /etc/passwd
    passwdfile_encrypted    /etc/shadow
    passwdmkdb             none
    check_expire            no
    check_nologin           no
    check_shell             no
    check_cobaltuser        no
    change_smbpasswd        no[/quote]
    将passwdfile_encrypted设置为/etc/shadow
    将passwdmkdb设置为none


    第四步:配置openwebmail.conf。
    运行命令
    #ee /usr/local/www/cgi-bin/openwebmail/etc/openwebmail.conf
    显示如下的配置文件:

    [quote]
    #
    # Open WebMail configuration file
    #
    # This file contains just the overrides from defaults/openwebmail.conf,
    # please make all changes to this file.
    #
    # This file sets options for all domains and all users.
    # To set options on per domain basis, please put them in sites.conf/domainname
    # To set options on per user basis, please put them in users.conf/username
    #
    # Please refer to openwebmail.conf.help for the description of each option
    #
    domainnames    auto
    domainnames    www.holmesian.org,mail.ecjtu.net
    auth_module    auth_unix.pl
    mailspooldir    /var/mail
    ow_cgidir    /usr/local/www/cgi-bin/openwebmail
    ow_cgiurl    .                                       [color=#4169E1]//这里是虚拟目录需要用到的,如果放在apache使用虚拟目录,一定要改成.[/color]
    ow_htmldir    /usr/local/www/data/openwebmail
    ow_htmlurl    /                                 [color=#4169E1]//如果webmail出现URL跳转或者图片不能显示问题 大都和这里有关[/color]
    logfile      /var/log/openwebmail.log

    enable_viruscheck  no
    enable_spamcheck  no
    enable_learnspam  no

    default_iconset         Default
    default_fscharset       none

    <default_signature>
    --
    Open WebMail Project (http://openwebmail.org)
    </default_signature>[/quote]



    第五步:修改dbm.conf文件。
    运行命令
    #ee /usr/local/www/cgi-bin/openwebmail/etc/dbm.conf
    显示如下的配置文件:
    dbm_ext        .db
    dbmopen_ext    none
    dbmopen_haslock    no


    第六步:执行Openwebmail的初始化。
    运行命令:
    # /usr/local/www/cgi-bin/openwebmail/openwebmail-tool.pl  --init






    启动之后遇到一个问题
    openwebmail setuid root
    '/usr/local/www/cgi-bin/openwebmail/.openwebmail.pl' must setuid to root

    最后是这么解决的……
    chmod 4755  /usr/local/www/cgi-bin/openwebmail/openwebmail*.pl







    虚拟空间配置
    [quote]DocumentRoot /usr/local/www/cgi-bin/openwebmail
    ServerName mail.ecjtu.net
    AddHandler cgi-script .cgi .pl
    <Directory "/usr/local/www/cgi-bin/openwebmail">
    DirectoryIndex openwebmail.pl
    AllowOverride None
    Options ExecCGI indexes MultiViews
    allow from all
    Options +Indexes
    </Directory>[/quote]






    [quote]
    ecjtu# ./openwebmail.pl
    Pragma: no-cache
    Cache-control: no-cache,no-store
    Content-length: 6121
    Content-Type: text/html; charset=iso-8859-1

    <!-- 484: -->
    <html>

    <head>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
      <title> 04/17/2009 01:27:49 pm +0800 - en_US.ISO8859-1 - OpenWebMail </title>
      <link rel="shortcut icon" href="/images/openwebmail.ico">
    </head>

    <body background="/images/backgrounds/Globe.gif" bgcolor="#FFFFFF"  onhelp="window.open('/help/en_US.ISO8859-1/index.html', '_help'); return false;">

    <style type="text/css">
    <!--
    body
    {
        background-image: url(/images/backgrounds/Globe.gif);
        background-repeat: repeat;
        font-family: Arial, Helvetica, sans-serif;
        font-size: 10pt;
    }
    th { font-family: Arial, Helvetica, sans-serif; font-size: 10pt; font-weight: bold; background-color: #D3DCE3; }
    td { font-family: Arial, Helvetica, sans-serif; font-size: 10pt; }
    td.msgbody { font-family:  Arial, Helvetica, sans-serif; font-size: 10pt; }
    form { font-family: Arial, Helvetica, sans-serif; font-size: 10pt; margin-bottom: 0; }
    input.mono { font-family: monospace; font-size: 9pt; }
    select.mono { font-family: monospace; font-size: 9pt; }
    h1 { font-family: Arial, Helvetica, sans-serif; font-size: 16pt; font-weight: bold; }
    A:link { font-family: Arial, Helvetica, sans-serif; font-size: 10pt; text-decoration: none; color: blue; }
    A:visited { font-family: Arial, Helvetica, sans-serif; font-size: 10pt; text-decoration: none; color: blue; }
    A:hover { font-family: Arial, Helvetica, sans-serif; font-size: 10pt; text-decoration: none; color: red; }
    A.msgbody:link { font-family:  Arial, Helvetica, sans-serif; font-size: 10pt; text-decoration: none; color: blue; }
    A.msgbody:visited { font-family:  Arial, Helvetica, sans-serif; font-size: 10pt; text-decoration: none; color: blue; }
    A.msgbody:hover { font-family:  Arial, Helvetica, sans-serif; font-size: 10pt; text-decoration: none; color: red; }
    .medtext { font-size: 9pt; }
    .smalltext { font-size: 8pt; }
    .smallblacktext { font-size: 8pt; color: #000000; }
    .smallcolortext { font-size: 8pt; color: #c00000; }
    .hilighttext { font-style: normal; font-weight: bold; background-color: #DCDCDC; }
    -->

    </style>

    <font face="Arial, Helvetica">
    <p align="center">
      <a href="http://openwebmail.org/"><img border="0" src="/images/openwebmail.gif"></a>
    </p>

    <table border="0" align="center" width="260" cellpadding="0" cellspacing="0">
    <tr>
      <td bgcolor="#3161bd" background="/images/bg-titleblue.gif">&nbsp;<font color="#FFFFFF" face="Arial, Helvetica" size="3"><b>Login</b></font></td>
    </tr>
    <tr>
      <td align="center" bgcolor="#3161bd">
        <table width="100%" cellpadding="0" cellspacing="1" border="0">
        <tr>
          <td bgcolor="#ffffff">
    <form method="post" action="//openwebmail.pl" enctype="multipart/form-data" name="login">

    <br>
            <table align="center" border="0" cellspacing="2" cellpadding="0">
            <tr>
              <td align="right" nowrap>UserID: </td>
              <td><input type="text" name="loginname"  size="14" onchange="focuspwd()" /></td>
            </tr>
            <tr>
              <td align="right" nowrap>Password: </td>
              <td><input type="password" name="password"  size="14" onchange="focusloginbutton()" /></td>
    <INPUT TYPE="hidden" NAME="logindomain" VALUE="">
            </tr>
            <tr>
              <td align="center" colspan="2">
                <table>
                <tr>
                  <td align="center"><input type="submit" name="loginbutton" value="Login" /></td>
                  <td align="center">
                    <table>
                    <tr>
                      <td><label><input type="checkbox" name="httpcompress" value="1" disabled="1" /></label></td>
                      <td><font size="1">HTTP<br>Compression</font></td>
                      <td><label><input type="checkbox" name="autologin" value="1" onclick="autologinhelp()" /></label></td>
                      <td><font size="1">Auto<br>Login</font></td>
                    </tr>
                    </table>
                  </td>
                </tr>
                </table>
              </td>
            </tr>
            </table>
    <br>
          </td>
    <div><input type="hidden" name=".cgifields" value="httpcompress"  /><input type="hidden" name=".cgifields" value="autologin"  /></div>
    </form>
        </tr>
        </table>
      </td>
    </tr>
    </table>

    <script language="javascript">
    <!--

       if (document.login.loginname.value == "") {
          document.login.loginname.focus()
       } else {
          document.login.password.focus()
       }

       function focuspwd() {
          document.login.password.focus();
          return(true);
       }

       function focusloginbutton() {
          document.login.loginbutton.focus();
          return (true);
       }

       function httpcompresshelp() {
          if (document.login.httpcompress.checked) {
             alert(
    "HTTP Compression can reduce the use of network bandwidth between your computer and the webmail server effectively, "+
    "but there are some compatibility issues:\n\n"+
    "1. some proxy servers only support HTTP compression via HTTP 1.1, "+
    "you may have to enable the HTTP1.1 support for proxy in your browser\n"+
    "2. some proxy servers don't support HTTP compression at all, "+
    "you may have to list the webmail server as directly connected in the proxy configuration of your browser.\n"+
    "3. some browsers have problems when using HTTP compression with SSL...\n"+
    "4. some browsers claim to support HTTP compression but actually not...\n\n"+
    "So if you encounter any problem, please login again with this checkbox unchecked.\n"
             );
          }
          return(true);
       }

       function autologinhelp() {
          if (document.login.autologin.checked) {
             alert(
    "When this feature is enabled, you may login into openwebmail without typing username/password "+
    "if you didn't do logout in your previous openwebmail session and that session is not timeout. "+
    "However, others may also auto login into your openwebmail account with this computer, "+
    "so please DO NOT enable this feature on a public computer\n"
             );
          }
          return(true);
       }

    //-->
    </script>
    <p align="center">
    <br>
    <a href="/openwebmail.html" target="_blank">OpenWebMail</a>
    version 2.53
    &nbsp;
    <a accesskey="H" href="/help/en_US.ISO8859-1/index.html" target="_help">Help?</a>

    <br>
    </p>
    </body>
    </html>[/quote]




    1./var/www/cgi-bin/openwebmail/etc/openwebmail.conf  
    修改domainnames                                                 bdqn.7766.org //默认是auto
    修改default_language zh_CN.GB2312
    修改default_timeoffset +0800
    修改default_iconset Cool3D.Chinese.Simplified              //图标改为中文式样
    修改ow_cgiurl          /webmail/cgi-bin/openwebmail   //注意虚拟目录要用得到

    2./var/www/cgi-bin/openwebmail/etc/defaults/openwebmail.conf

    修改smtpserver      222.220.162.23                   //修改为ATM主机地址
    修改authpop3_server 222.220.162.23                  //修改为ATM主机地址

    3./var/www/cgi-bin/openwebmail/etc/defaults/dbm.conf[只需修改3处]
    dbm_ext                         .db
    dbmopen_ext                 .db
    dbmopen_haslock         yes
    smtpserver             192.168.0.111 //添加SMTP服务器的IP地址

    #vi /etc/httpd/conf/httpd.conf

    AddHandler cgi-script .cgi .pl                   //可执行.pl代码

    Alias /webmail "/var/www/"                          //对应openwebmail.conf文件中ow_cgiurl值
    Alias /mail "/var/www/cgi-bin/openwebmail/openwebmail.pl"
    Alias /data "/var/www/data"                        //LOG图目录
    <Directory "/var/www/cgi-bin/openwebmail/openwebmail.pl">
        AllowOverride None
        Options ExecCGI indexes MultiViews
        Order allow,deny
        Allow from all
    </Directory>

    发表评论: