2011年11月2日 星期三

<筆記>Fedora 14 + Openwebmail 3.0 beta4 安裝

本文帳號登入方式與Active Directory做整合,整合方式不在本文討論之中

依Openwebmail 3.0 beta4網路上教學進行安裝
Overview
========
Fedora 14 ships with perl 5.12.2, which no longer directly supports
setuid. OpenWebMail can still run on this operating system with the
use of simple c wrappers to enable setuid, even under SELinux.

Check Mimimum Requirements
==========================
- gcc or cc      (which gcc)
- iconv          (iconv --version)
- Text::Iconv    (perl -MText::Iconv -e '{1}')
- HTML::Template (perl -MHTML::Template -e '{1}')

Quick Install for Fedora 14
==========================
# become root
su -

# make tmp dir to unpack openwebmail
mkdir /tmp/openwebmail
cd /tmp/openwebmail

# download -current version
wget http://openwebmail.acatysmoof.com/download/current/openwebmail-current.tar.gz

# unpack it
tar -xvzBpf openwebmail-current.tar.gz

# put it in the apache area
mv cgi-bin/openwebmail /var/www/cgi-bin/
mv data/openwebmail /var/www/html

# cleanup
cd /var/www/cgi-bin/openwebmail
rm -rf /tmp/openwebmail

# create the logfile
touch /var/log/openwebmail.log
chown root:mail /var/log/openwebmail.log

# ONLY if you do not have an index file - use the provided redirect file
cp -p /var/www/html/openwebmail/redirect.html /var/www/html/index.html

# update openwebmail.conf
vi etc/openwebmail.conf
change:
ow_cgidir               /usr/local/www/cgi-bin/openwebmail
ow_cgiurl               /cgi-bin/openwebmail
ow_htmldir              /usr/local/www/data/openwebmail
ow_htmlurl              /openwebmail

to:
ow_cgidir               /var/www/cgi-bin/openwebmail
ow_cgiurl               /cgi-bin/openwebmail
ow_htmldir              /var/www/html/openwebmail
ow_htmlurl              /openwebmail

# create an auth_unix.conf config file for Fedora
cp etc/defaults/auth_unix.conf etc/

# update the auth_unix.conf file
vi etc/auth_unix.conf
change:
passwdfile_plaintext    /etc/passwd
passwdfile_encrypted    /etc/master.passwd
passwdmkdb              /usr/sbin/pwd_mkdb

to:
passwdfile_plaintext    /etc/passwd
passwdfile_encrypted    /etc/shadow
passwdmkdb              none

# create a dbm.conf file for Fedora
cp etc/defaults/dbm.conf etc/

# update the dbm.conf config file
vi etc/dbm.conf
change:
dbm_ext           .db
dbmopen_ext       none
dbmopen_haslock   no

to:
dbm_ext           .pag
dbmopen_ext       none
dbmopen_haslock   no

# initialize openwebmail
# (.pl files will automatically be C wrapped if perl version is 5.12 or higher)
./openwebmail-tool.pl --init

# update all the openwebmail files to run safely under SELinux
# skip this step if SELinux is disabled on your system
chcon -u system_u /var/log/openwebmail.log
chcon -t httpd_sys_script_rw_t /var/log/openwebmail.log
restorecon -R /var/www/{html,cgi-bin}/openwebmail
chcon -R -t httpd_sys_content_t auth etc lib misc modules quota shares
chcon -t httpd_unconfined_script_exec_t /var/www/cgi-bin/openwebmail/openwebmail*

# setuid the .pl files
chmod 4755 openwebmail*.pl

# ONLY if you are upgrading from a previous version of OpenWebMail
# do you need to reindex all existing users databases to the new format
# This step can take a while and should be done while no one is accessing
# the system. Access from an old version will force the db to roll back
# to the old format
./openwebmail-tool.pl --alluser --index

# go to the openwebmail page in your browser
http://your.domain/cgi-bin/openwebmail/openwebmail.pl

Questions?
==========
http://openwebmail.acatysmoof.com/archive
 裝完後還要裝兩個套件,分別為Authen::PAM及HTML::Template
#perl -MCPAN -e 'install HTML::Template'
#cpan -i Authen::PAM
安裝完之後,修改幾個地方

vi /var/www/cgi-bin/openwebmail/etc/auth_pam.conf
servicename             openwebmail
passwdfile_plaintext    /etc/passwd

vi /etc/pam.d/openwebmail
#%PAM-1.0
auth sufficient pam_winbind.so
auth required pam_nologin.so
auth include system-auth
account include system-auth
session include system-auth
account sufficient pam_winbind.so

另外原教學安裝部份有一個地方漏寫了
mkdir -p /var/www/data
cp -rp /var/www/html/openwebmail/* /var/www/data
(或是用ln也可以的)