郵件主機 (mail.dxqerp.cn)完成後,  可以正常使用 smtp  & pop3 .   如何讓這些郵件帳號可以 自行變更 密碼.  減少往 IT單位 請求 協助密碼變更呢 ?

這時候 可以 借助 open webmail 來完成 這項工作.  (https://openwebmail.org/openwebmail).

進行 Openwebmail 的安裝.   參考  (https://openwebmail.org/openwebmail/download/centos/el8/00.README.txt)

相關安裝設定順序整理如下,  免得下次 在 網路找來找去 (網路的資料, 有OS 版本的差異, 有插件版本的差異, 有時間點的差異,零零總總的,很花時間的 ) .


完成 httpd 安裝 與 設定 (注意  port 80 , 443)

完成 postfix 安裝 與 設定 ( 注意 port 25 ) ( 利用 telnet 192.168.17.8  25  查一下)

# postfix 注意點
/etc/postfix/main.cf  inet_interfaces = all
/etc/postfix/main.cf  mynetworks = 192.168.17.0/24, 127.0.0.1

# 防火牆 注意點   smtp (port 25) and http (port 80)
firewall-cmd –permanent –zone=public –add-service=smtp –add-service=http
firewall-cmd –reload

# 準備  ‘開發工具’  ( Development Tools )
yum groupinstall “Development Tools” -y

# 配置 openwebmail 存儲庫
yum install yum-utils -y
yum-config-manager –add-repo ftp://openwebmail.org/pub/openwebmail/el8/openwebmail-el8.repo

# 安裝 openwebmail 套件
yum install openwebmail -y ( 這可能會安裝 100 多個 perl 套件 )

# 執行 openwebmail-tool 進行初始化 (參數 –init)
/usr/local/bin/openwebmail-tool —init

# 一連串 的過程 , 使用時間不常  一下就過去… 看到

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…

# 再次執行運行 (openwebmail-tool) 以修復權限(參數 –fix)
/usr/local/bin/openwebmail-tool –fix

# 停用 SELinux重新啟動 (不停用, 會卡住)

/etc/selinux/config  SELINUX=disabled
reboot

使用非 root 用戶帳戶登錄到 webmail URL
http://mail.dxqerp.cn/webmail

應該 會跳出畫面(正常)   (openwebmai.org 期待你的 捐贈 )


可能的錯誤信息
請先在服務器上執行 ‘/var/www/cgi-bin/openwebmail/openwebmail-tool.pl –init
可能先前執行時 忘記帶參數  –init

‘/var/www/cgi-bin/openwebmail/.openwebmail.pl‘ 必須將 uid 設置為 root
‘/var/www/cgi-bin/openwebmail/openwebmail-tool.pl –fix
可能先前執行時 忘記帶參數  –fix


其它注意 事項

A. 收件夾 看不到信件, 是因 openwebmail 2.53 不支援 Maildir (有對策  下次 處理).

B. openwebmai 信件存放位置

  • 收信箱   /var/mail/每个人名字下面
  • 发信箱   /home/每个人名字/mail/sent-mail
  • 垃圾箱   /home/每个人名字/mail/spam-mail
  • 病毒邮件 /home/每个人名字/mail/virtus-mail
  • 草稿箱   /home/每个人名字/mail/saved-drafts
  • 保存邮件 /home/每个人名字/mail/saved-messages
  • 废件邮件 /home/每个人名字/mail/mail-trash

C. 用 outlook 进行收发邮件时,linux 邮件系统的对应目录中不会保存相应的文件。只有用openwebmail的格式时才能保存相关的文件到收信及发信箱中

D. 網頁下方的 ‘幫助’  對 繁體 與 簡體  呈現 亂碼(可能不支援 UTF-8)

E. 日志文件保存在 /var/log/openwebmail.log

發生 /var/log/openwebmail.log! (Permission denied)  可能處於 SElinux 保護之下,導致這種情況

解決方式

touch /var/log/openwebmail.log
# 這是產生一個log檔

chcon -u system_u /var/log/openwebmail.log
# 這是修改檔案使用者權限

chcon -t httpd_sys_script_rw_t /var/log/openwebmail.log
# 這是修改寫入權限

chcon -t httpd_unconfined_script_exec_t /var/www/cgi-bin/openwebmail/openwebmail*
# 這是修改檔案由什麼套件專用

這些都是因為 SELinux 造成的,原本檔案,目錄權限只有使用檔案前面那串(rwxrwxrwx),使用SELinux 後, 會多出一種管理context typecontext type 會限制該目錄、檔案的使用原則,

           * 使用有安裝 SELinux 時,出現 Apach、FTP 明明 都設定好了,卻還是不能使用,多半出問題,都是 SELinux 在做怪。

/usr/sbin/sestatus 表示 selinux 防火墙的安全策略

F. 使用speedcgi来加速  针对 Openwebmail  速度慢的缺点,可以使用 speedcgi 来加速 (摸索中 )

以上 種種 現象 登記在案

個人頭像照片

By 伍芳左

MIS, ERP Pro... RHCE Member (7.2)

發表迴響