安裝環境
CentOS 7.7
iRedmail 0.9.9
IP:192.168.0.170
DN:iredmail.harryjee.com
hostname:iredmail
備忘
後端管理網址 https://192.168.0.170/iredadmin
管理員帳號 postmaster@harryjee.com
phpmyadmin後台 https://192.168.0.170/phpmyadmin
https://192.168.0.170/SOGo
信件檔案存放路徑
/var/vmail/vmail1/domain/userdir/Maildir/ cur new 兩個資料夾中
環境準備
關閉 selinux
vi /etc/selinux/config
SELINUX=disabled
vi /etc/sysconfig/network
HOSTNAME=iredmail.harryjee.com
vi /etc/hosts
127.0.0.1 iredmail.harryjee.com iredmail localhost localhost.localdomain
vi /etc/hostname
iredmail.harryjee.com
init 6
下載安裝 bzip2&iRedMailyum install wget bzip2
cd ~
wget https://bitbucket.org/zhb/iredmail/downloads/iRedMail-0.9.9.tar.bz2
tar xjf iRedMail-0.9.9.tar.bz2
cd iRedMail-0.9.9
./iRedMail.sh
安裝完畢需要重新開機來啟動iredmail服務
新增smtps及防火牆開啟smtps port vi /etc/postfix/master.cf
465 inet n - n - - smtpd
-o syslog_name=postfix/smtps
-o smtpd_tls_wrappermode=yes
-o smtpd_sasl_auth_enable=yes
-o smtpd_client_restrictions=permit_sasl_authenticated,reject
-o content_filter=smtp-amavis:[127.0.0.1]:10026
vi /etc/firewalld/services/smtps.xml
<?xml version="1.0" encoding="utf-8"?>
<service>
<short>Enable SMTPS</short>
<description>Enable SMTPS.</description>
<port protocol="tcp" port="465"/>
</service>
/etc/firewalld/zones/iredmail.xml
<zone>
...
<service name="smtps"/>
</zone>
firewall-cmd --complete-reload
允許不安全的pop3/smtp連線驗證
https://docs.iredmail.org/allow.insecure.pop3.imap.smtp.connections.html
vi /etc/dovecot/dovecot.conf
disable_plaintext_auth=no
ssl=yes
vi /etc/postfix/main.cf
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
# force all clients to use secure connection through port 25
#smtpd_tls_auth_only=yes
修改pop3與smtp不驗證網域
vi /etc/dovecot/dovecot.conf
auth_default_realm = harryjee.com
修改webmail登入不驗證網域
vi /opt/www/roundcubemail/config/config.inc.php
$config['username_domain'] = 'harryjee.com';
監視秘密副本(BCC)有幾種方式
1.針對每個網域
2.針對User
3.postfix 設定進出都做
4.不接受指定多個BCC地址
5.每用戶 bcc 優先權限高於每網域 bcc
mysql -u root -p
use vmail;
#domain送出
INSERT INTO sender_bcc_domain (domain, bcc_address, active, created) VALUES ('harryjee.com', 'monitor@harryjee.com', 1, NOW());
#domain收到
INSERT INTO recipient_bcc_domain (domain, bcc_address, active, created) VALUES ('harryjee.com', 'monitor@harryjee.com', 1, NOW());
#User送出
INSERT INTO sender_bcc_user (username, bcc_address, domain, active, created) VALUES ('harry@harryjee.com', 'bcca@harryjee.com', 'harryjee.com', 1, NOW());
#User收到
INSERT INTO recipient_bcc_user (username, bcc_address, domain, active, created)VALUES ('harry@harryjee.com', 'bccb@harryjee.com', 'harryjee.com', 1, NOW());
建立網域別名
INSERT INTO alias_domain (alias_domain, target_domain) VALUES ('mail.harryjee.com', 'harryjee.com');
批次建立帳號
https://docs.iredmail.org/sql.create.mail.user.html
停用防毒與spam
https://docs.iredmail.org/completely.disable.amavisd.clamav.spamassassin.html
電腦太老舊可以停用netdata
service netdata stop
/bin/systemctl disable netdata.service
密碼格式
說明: https://docs.iredmail.org/password.hashes-zh_CN.html
明碼。例如: 123456 (預設編碼sha512)
UPDATE mailbox SET password='{PLAIN}123456' WHERE username='xx@xx';
Mail relay
說明: https://docs.iredmail.org/per-account.transport.html#manage-relay-manually
可以針對網域或使用者設定 smtp relay
domain relay
UPDATE domain SET transport='smtp:[168.95.4.211]:25' WHERE domain='harryjee.com';
User relay
UPDATE vmail.mailbox SET transport='smtp:[168.95.4.211]:25' WHERE mailbox.username = 'harry@harryjee.com';
Postfix + Transport Maps
依收件者地址或網域來決定smtp relay
vi main.cf
transport_maps = hash:/etc/postfix/transport
vi /etc/postfix/transport
harryjee.tw@yahoo.com.tw smtp:[168.95.4.211]:25
hinet.net smtp:[168.95.4.211]:25
pchome.com.tw smtp:[168.95.4.211]:25
postmap /etc/postfix/transport
postfix reload
PS.使用中括號 [] 是為了避免 MX 查詢,而直接傳遞至 msa.hinet.net
全域通訊錄plugins安裝
http://www.github.com/johndoh/roundcube-globaladdressbook
下載解壓縮後放入plugins
wget https://github.com/johndoh/roundcube-globaladdressbook/archive/master.zip
unzip master.zip
mv roundcube-globaladdressbook-master /opt/www/roundcubemail/plugins/globaladdressbook
vi /opt/www/roundcubemailplugins/globaladdressbook/config.inc.php
修改那個帳號可以管理全域通訊錄
$config['globaladdressbook_user'] = 'global_addressbook@%d';
$config['globaladdressbook_admin'] = 'harry@harryjee.com';
roundcubemail啟用全域通訊錄
/opt/www/roundcubemail/config/config.inc.php