2016年6月14日 星期二

CentOS7 postfix 2.10 openwebmail 3 安裝記錄

參考
http://www.wkb.idv.tw/moodle/mod/page/view.php?id=7831&lang=zh_tw



mkdir /home01


先把 yum 跟 wget 設 ftp proxy

wget ftp://openwebmail.org/pub/openwebmail/el7/openwebmail-el7.repo -e use_proxy=yes -e ftp_proxy=172.22.x.x:3128

vim /etc/yum.conf
加
proxy=http://172.22.x.x:3128

然後
yum update

yum --downloadonly --downloaddir=/usr/local/src install openwebmail perl-CGI-SpeedyCGI perl-Authen-PAM perl-HTML-Template

這時候有的東西是
openwebmail-2.54-1.el7.noarch.rpm               perl-Compress-Raw-Zlib-2.061-4.el7.x86_64.rpm
openwebmail-data-2.54-1.el7.noarch.rpm          perl-IO-Compress-2.061-2.el7.noarch.rpm
perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm

缺了
perl-CGI-SpeedyCGI
perl-Authen-PAM
perl-HTML-Template


SpeedyCGI  要從 EPEL 裝

參考
https://support.rackspace.com/how-to/install-epel-and-additional-repositories-on-centos-and-red-hat/

yum install epel-release
yum update


繼續安裝
rm -f openwebmail*.rpm  (把 2.54 的 openwebmail 砍掉 等等要抓新的)
rpm -Uvh *.rpm  (把其他的裝進去)
yum install perl-Authen-PAM perl-CGI-SpeedyCGI perl-HTML-Template


來裝本體
cd /var/www
wget http://openwebmail.acatysmoof.com/download/current/openwebmail-current.tar.gz -e use_proxy=yes -e ftp_proxy=172.22.x.x:3128

tar zxvf ./openwebmail-current.tar.gz

ln -s /var/www/data/openwebmail /var/www/html/openwebmail
cd /var/www/html/openwebmail/
ln -s redirect.html index.html
cp /usr/bin/speedy /usr/bin/speedy_suidperl
chmod 4555 /usr/bin/speedy_suidperl

cd /var/www/cgi-bin/openwebmail/
sed -i -e 's/perl -T/speedy_suidperl -T -- -T\/tmp\/speedy/' openwebmail*.pl

vim etc/openwebmail.conf


#ow_cgidir          /usr/local/www/cgi-bin/openwebmail
ow_cgidir               /var/www/cgi-bin/openwebmail

#ow_htmldir              /usr/local/www/data/openwebmail
ow_htmldir              /var/www/data/openwebmail

新增
mailspooldir            /var/spool/mail
use_homedirspools       yes


cd /var/www/cgi-bin/openwebmail/
cp defaults/dbm.conf .

改 /var/www/cgi-bin/openwebmail/etc/dbm.conf
dbm_ext .pag
dbmopen_ext none
dbmopen_haslock no


cd /var/www/cgi-bin/openwebmail/
chmod 777 ./misc/tools/wrapsuid/wrapsuid.pl ./misc/tools/wrapsuid/wrapsuid.pl /var/www/cgi-bin/openwebmail/openwebmail*.pl
chmod 660 ./misc/tools/wrapsuid/wrapsuid.pl
chmod 4755 openwebmail*.pl


touch /var/log/openwebmail.log
chown root.mail /var/log/openwebmail.log
chmod -R 777 /var/www/cgi-bin/openwebmail/etc/sessions/

然後改 /etc/postfix/main.cf

#inet_protocols = all
inet_protocols = ipv4

#inet_interfaces = localhost
inet_interfaces = all

#mydestination = $myhostname, localhost.$mydomain, localhost
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, webmail.$mydomain, *****.$mydomain

home_mailbox = Mailbox

mynetworks = 127.0.0.0/8, 192.168.0.0/24, 172.22.0.0/16, blahblah
relay_domains = $mydestination
myhostname = ms3.xxxxx
mydomain = xxxxx
myorigin = $mydomain


service postfix restart



出現
YOU HAVEN'T DISABLED SET-ID SCRIPTS IN THE KERNEL YET!
cd /var/www/cgi-bin/openwebmail/
chmod 4755 openwebmail*.pl

./openwebmail-tool.pl --init

出現

登入失敗︰系統確認錯誤。
請返回然後 再試一次.

cd /var/www/cgi-bin/openwebmail/
cp defaults/auth_unix.conf .
vim auth_unix.conf

passwdfile_plaintext    /etc/passwd
#passwdfile_encrypted   /etc/master.passwd
passwdfile_encrypted    /etc/shadow
#passwdmkdb             /usr/sbin/pwd_mkdb
passwdmkdb              none
check_expire            no
check_nologin           no
#check_shell            no
check_shell            yes

service httpd restart


錯誤訊息觀察

Perl 直譯器產生的問題
/var/log/httpd/error.log

openwebmail 自己的問題
/var/log/openwebmail.log

Postfix 寄信的問題
/var/log/maillog








設定  dovecot

/etc/dovecot/dovecot.conf

#protocols = imap pop3 lmtp
protocols = pop3

#listen = *, ::
listen = *

/etc/dovecot/conf.d/

10-auth.conf

#disable_plaintext_auth = yes
disable_plaintext_auth = no

10-logging.conf

#mail_debug = no
mail_debug = yes

(  log 位置預設在 /var/log/maillog . 可以用 doveadm log find 確認)

10-mail.conf

#mail_location = 
mail_location = mbox:~/imap:INBOX=~/Mailbox

10-ssl.conf

#ssl = required
ssl = no




改 hostname

/etc/hosts

用 NetworkManager 的話 可以用


hostnamectl set-hostname server1.cyberciti.biz --static
 systemctl restart systemd-hostnamed
hostnamectl status




SMTP 指令測試

http://www.yuki-onna.co.uk/email/smtp.html

telnet mail.domain.ext 25

HELO local.domain.name
MAIL FROM: mail@domain.ext
RCPT TO: mail@otherdomain.ext

DATA
Subject:-type subject here-
- MAIL_BODY -
.
QUIT

在 openwebmail.conf 裡面可以把 webdisk / sshterm 等等的關掉 . 可參考 defaults/openwebmail.conf



============END===========