1. Installation
参考官文指导文件
How to install Open Webmail 2.54 on CentOS 8
============================================
By Thomas Chung <[email protected]>
Last Update 2020.12.10
## Open Webmail 2.54 Test for CentOS 8
2020.12.07 - CentOS 8.3-2011 released
https://lists.centos.org/pipermail/centos-announce/2020-December/035874.html
2020.06.15 - CentOS 8.2-2004 released
https://lists.centos.org/pipermail/centos-announce/2020-June/035756.html
2020.01.15 - CentOS 8.1-1911 released
https://lists.centos.org/pipermail/centos-announce/2020-January/035599.html
2019.09.24 - CentOS 8.0-1905 released
https://lists.centos.org/pipermail/centos-announce/2019-September/023449.html
## Open Webmail 2.54 Patch for CentOS 8
2020.02.14 - Add el8_openwebmail-read.pl.patch
2020.01.19 - Add el8_openwebmail-abook.pl.patch
2019.11.05 - Rebuild Open Webmail 2.54 RPM pkgs for EL8
Build missing perl-Text-Iconv for EL8
Add 4 patches to be compatible with perl 5.26 for EL8
0. Install postfix and httpd if not installed
# dnf install postfix
# systemctl enable postfix && systemctl start postfix
# dnf install httpd
# systemctl enable httpd && systemctl start httpd
# firewall-cmd --permanent --zone=public --add-service=smtp
# firewall-cmd --permanent --zone=public --add-service=http
# firewall-cmd --reload
# firewall-cmd --list-services
1. Download repo file for EL8
# curl -s ftp://openwebmail.org/pub/openwebmail/el8/openwebmail-el8.repo -o /etc/yum.repos.d/openwebmail-el8.repo
2. Install openwebmail for EL8
# dnf install openwebmail
3. Install gcc if not installed
# dnf install gcc
4. Run openwebmail-tool
# /usr/local/bin/openwebmail-tool --init
The version of Perl on your system (5.026003) does not support set user id.
Attempting to wrap the openwebmail perl files in a C wrapper to enable set
user id capability...
Found C compiler /usr/bin/cc
wrapping file: openwebmail-abook.pl...done
wrapping file: openwebmail-advsearch.pl...done
wrapping file: openwebmail-cal.pl...done
wrapping file: openwebmail-folder.pl...done
wrapping file: openwebmail-main.pl...done
wrapping file: openwebmail-prefs.pl...done
wrapping file: openwebmail-read.pl...done
wrapping file: openwebmail-saprefs.pl...done
wrapping file: openwebmail-send.pl...done
wrapping file: openwebmail-spell.pl...done
wrapping file: openwebmail-tool.pl...done
wrapping file: openwebmail-vdomain.pl...done
wrapping file: openwebmail-viewatt.pl...done
wrapping file: openwebmail-webdisk.pl...done
wrapping file: openwebmail.pl...done
creating db /var/www/cgi-bin/openwebmail/etc/maps/b2g ...done.
creating db /var/www/cgi-bin/openwebmail/etc/maps/g2b ...done.
creating db /var/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.
Welcome to the OpenWebMail!
This program is going to send a short message back to the developer,
so we could have the idea that who is installing and how many sites are
using this software, the content to be sent is:
OS: Linux 4.18.0-80.11.2.el8_0.x86_64 x86_64
Perl: 5.026003
WebMail: OpenWebMail 2.54 20141206
Send the site report?(Y/n) Y
sending report...
# /usr/local/bin/openwebmail-tool --fix
Permission and Ownership for openwebmail files have been fixed!
5. Disable selinux and reboot
# vi /etc/selinux/config
SELINUX=disabled
6. Reload httpd
# systemctl reload httpd
7. Login to webmail URL with non-root user account
http://{hostname}/webmail
2. Configuration
Modify the configuration file
vi /var/www/cgi-bin/openwebmail/etc/openwebmail.conf
- domainnames auto changed to tsmt.com
- default_language en changed to zh_CN.GB2312
- default_iconset Cool3D.English changed to support Chinese Cool3D.Chinese.Simplified
3. Start
service httpd restart
4. Account
openwebmail uses system user and password as login authentication
5. Access
Log in with root username and password, the following error appears:
OpenWebMail ERROR:
Cannot write to /var/log/openwebmail.log! (Permission denied)
Check the folder and file permissions, there is no problem, and even modified it with CHMOD (chmod 777 /var/log/openwebmail.log), the problem still exists.
By editing the file:
vi /var/log/openwebmail.log
Sat Jan 23 22:22:51 2021 - [42810] (127.0.0.1) UNKNOWNUSER - send message - trying to connect to smtp server 127.0.0.1:25
Sat Jan 23 22:22:51 2021 - [42810] (127.0.0.1) UNKNOWNUSER - send message - connected to smtp server 127.0.0.1:25
Learned that the error was caused by no mailbox user.
List the user list: #cat /etc/passwd
Find the mailbox user: postfixuser:x:1006:1007::/home/postfixuser:/bin/bash
Registered name: Password: usrid:groopid::usrdir: command interpreter
Log in as this user, the problem remains the same.
The command execution chown postfixuser:postfixuser /var/log/openwebmail.log is invalid;
6. Solve the login problem
#groupadd mymailuser //建立新组 mymailuser
#useradd tsmusr
#passwd tsmusr
#usermod -a -G mymailuser tsmusr (加入新建组)
#cd /home
#mkdir tsmusr
#cd tsmusr
#mkdir mymail
#chmod 777 mymail
#cd /
#chown -R tsmusr:mymailuser /home/tsmusr
Restart the system, log in as the tsmusr user, the following screen appears, success. After the test is successful, as long as it is an account under centos (not necessarily joining a specific group), you can log in successfully.
7. After the above work is completed, I can only send mail but not receive mail. The work I have completed is as follows:
Postfix, dns, and openwebmail have the above three working foundations, I can create an email account on my mail server, such as: [email protected], and can use: http://mail.tsmt.com/webmail Send the mail.
Let's continue to install a tool Dovecot to receive emails. As for the mailing list, you need to install mailman. I don't need it for the time being, so I won't introduce it. If necessary, I will update this article later.
The installation of Dovecot is nothing new. My machine is already installed, so I won’t introduce it here. Let me talk about how to configure:
# vi /etc/dovecot/dovecot.conf
Find the following line, remove the previous comment and the last word
protocols = imap pop3 lmtp
listen = *
login_trusted_networks = 192.168.1.0/24
# vi /etc/dovecot/conf.d/10-ssl.conf
Change ssl = required to ssl = no
#vi /etc/dovecot/conf.d/10-auth.conf
把disable_plaintext_auth = yes改为disable_plaintext_auth = no
#vi /etc/dovecot/conf.d/10-master.conf
Modify this part as follows:
# Postfix smtp-auth
unix_listener /var/spool/postfix/private/auth {
mode = 0666
user = postfix
group = postfix
}
Set mail storage location
# vi /etc/dovecot/conf.d/10-mail.conf
mail_location = maildir:~/Maildir (same as postfix)
Restart the system
service dovecot reload或service dovecot start或service dovecot restart
After the above work is completed, postfix and dovecot can send and receive emails normally, but openwebmail can only send emails, not receive emails.
8. Problem solving
修改openwebmail 的一些配置文件
[root@ser defaults]# vim /var/www/cgi-bin/openwebmail/etc/defaults/dbm.conf
dbm_ext .db
dbmopen_ext .db
dbmopen_haslock yes
smtpserver 192.168.1.202
[root@ser defaults]# vim openwebmail.conf
domainnames tsmt.com
smtpserver 192.168.1.202
authpop3_server 192.168.1.202
再次初始化openwebmail
[root@ser defaults]#/usr/local/bin/openwebmail-tool --init
出现Y/N 时,按Y。
把Postfix+Dovecot+Openwebmail 三者个格式统一下就行了
1.postfix 配置 main.cf
# vi /etc/postfix/main.cf
mail_spool_directory = /var/spool/mail
home_mailbox = /var/spool/mail/user
proxy_interfaces = 0.0.0.0
2.Dovecot 配置 10-mail.conf
vi /etc/dovecot/conf.d/10-mail.conf
mail_location = mbox:~/mail:INBOX=/var/spool/mail/%u
3.Openwebmail.conf
vi /var/www/cgi-bin/openwebmail/etc/openwebmail.conf
mailspooldir /var/spool/mail
Note: There is still a problem with the configuration of main.cf, which is being updated