directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
recursion yes;
/* Path to ISC DLV key */
bindkeys-file
nameserver 172.16.51.31 -----指定DNS服務器
install_root: [/] ------postfix安裝路徑
tempdir: [/root/postfix-2.9.1] /tmp/postfix ------臨時文件的生成目錄
config_directory: [/etc/postfix] /etc/postfix -------配置文件目錄
daemon_directory: [/usr/libexec/postfix] -------服務進程目錄
command_directory: [/usr/sbin] ------bash命令目錄
queue_directory: [/var/spool/postfix] ---郵件隊列
sendmail_path: [/usr/sbin/sendmail] ---smtp的客戶端,用於實現與sendmail客戶端
兼容的
newaliases_path: [/usr/bin/newaliases] ---生成新別名
mailq_path: [/usr/bin/mailq] ---郵件隊列程序
mail_owner: [postfix] ---郵件服務器的運行者
setgid_group: [postdrop] ---用於實現將用戶的郵件投遞到它的郵箱中去的
html_directory: [no]/var/www/html/postfix ---當web服務器沒有配置好就使用no選項
manpages: [/usr/local/man] ---man文檔的安裝路徑
readme_directory: [no] ---幫助文檔
data_directory:[/var/lib/postfix] ---可讀寫文件的存放路徑
#vim /etc/postfix/main.cf
myhostname = mail.test1.com ------指定自己的郵件服務器
mydomain = test1.com ------自己創建的域名
myorign = $mydomain -----定義出站郵件使用的域名
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, ns.$mydomain
定義哪些域接收郵件
mynetworks = 172.16.0.0/16 127.0.0.0/8 --------定義允許中繼的網絡
protocols = pop3
MECH=shadow
mynetworks = 127.0.0.0/8
############################ CYRUS-SASL ############################
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions=permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_security_options = noanonymous
smtpd_sasl_path = smtpd
smtpd_banner = Welcome to our $myhostname ESMTP,Warning: Version not Available!
--prefix=/usr/local/courier-authlib \
--sysconfdir=/etc \
--without-authshadow \
--without-authvchkpw \
--without-authpgsql \
--with-authmysql \
--with-mysql-libs=/usr/lib/mysql \
--with-mysql-includes=/usr/include/mysql \
--with-redhat \
--with-authmysqlrc=/etc/authmysqlrc \
--with-authdaemonrc=/etc/authdaemonrc \
--with-mailuser=postfix \
--with-mailgroup=postfix \
--with-ltdl-lib=/usr/lib \
--with-ltdl-include=/usr/include
反斜線的意思是續行符
--prefix=/usr/local/courier-authlib \ -----文件的安裝路徑
--sysconfdir=/etc \ -----配置文件的安裝位置
--without-authpam --without-authshadow --without-authvchkpw --without-authpgsql
-----不支持pam/shadow/vchkpw/pgsql認證,這些選項不添加也可以
-with-authmysql ----支持mysql認證(重要就是支持者一項)
--with-mysql-libs=/usr/lib/mysql ------指明mysql的庫文件路徑的安裝位置
--with-mysql-includes=/usr/include/mysql -------指明mysql的頭文件的安裝路徑
--with-redhat ------說明系統類型,表示根據redhat系統實現一些系統優化
--with-authmysqlrc=/etc/authmysqlrc -----指定courier-authlib服務進程配置文件路徑
--with-authdaemonrc=/etc/authdaemonrc -----守護進程,courier-authlib服務進程的配置文件
--with-mailuser=postfix ----郵件收發管理的用戶
--with-mailgroup=postfix -----郵件收發管理的組
--with-ltdl-lib=/usr/lib -----ltdl動態模塊加載器,提供一個運行環境
--with-ltdl-include=/usr/include ----ltdl文件的頭文件路徑
authmodulelist="authmysql"-----指明認證的模塊
authmodulelistorig="authmysql"------保留的原始模塊
daemons=10 ------默認啓動啓動的進程個數(根據需要修改)
DEBUG_LOGIN=2 ----打開調試調試功能(三個取值“0”是關閉,“1”是打開調試;“2”是打開調試並且把登陸時的密碼記錄下來;當第一次使用虛擬用戶登陸,但是登陸不上時這個就需要打開)
編輯/etc/authmysqlrc配置文件
MYSQL_SERVER localhost -----指定服務器所在位置
MYSQL_USERNAME extmail -----連接mysql使用的文檔
MYSQL_SOCKET /var/lib/mysql/mysql.sock ----指定mysql套接字文件所在位置
MYSQL_PORT 3306 -----mysql端口號
MYSQL_DATABASE extmail -----在mysql的哪個庫中爲postfix提供虛擬用戶(這裏這樣的設定是與下文extmail的配置保持一致,自己定義也行)
MYSQL_USER_TABLE mailbox -----mysql的用戶賬號存放的表的位置
MYSQL_CRYPT_PWFIELD password-----mysql中哪個字段是用戶密碼
MYSQL_UID_FIELD 2525 -----mysql用戶賬戶的UID就是postfix用戶的UID
MYSQL_GID_FIELD 2525 -----mysql用戶賬號的GID就是postfix組的ID號
MYSQL_LOGIN_FIELD username ------哪個字段是用戶的賬號
MYSQL_HOME_FIELD concat('/var/mailbox/',homedir) -----用戶賬號的家目錄所在位置,虛擬用戶沒有家目錄,homedir是變量,等同於用戶名稱;concat是mysql內置的函數用於將兩個字符串連接起來
MYSQL_NAME_FIELD name-----用戶名稱在哪個字段上
MYSQL_MAILDIR_FIELD concat('/var/mailbox/',maildir) -----用戶郵箱目錄
######################## Virtual Mailbox Settings ########################
virtual_mailbox_base = /var/mailbox ----用戶郵箱默認目錄
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
-----郵箱映射表在mysql_virtual_mailbox_maps.cf配置文件中定義的就是就是如何查詢這些用戶相關信息
也就是一些查找語句
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
-----虛擬域,在mysql_virtual_domains_maps.cf定義的是如何在mysql表中查找域
virtual_alias_domains = -----定義別名域
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
----用戶賬號別名,在mysql_virtual_alias_maps.cf配置文件中定義如何查詢
(上述這三個配置文件會在下文配置extman的時候提供)
virtual_uid_maps = static:2525 ----定義郵箱的所有者
virtual_gid_maps = static:2525 ----定義郵箱的組
(static意思是靜態地圖類型使用自己已經創建的特定的用戶與組)
virtual_transport = virtual ----用戶投遞代理
########################## QUOTA Settings ########################
message_size_limit = 14336000 ----郵件大小最大值限定
virtual_mailbox_limit = 20971520 ----用戶郵箱最大值限定
mysql> GRANTALL LPRIVILEGES ON extmail.* TO extmail@localhost IDENTIFIED BY'extmail';
-----在數據庫extmail上的所有表上創建extmail用戶,密碼也是extmail
mysql> GRANTALL LPRIVILEGES ON extmail.* TO extmail@‘127.0.0.1’ IDENTIFIED BY'extmail';
-----與上條命令意思一樣,考慮到使用本機表示方式不同
mysql> FLUSH PRIVILEGES; ----更新mysql的系統權限相關表
用戶登陸後界面