精华内容
下载资源
问答
  • dovecot配置

    千次阅读 2013-11-04 14:18:13
     ... ...dovecot的配置很多,但如果要让dovecot能正常的运行收...在此,子猴也根据自己的配置经历来简单记录一下让Dovecot正确运行收信需要做哪些配置,当然我自己觉得对dovecot配置还不太熟,因为有很多的配置项
    

    转自:http://www.zihou.me/html/2012/01/17/6596.html  子猴博客



    dovecot的配置很多,但如果要让dovecot能正常的运行收信,配置的地方也不多,因为很多地方使用默认值即可。在此,子猴也根据自己的配置经历来简单记录一下让Dovecot正确运行收信需要做哪些配置,当然我自己觉得对dovecot配置还不太熟,因为有很多的配置项我都是按照默认的设置,且其含义我都并不清楚,有待进一步地研究。

    在dovecot.conf中的配置
    1、protocols = imap pop3 lmtp
    如果protocols的值不全,比如没有pop3等值请补全

    2、base_dir = /var/run/dovecot/
    这个项并不是必须的,但如果其是被注释掉的也可以打开并保留期默认值。

    3、login_trusted_networks = 0.0.0.0/0
    如果你是想通过Foxmail等客户端工具来收信,则此值必须设置,其值设为0.0.0.0/0即可,设置后,disable_plaintext_auth这个设置也就可以不用理会了,如果不设置的话会报错:
    plaintext authentication disallowed on non-secure connections

    以上是dovecot.conf中的几个配置,看起来也不多啊,另外还须对conf.d目录中的文件进行配置。

    在10-mail.conf中的配置

    mail_location = mbox:~/mail:INBOX=/var/mail/%u
    如果10-mail.conf中是没有配置这个项的,那一定得配上,表示邮件存放路径是在哪里的,%u就表示邮箱用户名。
    如果不配置此项会报错:
    Initialization failed: mail_location not set and autodetection failed: Mail storage autodetection failed

    除了上面的几处设置,其它的都是按照默认的设置,不过现在已经可以和Postfix搭配来收发邮件了。

    dovecot的安装请参见:http://www.zihou.me/html/2012/01/13/6549.html

    展开全文
  • postfix+dovecot配置SSL

    2020-08-26 10:39:22
    postfix+dovecot配置SSL 确保postfix和dovecot不配置SSL可以正常使用 配置SSL证书 配置证书 cd /etc/pki/tls/certs 生成加密密钥 [root@abc certs]# make server.key umask 77 ; /usr/bin/openssl genrsa -aes128 ...

    postfix+dovecot配置SSL

    确保postfix和dovecot不配置SSL可以正常使用

    配置SSL证书

    配置证书

    1. cd /etc/pki/tls/certs
    2. 生成加密密钥
      [root@abc certs]# make server.key
      umask 77 ;
      /usr/bin/openssl genrsa -aes128 2048 > server.key
      Generating RSA private key, 2048 bit long modulus
      …+++
      …+++
      e is 65537 (0x10001)
      Enter pass phrase: #输入密码
      Verifying - Enter pass phrase: #再次输入密码
    3. [root@abc certs]# openssl rsa -in server.key -out server.key
      Enter pass phrase for server.key:#输入密码
      writing RSA key
    4. 生成证书
      [root@abc certs]# make server.csr
      umask 77 ;
      /usr/bin/openssl req -utf8 -new -key server.key -out server.csr
      You are about to be asked to enter information that will be incorporated
      into your certificate request.
      What you are about to enter is what is called a Distinguished Name or a DN.
      There are quite a few fields but you can leave some blank
      For some fields there will be a default value,
      If you enter ‘.’, the field will be left blank.

    Country Name (2 letter code) [XX]:CN #国家
    State or Province Name (full name) []:jiangsu #省份
    Locality Name (eg, city) [Default City]:suzhou #城市
    Organization Name (eg, company) [Default Company Ltd]😗*** #公司
    Organizational Unit Name (eg, section) []😗*** #部门
    Common Name (eg, your name or your server’s hostname) []:mail.***.com.cn #名字或者服务器名称
    Email Address []:test1@***.com.cn #邮箱

    Please enter the following ‘extra’ attributes
    to be sent with your certificate request
    A challenge password []: #回车
    An optional company name []:#回车
    [root@abc certs]# openssl x509 -in server.csr -out server.crt -req -signkey server.key -days 3650 #证书有效期10年
    Signature ok
    subject=/C=CN/ST=jiangsu/L=suzhou/O=***/OU=***/CN=mail.***.com.cn/emailAddress=test1@***.com.cn
    Getting Private key

    配置postfix

    1. [root@abc postfix]# pwd
      /etc/postfix
      [root@abc postfix]# vi main.cf
      在最后加上
      smtpd_use_tls = yes
      smtpd_tls_cert_file = /etc/pki/tls/certs/server.crt
      smtpd_tls_key_file = /etc/pki/tls/certs/server.key
      smtpd_tls_session_cache_database = btree:/etc/postfix/smtpd_scache
    2. 相同路径下
      vi master.cf
      取消注释下面这两行,可以/smtps查找一下
      smtps inet n - n - - smtpd
      -o smtpd_tls_wrappermode=yes

    配置dovecot

    vi /etc/dovecot/conf.d/10-ssl.conf
    修改下面三行
    ssl = yes

    ssl_cert = </etc/pki/tls/certs/server.crt
    ssl_key = </etc/pki/tls/certs/server.key

    启动 postfix和dovecot

    dovecot -p
    输入密码
    systemctl start postfix

    可以通过查看mail日志确定是否发送成功
    vi /var/log/maillog

    配置foxmail

    这样在foxmail配置服务器的时候可以勾选ssl
    在这里插入图片描述
    如果dns解析不出服务器域名,可以在C:\Windows\System32\drivers\etc路径下直接修改hosts文件,增加IP和域名的对应关系

    参考博文:https://blog.csdn.net/Jesus_loves_me/article/details/89202759

    展开全文
  • Dovecot配置笔记

    2012-04-01 15:35:30
    它非常快,配置简单,不需要专业的管理员,而且它也非常节省内存。 以上是来自http://www.dovecot.org/官方的介绍。 下面我们来纪录记录一下它的安装: 这里我使用了CentOS系统自带的yum进行安...
    Dovecot是一个开源的,为Linux/Unix-like系统提供IMAP,POP3服务的软件。主要是为了安全产生的,不管大小应用,Dovecot都是一个非常优秀的选择。它非常快,配置简单,不需要专业的管理员,而且它也非常节省内存。
    

    以上是来自http://www.dovecot.org/官方的介绍。

    下面我们来纪录记录一下它的安装:
    这里我使用了CentOS系统自带的yum进行安装,安装非常简单,只需要一个包:dovecot
    # yum install dovecot
    就一切都搞定了

    它的主要配置文件也只有一个,位于 /etc/dovecot.conf


    base_dir = /var/run/dovecot/ # dovecot运行目录
    protocols = pop3 pop3s # 使用协议
    listen = * # 监听连接进来的ip地址,* => 所有的IPV4,[::] => 所有的IPV6
    disable_plaintext_auth = no
    log_path = /var/log/dovecot.log #日志文件位置
    info_log_path = /var/log/dovecot-info.log # debug信息
    log_timestamp = "%Y-%m-%d %H:%M:%S "
    ssl_disable = yes
    mail_location = maildir:/var/vmail/%u #用户的邮件目录位置,这里使用maildir方式存储
    mail_privileged_group = mail
    protocol imap {
    }

    protocol pop3 {
    pop3_uidl_format = %08Xu%08Xv
    }
    protocol lda {
    postmaster_address = postmaster@example.com
    }
    auth_verbose = yes # 认证详细日志
    auth_debug = yes # 认证的debug信息打开,可以显示出SQL查询语句,正常后可关闭
    auth_debug_passwords = yes #可以显示密码失败的详细信息,正常后可关闭
    auth default {
    mechanisms = plain login #认证机制
    passdb pam {
    }
    passdb passwd-file {
    args = /etc/dovecot/passwd #密码文件
    }
    userdb passwd {
    }
    userdb static {
    args = uid=vmail gid=vmail home=/var/vmail/%u #这里的uid和gid需要可以访问/home/vmail邮箱目录
    }
    user = root
    socket listen {
    client {
    path = /var/spool/postfix/private/auth-client #postfix需要连接到这个sock进行认证
    mode = 0660
    user = postfix
    group = postfix
    }
    }
    }
    dict {
    }
    plugin {
    }


    /etc/dovecot/passwd,可以使用明码或者是编码后的密码:

    user1@example.com:{PLAIN}user1's password
    user2@example.com:{PLAIN}user2's password

    这里使用了明文密码,也可以使用加密后的密码:

    dovecotpw -s ssha
    Enter new password: foo
    Retype new password: foo
    {SSHA}dZ9TYI7DTM+J558QUBRAIMd/WCOoFGeU

    在 /etc/dovecot/passwd

    joe:{SSHA}dZ9TYI7DTM+J558QUBRAIMd/WCOoFGeU


    以上介绍了帐号使用文件存储的方式,下面再介绍一下使用mysql数据库进行帐号存储,只需要修改auth default区块:

    auth default {
    mechanisms = plain login
    passdb pam {
    }
    passdb sql {
    args = /etc/dovecot/dovecot-sql.conf
    }
    userdb passwd {
    }
    userdb sql {
    args = /etc/dovecot/dovecot-sql.conf
    }
    user = root
    socket listen {
    client {
    path = /var/spool/postfix/private/auth-client
    mode = 0660
    user = postfix
    group = postfix
    }
    }
    }

    /etc/dovecot/dovecot-sql.conf

    driver = mysql
    connect = host=/tmp/mysql.sock dbname=postfix user=postfix
    password=mypassword
    default_pass_scheme = MD5-CRYPT # 如果使用postfixadmin管理,需要用这个加密方式
    password_query = SELECT username as user, password from mailbox WHERE username = '%u'
    user_query = SELECT maildir, 501 AS uid, 501 AS gid FROM mailbox WHERE username = '%u' #这里uid和gid需要可以访问帐号邮件存储目录


    就这么简单,配置完成了,下面我们来进行一下简单的测试:
    telnet localhost 25

    helo mail.xxx.net
    250 mail.xxx.net
    >>> auth login
    334 VXNlcm5hbWU6
    >>> dXNlcjFAZXhhbXBsZS5jb20= (Base64后的用户名:user1@example.com)
    334 UGFzc3dvcmQ6
    >>> Zm9vYmFy (Base64后的密码:foobar)
    235 2.7.0 Authentication successful

    用plain的方式认证
    telnet localhost 25

    220 mail.xxx.net ESMTP Postfix
    >>> auth plain
    334
    >>> AHVzZXIxQGV4YW1wbGUuY29tAGZvb2Jhcg== (Base64后的用户名和密码:\0user1@example.com\0foobar)
    235 2.7.0 Authentication successful

    使用plain方式认证需要注意,用户名和密码需要一起进行编码,用\0作为分隔符。

    Base64的方式有很多,最后我们再介绍一个使用Ruby进行编码的方法:

    inosin@mac:~ > ruby -rbase64 -e 'puts Base64.encode64("\0user1@example.com\0foobar")'
    AHVzZXIxQGV4YW1wbGUuY29tAGZvb2Jhcg==

    inosin@mac:~ > ruby -rbase64 -e 'puts Base64.encode64("user1@example.com")'
    dXNlcjFAZXhhbXBsZS5jb20=

    inosin@mac:~ > ruby -rbase64 -e 'puts Base64.encode64("foobar")'
    Zm9vYmFy
    展开全文
  • postfix , dovecot 配置

    2017-11-16 16:43:00
    (一)postfix 配置配置dns 1 yum install bind -y 2 systemctl start named 3 vim /etc/named.conf 内容: options { // listen-on port 53 { 127.0.0.1; }; // listen-on-v6 po...

    (一)postfix  配置

     

     

     配置dns

     

    1 yum install bind -y

    2 systemctl start named

    3 vim /etc/named.conf

     

    内容:

    options {

    //      listen-on port 53 { 127.0.0.1; };

    //      listen-on-v6 port 53 { ::1; };

            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";

    //      allow-query     { localhost; };

     

    dnssec-validation no;###是否合法,即是否可以充当公网上的dns,如果没有申请,就写no###

     

    4 vim /etc/named.rfc1912.zones

     

    内容:

    zone "westos.com" IN {

            type master;

            file "westos.com.zone";

            allow-update { none; };

    };

     

    zone "qq.com" IN {

            type master;

            file "qq.com.zone";

            allow-update { none; };

    };

     

    5 cd /var/named/

    6 cp -p named.localhost westos.com.zone

    7 vim westos.com.zone

     

    内容:

    $TTL 1D

    @       IN SOA  dns.westos.com. root.westos.com. (

                                            0       ; serial

                                            1D      ; refresh

                                            1H      ; retry

                                            1W      ; expire

                                            3H )    ; minimum

                    NS      dns.westos.com.

    dns             A       172.25.254.112

    westos.com.     MX 1    172.25.254.112.

     

    8 cp -p westos.com.zone qq.com.zone

    9 vim qq.com.zone

     

    内容:

    $TTL 1D

    @       IN SOA  dns.qq.com. root.qq.com. (

                                            0       ; serial

                                            1D      ; refresh

                                            1H      ; retry

                                            1W      ; expire

                                            3H )    ; minimum

                    NS      dns.qq.com.

    dns             A       172.25.254.112

    qq.com.         MX 1    172.25.254.212.

     

    10 systemctl restart named

    11 systemctl stop firewalld.service

    12 systemctl disable firewalld.service

     

     

     基本电子邮件发送

     

    1)postfix定义:

    postfix提供smtp协议用来投递邮件,默认端口为25,日志在/var/log/maillog

    MDA:“邮件发送代理“

    2)重要的Postfix配置指令

    1 myorigin :

    重写本地发布的电子邮件,使其显示为来自该域。这样有助于确保响应返回入站邮件服务器

    默认:myorigin = $myhostname

    2 inet_interfaces:

    控制Postfix侦听传入电子邮件的网络接口。如果设置为loopback-only,仅侦听127.0.0.1和::1,

    如果设置为all,则侦听所有网络接口。还可以指定特定地址。

    默认:inet_interfaces = localhost

    3 mydestination:

    收到地址为这些域的电子邮件将传递至MDA,以进行本地发送。

    默认:mydestination = $myhostname, localhost.$mydomain, localhost

    4 mynetworks

    IP地址和网络的逗号分隔列表(采用CIDR表示法)。这些地址和网络可以通过此MTA转发至

    任何位置,无需进一步身份验证。

    默认:mynetworks = 127.0.0.0/8

     

    3)邮件发送

    发送邮件端:

     

    1 vim /etc/postfix/main.cf###编辑postfix的主配置文件###

     

    内容:

    116 inet_interfaces = all###25端口开启的网络接口默认情况下,Postfix仅侦听来自本地主机的传入电子邮件。若要重新配置postfix以接收从远程主机发

    送的本地邮件,必须设置inet_interfaces = all###

    76 myhostname = westos-mail.westos.com###指定mta主机名称###

    83 mydomain = westos.com###指定mta的域名###

    99 myorigin = westos.com###指定邮件来源结尾(@后面的字符内容)

    164 mydestination = $myhostname, $mydomain, localhost###接受邮件结尾字符的指定#

     

    2 systemctl restart postfix.service###重启服务###

    3 systemctl stop firewalld###关闭防火墙###

    4 mail root@qq.com###发送邮件###

    Subject: hello

    hello

    .###以“.”表示结束###

    EOT

    5  mailq(或postqueue -p)###显示已排队的所有传出邮件的列表###

    6  postqueue -f###再次立即发送所有已排队的邮件###

     

     

    接受邮件端:

    1 vim /etc/postfix/main.cf

     

    内容:

    116 inet_interfaces = all                  ###25端口开启的网络接口。默认情况下,Postfix仅侦听来自本地主机的传入电子邮件。若要重新配置postfix以接收从远程主机发

    送的本地邮件,必须设置inet_interfaces = all###

    76 myhostname = qq-mail.westos.com         ###指定mta主机名称###

    83 mydomain = qq.com   ###指定mta的域名###

    99 myorigin = $mydomain                    ###指定邮件来源结尾(@后面的字符内容)

    164 mydestination = $myhostname, $mydomain, localhost    ###接受邮件结尾字符的指定#

     

    2 systemctl restart postfix.service

    3 systemctl stop firewalld.service

    4 mail###查看获得的邮件###

     

    过程如下:

     

    发邮件端:

    [root@westos-mail named]# vim /etc/postfix/main.cf

     

    116 inet_interfaces = all###25端口开启的网络接口###

    76 myhostname = westos-mail.westos.com###指定mta主机名称###

     83 mydomain = westos.com###指定mta的域名###

    99 myorigin = westos.com###指定邮件来源结尾(@后面的字符内容)

    164 mydestination = $myhostname, $mydomain, localhost###接受邮件结尾字符的指定#

     

     

     

     

    [root@westos-mail named]# systemctl restart postfix.service

    [root@westos-mail named]# systemctl stop firewalld

    [root@westos-mail named]# mail root@qq.com

    Subject: hello

    hello

    .

    EOT

    [root@westos-mail named]# mailq

    Mail queue is empty

    [root@westos-mail named]#

     

     

    接收邮件端:

    [root@qq-mail ~]# vim /etc/postfix/main.cf

     

    116 inet_interfaces = all                  ###25端口开启的网络接口###

    76 myhostname = qq-mail.qq.com            ###指定mta主机名称###

    83 mydomain = qq.com   ###指定mta的域名###

    99 myorigin = $mydomain                    ###指定邮件来源结尾(@后面的字符内容)

    164 mydestination = $myhostname, $mydomain, localhost    ###接受邮件结尾字符的指定#

     

    [root@qq-mail ~]# systemctl restart postfix.service

    [root@qq-mail ~]# systemctl stop firewalld.service

    [root@qq-mail ~]# mailq

    Mail queue is empty

    You have mail in /var/spool/mail/root

    [root@qq-mail ~]# cat /var/spool/mail/root

    From root@westos.com  Sat May 20 03:13:41 2017

    Return-Path: <root@westos.com>

    X-Original-To: root@qq.com

    Delivered-To: root@qq.com

    Received: from westos-mail.westos.com (unknown [172.25.254.112])

    by qq-mail.westos.com (Postfix) with ESMTP id 3442417E84B

    for <root@qq.com>; Sat, 20 May 2017 03:13:41 -0400 (EDT)

    Received: by westos-mail.westos.com (Postfix, from userid 0)

    id CD43D2462AE; Sat, 20 May 2017 03:13:40 -0400 (EDT)

    Date: Sat, 20 May 2017 03:13:40 -0400

    To: root@qq.com

    Subject: hello

    User-Agent: Heirloom mailx 12.5 7/5/10

    MIME-Version: 1.0

    Content-Type: text/plain; charset=us-ascii

    Content-Transfer-Encoding: 7bit

     

     

     邮件别名

     

    接收邮件端:

    1 vim /etc/aliases

     

    内容:

    admin:          root

    别名             真名

     

    2 postalias /etc/aliases###立即生效###

    3 systemctl restart postfix.service###重启服务###

     

    测试:

    发邮件端:

    1 mail admin@qq.com

    Subject: haa

    haa

    .

    EOT

     

    2 mailq

     

    接收邮件端:

     mail

     

    过程如下:

     

    发邮件端:

    [root@westos-mail ~]# mail admin@qq.com

    Subject: haa

    haa

    .

    EOT

    [root@westos-mail ~]# mailq

    Mail queue is empty

     

     

    收邮件端:

     

    [root@qq-mail ~]# vim /etc/aliases

     wKioL1klVlmzBx6zAAAe_gfz7YY702.png

     

    [root@qq-mail ~]# postalias /etc/aliases                 ###立即生效###

    [root@qq-mail ~]# systemctl restart postfix.service

    [root@qq-mail ~]# mail

    Heirloom Mail version 12.5 7/5/10.  Type ? for help.

    "/var/spool/mail/root": 3 messages 1 new 3 unread

     U  1 root                  Sat May 20 03:13  22/741   "hello"

     U  2 root                  Sat May 20 03:25  22/747   "world"

    >N  3 root                  Sat May 20 04:09  21/731   "haa"

    & q

    Held 3 messages in /var/spool/mail/root

    You have mail in /var/spool/mail/root

     

     邮件群发

     

    接收邮件端:

    1 vim /etc/aliases

     

    内容:

    moreuser:       :include:/etc/postfix/moreuser

    别名

     

    2 vim /etc/postfix/moreuser

     

    内容:

     

    student

    root

     

    3  postalias /etc/aliases###立即生效###

    4  systemctl restart postfix.service###重启服务###

     

    测试:

    发邮件端:

    1 mail moreuser@qq.com

    Subject: hello

    kaa

    .

    EOT

    2 mailq

     

    收邮件端:

    1 mail -u student                 ###查看student的邮件###

    2  mail -u root                    ###查看root的邮件###

     

    过程如下:

     

    发邮件端:

    [root@westos-mail ~]# mail moreuser@qq.com

    Subject: hello

    kaa

    .

    EOT

    [root@westos-mail ~]# mailq

    Mail queue is empty

     

     

     

    [root@qq-mail ~]# vim /etc/aliases

    wKiom1klVkmxk2aRAAAe_gfz7YY669.png 

    moreuser:       :include:/etc/postfix/moreuser

    别名

     

    [root@qq-mail ~]# vim /etc/postfix/moreuser

     

    student

    root

     

     

    收邮件端:

    [root@qq-mail ~]# postalias /etc/aliases

    [root@qq-mail ~]# systemctl restart postfix.service

    [root@qq-mail ~]# > /var/spool/mail/root

    [root@qq-mail ~]# mail -u student                 ###查看student的邮件###

    No mail for student

    [root@qq-mail ~]# mail -u root                    ###查看root的邮件###

    No mail for root

    [root@qq-mail ~]# mail -u root

    Heirloom Mail version 12.5 7/5/10.  Type ? for help.

    "/var/mail/root": 1 message 1 new

    >N  1 root                  Sat May 20 04:12  24/868   "hello"

    & q

    Held 1 message in /var/mail/root

    [root@qq-mail ~]# mail -u student

    Heirloom Mail version 12.5 7/5/10.  Type ? for help.

    "/var/mail/student": 1 message 1 new

    >N  1 root                  Sat May 20 04:12  24/871   "hello"

    & q

    Held 1 message in /var/mail/student

    You have mail in /var/spool/mail/root

     

     

     通过远程主机测试邮件服务

     

    1 telnet 172.25.254.112 25###连接172.25.254.112的25端口###

    Trying 172.25.254.112...

    Connected to 172.25.254.112.

    Escape character is '^]'.

    220 westos-mail.westos.com ESMTP Postfix

    ehlo hello                             ###跟112主机打个招呼##

    250-westos-mail.westos.com

    250-PIPELINING

    250-SIZE 10240000

    250-VRFY

    250-ETRN

    250-ENHANCEDSTATUSCODES

    250-8BITMIME

    250 DSN

    mail from:root@westos.com            ###邮件从root@westos.com发送###

    250 2.1.0 Ok

    rcpt to:root@qq.com                  ###邮件发到root@qq.com###

    250 2.1.5 Ok

    data                                 ###邮件内容###

    354 End data with <CR><LF>.<CR><LF>

    hello world

    hai

         ##以“.”表示结束###

    250 2.0.0 Ok: queued as EEB672462AF

     

     拒绝远程主机连接

     

    1 postconf -e "smtpd_client_restrictions = check_client_access hash:/etc/postfix/access"      #用smtpd_client_restrictions参数去检测/etc/postfix/access,但真正检测的是加密后的文件access.db####

     

    2 vim /etc/postfix/main.cf   

    3 vim /etc/postfix/access###编辑你拒绝连接的主机###

     

    内容:

    172.25.254.12 REJECT

     

    4 postmap /etc/postfix/access   ###加密###

    5 cd /etc/postfix/###加密后的文件在该目录下###

    6 systemctl restart postfix.service

     

    测试:

     

    telnet 172.25.254.112 25

     

     

    过程如下:

    [root@westos-mail ~]# postconf -d | grep client###显示client的默认值##

    broken_sasl_auth_clients = no

    local_header_rewrite_clients = permit_inet_interfaces

    parent_domain_matches_subdomains = debug_peer_list,fast_flush_domains,mynetworks,permit_mx_backup_networks,qmqpd_authorized_clients,relay_domains,smtpd_access_maps

    postscreen_client_connection_count_limit = $smtpd_client_connection_count_limit

    qmqpd_authorized_clients =

    qmqpd_client_port_logging = no

    relay_clientcerts =

    smtpd_authorized_verp_clients = $authorized_verp_clients

    smtpd_authorized_xclient_hosts =

    smtpd_client_connection_count_limit = 50

    smtpd_client_connection_rate_limit = 0

    smtpd_client_event_limit_exceptions = ${smtpd_client_connection_limit_exceptions:$mynetworks}

    smtpd_client_message_rate_limit = 0

    smtpd_client_new_tls_session_rate_limit = 0

    smtpd_client_port_logging = no

    smtpd_client_recipient_rate_limit = 0

    smtpd_client_restrictions =

    unknown_client_reject_code = 450

    [root@westos-mail ~]# postconf -e "smtpd_client_restrictions = check_client_access hash:/etc/postfix/access"      #用smtpd_client_restrictions参数去检测/etc/postfix/access,但真正检测的是加密后的文件access.db####

    [root@westos-mail ~]# vim /etc/postfix/main.cf

    wKiom1klS0OwGtddAAA8m78crpE262.png

    [root@westos-mail ~]# vim /etc/postfix/access

    wKiom1klS2iA9PoIAAAnRguPUgY698.png

    [root@westos-mail ~]# vim /etc/postfix/access

    [root@westos-mail ~]# postmap /etc/postfix/access   ###加密###

    [root@westos-mail ~]# ls

    anaconda-ks.cfg  Documents  Music     Public     Videos

    Desktop          Downloads  Pictures  Templates

    [root@westos-mail ~]# cd /etc/postfix/

    [root@westos-mail postfix]# ls

    access     generic        master.cf  virtual

    access.db  header_checks  relocated

    canonical  main.cf        transport

    [root@westos-mail postfix]#

     

    测试:

     

    [root@foundation12 Desktop]# telnet 172.25.254.112 25

    Trying 172.25.254.112...

    Connected to 172.25.254.112.

    Escape character is '^]'.

    220 westos-mail.westos.com ESMTP Postfix

    mail from:root@westos.com

    250 2.1.0 Ok

    rcpt to:root@qq.com

    554 5.7.1 <unknown[172.25.254.12]>: Client host rejected: Access denied

    q

    502 5.5.2 Error: command not recognized

    quit

    221 2.0.0 Bye

    Connection closed by foreign host.

    [root@foundation12 Desktop]#

     

     

     限制远程主机连接用户发送

     

    被连接的主机:

    1 postconf -d | grep sender###查看参数###

    2 postconf -e "smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/sender"###用smtpd_sender_restrictions参数去检测

    /etc/postfix/sender文件###

    3 vim /etc/postfix/sender###编辑文件###

    内容:

    student@westos.com      REJECT###拒绝student@westos.com用户发送###

    4 postmap /etc/postfix/sender###加密###

    5 cd /etc/postfix/###加密后的文件在该目录下

    6 systemctl restart postfix.service###重启服务###

     

    过程如下:

    [root@westos-mail ~]# postconf -d | grep sender

    address_verify_sender = $double_bounce_sender

    address_verify_sender_dependent_default_transport_maps = $sender_dependent_default_transport_maps

    address_verify_sender_dependent_relayhost_maps = $sender_dependent_relayhost_maps

    address_verify_sender_ttl = 0s

    canonical_classes = envelope_sender, envelope_recipient, header_sender, header_recipient

    double_bounce_sender = double-bounce

    lmtp_sender_dependent_authentication = no

    masquerade_classes = envelope_sender, header_sender, header_recipient

    proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $smtpd_sender_login_maps $sender_bcc_maps $recipient_bcc_maps $smtp_generic_maps $lmtp_generic_maps $alias_maps

    sender_bcc_maps =

    sender_canonical_classes = envelope_sender, header_sender

    sender_canonical_maps =

    sender_dependent_default_transport_maps =

    sender_dependent_relayhost_maps =

    smtp_sender_dependent_authentication = no

    smtpd_reject_unlisted_sender = no

    smtpd_sender_login_maps =

    smtpd_sender_restrictions =

    unverified_sender_defer_code = 450

    unverified_sender_reject_code = 450

    unverified_sender_reject_reason =

    unverified_sender_tempfail_action = $reject_tempfail_action

    [root@westos-mail ~]# postconf -e "smtpd_sender_restrictions = check_sender_acess hash:/etc/postfix/sender"

    [root@westos-mail ~]# vim /etc/postfix/sender

    [root@westos-mail ~]# postmap /etc/postfix/sender

    [root@westos-mail ~]# systemctl restart postfix.service

    [root@westos-mail ~]# systemctl start named

    [root@westos-mail ~]# systemctl stop firewalld

    [root@westos-mail postfix]# ls

    access     canonical  header_checks  master.cf  sender     transport

    access.db  generic    main.cf        relocated  sender.db  virtual

     

    测试:

    [kiosk@foundation12 Desktop]$ telnet 172.25.254.112 25

    Trying 172.25.254.112...

    Connected to 172.25.254.112.

    Escape character is '^]'.

    220 westos-mail.westos.com ESMTP Postfix

    mail from:student@westos.com

    250 2.1.0 Ok

    rcpt to:root@westos.com

    554 5.7.1 <unknown[172.25.254.12]>: Client host rejected: Access denied

    quit

    221 2.0.0 Bye

    Connection closed by foreign host.

    [kiosk@foundation12 Desktop]$

     

     限制用户接收

     

    接受邮件端:

    1 postconf -e "smtpd_recipient_restrictions = check_recipient_access hash:/etc/postfix/recip"

    2 vim /etc/postfix/recip

     

    内容:

     

    westos@westos.com       REJECT###限制westos@wests.com用户接收###

     

     

    3 postmap /etc/postfix/recip ###加密###

    4 systemctl restart postfix.service

     

     

    过程如下:

    [root@westos-mail ~]# postconf -e "smtpd_recipient_restrictions = check_recipient_access hash:/etc/postfix/recip"

    [root@westos-mail ~]# vim /etc/postfix/recip

     

    westos@westos.com       REJECT

     

     

    [root@westos-mail ~]# postmap /etc/postfix/recip

    [root@westos-mail ~]# systemctl restart postfix.service

     

    测试:

    [kiosk@foundation12 Desktop]$ telnet 172.25.254.112 25

    Trying 172.25.254.112...

    Connected to 172.25.254.112.

    Escape character is '^]'.

    220 westos-mail.westos.com ESMTP Postfix

    mail from:westos@westos.com

    250 2.1.0 Ok

    rcpt to:root@westos.com

    250 2.1.5 Ok

    data

    354 End data with <CR><LF>.<CR><LF>

    hello

    hello

    .

    250 2.0.0 Ok: queued as D00F9EAC27

    mail from:root@westos.com

    250 2.1.0 Ok

    rcpt to:westos@westos.com

    554 5.7.1 <westos@westos.com>: Recipient address rejected: Access denied

    421 4.4.2 westos-mail.westos.com Error: timeout exceeded

    Connection closed by foreign host.

     

     

     入站地址转换

     

    邮件发送方:

    1 postconf -e "smtp_generic_maps = hash:/etc/postfix/generic"

    2 vim /etc/postfix/generic

    3 postmap /etc/postfix/generic

     

    westos@westos.com       hello@haa.com

    真实用户虚拟用户

    4 postmap /etc/postfix/generic###加密###

    测试:

    su - westos

    mail root@qq.com

     

     

     

    过程如下:

    邮件发送方:

    [root@westos-mail ~]# postconf -d | grep generic

    lmtp_generic_maps =

    proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $smtpd_sender_login_maps $sender_bcc_maps $recipient_bcc_maps $smtp_generic_maps $lmtp_generic_maps $alias_maps

    smtp_generic_maps =

    [root@westos-mail ~]# postconf -e "smtp_generic_maps = hash:/etc/postfix/generic"

    [root@westos-mail ~]# vim /etc/postfix/generic

    [root@westos-mail ~]# postmap /etc/postfix/generic

     

     

    测试:

    邮件发送方:

    [root@westos-mail ~]# su - westos

    [westos@westos-mail ~]$ mail root@qq.com

    Subject: hello hello

    hello

    .

    EOT

    [westos@westos-mail ~]$ mailq

    Mail queue is empty

     

     

    邮件接收方:

    [root@qq-mail ~]# mail

    Heirloom Mail version 12.5 7/5/10.  Type ? for help.

    "/var/spool/mail/root": 3 messages 1 new

        1 root                  Sat May 20 04:12  25/879   "hello"

        2 root@westos.com       Sat May 20 04:36  15/510   

    >N  3 hello@haa.com         Sat May 20 22:32  21/725   "hello hello"

    & 3

    Message  3:

    From hello@haa.com  Sat May 20 22:32:21 2017

    Return-Path: <hello@haa.com>###名字发生了变化###

    X-Original-To: root@qq.com

    Delivered-To: root@qq.com

    Date: Sat, 20 May 2017 22:32:23 -0400

    To: root@qq.com

    Subject: hello hello

    User-Agent: Heirloom mailx 12.5 7/5/10

    Content-Type: text/plain; charset=us-ascii

    From: hello@haa.com

    Status: R

     

    hello

     

    &

     

     

     出站地址转换

     

    1) 先做dns解析:

    1 vim /etc/named.rfc1912.zones

    内容:

    zone "haa.com" IN {

            type master;

            file "haa.com.zone";

            allow-update { none; };

    };

     

    2 cd /var/named/

    3 cp -p qq.com.zone haa.com.zone

    4 vim haa.com.zone

     

    内容:

     

    $TTL 1D

    @       IN SOA  dns.haa.com. root.haa.com. (

                                            0       ; serial

                                            1D      ; refresh

                                            1H      ; retry

                                            1W      ; expire

                                            3H )    ; minimum

                    NS      dns.haa.com.

    dns             A       172.25.254.112

    haa.com.        MX 1    172.25.254.112.##为真实名字主机的ip###

    ~                                             

     

    5 systemctl restart named

     

    过程如下:

    [root@westos-mail westos]# vim /etc/named.rfc1912.zones

     

     

    zone "haa.com" IN {

            type master;

            file "haa.com.zone";

            allow-update { none; };

    };

     

     

    [root@westos-mail named]# cd /var/named/

    [root@westos-mail named]# ls

    data     named.ca     named.localhost  qq.com.zone  westos.com.zone

    dynamic  named.empty  named.loopback   slaves

    [root@westos-mail named]# cp -p qq.com.zone haa.com.zone

    [root@westos-mail named]# vim haa.com.zone

     

    $TTL 1D

    @       IN SOA  dns.haa.com. root.haa.com. (

                                            0       ; serial

                                            1D      ; refresh

                                            1H      ; retry

                                            1W      ; expire

                                            3H )    ; minimum

                    NS      dns.haa.com.

    dns             A       172.25.254.112

    haa.com.        MX 1    172.25.254.112.

    ~                                             

    [root@westos-mail named]# systemctl restart named

     

    2)配置

    1 postconf -e "virtual_alias_maps = hash:/etc/postfix/virtual"

    2 vim /etc/postfix/virtual

     

    内容:

    hello@haa.com   westos@westos.com

    别名真名

     

    3 postmap /etc/postfix/virtual###加密###

    4 systemctl restart postfix.service

     

    过程如下:

     

     

    [root@westos-mail named]# postconf -d | grep virtual

    address_verify_virtual_transport = $virtual_transport

    propagate_unmatched_extensions = canonical, virtual

    proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $smtpd_sender_login_maps $sender_bcc_maps $recipient_bcc_maps $smtp_generic_maps $lmtp_generic_maps $alias_maps

    unknown_virtual_alias_reject_code = 550

    unknown_virtual_mailbox_reject_code = 550

    virtual_alias_domains = $virtual_alias_maps

    virtual_alias_expansion_limit = 1000

    virtual_alias_maps = $virtual_maps

    virtual_alias_recursion_limit = 1000

    virtual_delivery_slot_cost = $default_delivery_slot_cost

    virtual_delivery_slot_discount = $default_delivery_slot_discount

    virtual_delivery_slot_loan = $default_delivery_slot_loan

    virtual_destination_concurrency_failed_cohort_limit = $default_destination_concurrency_failed_cohort_limit

    virtual_destination_concurrency_limit = $default_destination_concurrency_limit

    virtual_destination_concurrency_negative_feedback = $default_destination_concurrency_negative_feedback

    virtual_destination_concurrency_positive_feedback = $default_destination_concurrency_positive_feedback

    virtual_destination_rate_delay = $default_destination_rate_delay

    virtual_destination_recipient_limit = $default_destination_recipient_limit

    virtual_extra_recipient_limit = $default_extra_recipient_limit

    virtual_gid_maps =

    virtual_initial_destination_concurrency = $initial_destination_concurrency

    virtual_mailbox_base =

    virtual_mailbox_domains = $virtual_mailbox_maps

    virtual_mailbox_limit = 51200000

    virtual_mailbox_lock = fcntl, dotlock

    virtual_mailbox_maps =

    virtual_minimum_delivery_slots = $default_minimum_delivery_slots

    virtual_minimum_uid = 100

    virtual_recipient_limit = $default_recipient_limit

    virtual_recipient_refill_delay = $default_recipient_refill_delay

    virtual_recipient_refill_limit = $default_recipient_refill_limit

    virtual_transport = virtual

    virtual_uid_maps =

    [root@westos-mail named]# postconf -e "virtual_alias_maps = hash:/etc/postfix/virtual"

    [root@westos-mail named]# vim /etc/postfix/virtual

    wKiom1klS7XQJQlaAAAne5GWGX8263.png 

     

    hello@haa.com   westos@westos.com

    别名真名

     

     

    [root@westos-mail named]# postmap /etc/postfix/virtual###加密###

    [root@westos-mail named]# systemctl restart postfix.service

     

     

     

    测试:

    邮件发送端:

    1 mail hello@haa.com###发邮件###

    2 mailq

     

    邮件接收端:

    mail

     

    过程如下:

    [root@westos-mail named]# mail

    Heirloom Mail version 12.5 7/5/10.  Type ? for help.

    "/var/spool/mail/westos": 1 message 1 new

    >N  1 root                  Sat May 20 22:42  21/719   "hai"

    & 1

    Message  1:

    From root@qq.com  Sat May 20 22:42:59 2017

    Return-Path: <root@qq.com>

    X-Original-To: hello@haa.com

    Delivered-To: westos@westos.com

    Date: Sat, 20 May 2017 22:42:58 -0400

    To: hello@haa.com

    Subject: hai

    User-Agent: Heirloom mailx 12.5 7/5/10

    Content-Type: text/plain; charset=us-ascii

    From: root@qq.com (root)

    Status: R

     

    hai

     

    &

     

     

    [root@qq-mail ~]# mail hello@haa.com###发邮件###

    Subject: hai

    hai

    .

    EOT

    [root@qq-mail ~]# mailq

    Mail queue is empty

    [root@qq-mail ~]#

     

     

     

    (二)dovecot配置

     

     定义:

    dovecot用来提供收件协议。

    协议:端口:

    pop3110

    imap143

    imaps993

    pop3s995

    给定用户名称,用户密码,dovecot程序带我们去看这个用户的邮件文件

     

     配置

    1 vim /etc/dovecot/dovecot.conf###谁能够访问并且通过验证###

    内容:

     

    24 protocols = imap pop3 lmtp###打开收件协议###

    48 login_trusted_networks = 0.0.0.0/0###允许所有人连接###

    49 disable_plaintext_auth = no###支持明文###

     

    2 vim /etc/dovecot/conf.d/10-mail.conf###带用户去看什么文件###

    内容:

     

    30 mail_location = mbox:~/mail:INBOX=/var/mail/%u

     

    3 mkdir /etc/skel/mail/.imap -p###在用户骨架文件里建立目录,则新建的用户均有该目录###

    4 touch /etc/skel/mail/.imap/INBOX

    5 mkdir /home/westos/mail/.imap -p###如果是原先就存在的用户,则要另外建该目录,因为用户骨架文件中没有该用户的这个目录###

    6 touch /home/westos/mail/.imap/INBOX

     

    过程如下:

    [root@westos-mail ~]# yum install dovecot -y

    [root@westos-mail ~]# systemctl start dovecot

    [root@westos-mail ~]# netstat -anplte | grep dovecot

    tcp        0      0 0.0.0.0:993             0.0.0.0:*               LISTEN      0          92793      5989/dovecot        

    tcp        0      0 0.0.0.0:995             0.0.0.0:*               LISTEN      0          92769      5989/dovecot        

    tcp        0      0 0.0.0.0:110             0.0.0.0:*               LISTEN      0          92767      5989/dovecot        

    tcp        0      0 0.0.0.0:143             0.0.0.0:*               LISTEN      0          92791      5989/dovecot        

    tcp6       0      0 :::993                  :::*                    LISTEN      0          92794      5989/dovecot        

    tcp6       0      0 :::995                  :::*                    LISTEN      0          92770      5989/dovecot        

    tcp6       0      0 :::110                  :::*                    LISTEN      0          92768      5989/dovecot        

    tcp6       0      0 :::143                  :::*                    LISTEN      0          92792      5989/dovecot        

    [root@westos-mail ~]# vim /etc/dovecot/dovecot.conf

     wKioL1klTCnD1y6IAAAhYwaZzQY437.png

    wKioL1klTE2itrEnAAAZ3vntLuI336.png

    wKiom1klTE3xgGo4AAAez7dUIOM887.png




    [root@westos-mail ~]# vim /etc/dovecot/conf.d/10-mail.conf

     wKioL1klTHeQvwQVAAAoCgPu5Tg728.png


     

    [root@westos-mail ~]# systemctl restart dovecot.service

    [root@westos-mail ~]# mkdir /etc/skel/mail/.imap -p

    [root@westos-mail ~]# touch /etc/skel/mail/.imap/INBOX

    [root@westos-mail ~]# passwd westos

    Changing password for user westos.

    New password:

    BAD PASSWORD: The password is shorter than 8 characters

    Retype new password:

    passwd: all authentication tokens updated successfully.

    [root@westos-mail ~]# mkdir /home/westos/mail/.imap -p

    [root@westos-mail ~]# touch /home/westos/mail/.imap/INBOX

     

     

     

    测试:

    mutt -f pop://westos@172.25.254.112

     

    wKiom1klTJ-B7yfYAACQnvZf69I911.png

    wKioL1klTJ-jAhx8AAAUxiB4yhw902.png

    wKioL1klTJ-h0-uRAAAmNQMq6oQ835.png

     

     

     

     profix+mysql

     

    1)准备工作:

    1 yum install httpd php php-mysql.x86_64 mariadb-server.x86_64 -y

    2 vim /etc/my.cnf

     

    内容:

    skip-networking = 1

     

    3 mysql_secure_installation ###数据库初始化###

    4 cd /var/www/html/

    5 tar jxf phpMyAdmin-3.4.0-all-languages.tar.bz2

    6 mv phpMyAdmin-3.4.0-all-languages/ myadmin

    7 cd myadmin/

    8 cp config.sample.inc.php config.inc.php

    9 vim config.inc.php

    wKioL1klTYLSA90NAAAad71j-1A462.png

    10 systemctl restart httpd

    11 create user postuser@localhost identified by 'postuser';

    12 create db ,usermessage,dbuser

     

    wKioL1klTaKgl0ztAABZuaeBjnk259.png

    wKiom1klTaPyMPEZAAAqqFmd7Fw160.png

    wKiom1klTaOyHEewAABYHBMXau8342.png


    2)配置

     

    1 cd /etc/postfix/

    2 vim mailuser.cf###用户名称查询###

     

    内容:

    hosts = localhost###数据库所在主机###

    user = postuser###登入数据库的用户###

    password = postuser###登入数据库的密码###

    dbname = email###postfix要查询的库的名称###

    table = emailuser###postfix要查询的表的名称###

    select_field = username###postfix要查询的字段###

    where_field = username###用户给定postfix的查询条件###

     

    3 cp mailuser.cf maildomain.cf###用户域名查询###

    4 vim maildomain.cf

    hosts = localhost

    user = postuser

    password = postuser

    dbname = email

    table = emailuser

    select_field = domain

    where_field = domain

     

    5 cp mailuser.cf mailbox.cf

    6 vim mailbox.cf ###用户邮箱查询###

     

     

    hosts = localhost

    user = postuser

    password = postuser

    dbname = email

    table = emailuser

    select_field = maildir

    where_field = username

     

    7 postmap -q "lee@lee.com" mysql:/etc/postfix/mailuser.cf ###查看是否会输出用户名,若输出,则说明写对了###

    8 postmap -q "lee.com" mysql:/etc/postfix/maildomain.cf

    9 postmap -q "lee@lee.com" mysql:/etc/postfix/mailbox.cf

     

    3)postfix配置

    1 groupadd -g 666 vmail

    2 useradd  -s /sbin/nologin -u 666 vmail -g 666

    3 postconf -d | grep virtual

    4 postconf -e "virtual_mailbox_base = /home/vmail"###设定虚拟用户的邮件目录###

    5 postconf -e "virtual_uid_maps = static:666"###虚拟用户建立文件的uid###

    6 postconf -e "virtual_gid_maps = static:666"###虚拟用户的建立文件的gid###

    7 postconf -e "virtual_alias_maps = mysql:/etc/postfix/mailuser.cf"

    8 postconf -e "virtual_mailbox_maps = mysql:/etc/postfix/mailbox.cf"

    9 postconf -e "virtual_mailbox_maps = mysql:/etc/postfix/maildomain.cf"

    测试是否写对:若是存在则说明写对了

    ll /etc/postfix/mailuser.cf

    ll /etc/postfix/mailbox.cf

    ll /etc/postfix/maildomain.cf

     

     

    测试:

    mail lee@lee.com###看能否使用数据库里的用户发送邮件###

     

     

    过程如下:

    [root@westos-mail myadmin]# cd /etc/postfix/

    [root@westos-mail postfix]# vim mailuser.cf

     

     

    hosts = localhost

    user = postuser

    password = postuser

    dbname = email

    table = emailuser

    select_field = username

    where_field = username

     

     

     

     

     

    [root@westos-mail postfix]# postmap -q "lee@lee.com" mysql:mailuser.cf

    postmap: fatal: bad string length 0 < 1: mailuser.cf_dbname =

    [root@westos-mail postfix]# postmap -q "lee@lee.com" mysql:/etc/postfix/mailuser.cf

    [root@westos-mail postfix]# postmap -q "lee@lee.com" mysql:/etc/postfix/mailuser.cf

    [root@westos-mail postfix]# vim mailuser.cf

    [root@westos-mail postfix]# postmap -q "lee@lee.com" mysql:/etc/postfix/mailuser.cf

    lee@lee.com

    [root@westos-mail postfix]# cp mailuser.cf maildomain.cf

    [root@westos-mail postfix]# vim maildomain.cf

     

    hosts = localhost

    user = postuser

    password = postuser

    dbname = email

    table = emailuser

    select_field = domain

    where_field = domain

    ~                        

     

     

     

    [root@westos-mail postfix]# postmap -q "lee.com" mysql:/etc/postfix/maildomain.cf

    lee.com,lee.com

    [root@westos-mail postfix]# cp mailuser.cf mailbox.cf

    [root@westos-mail postfix]# vim mailbox.cf

     

    hosts = localhost

    user = postuser

    password = postuser

    dbname = email

    table = emailuser

    select_field = maildir

    where_field = username

     

     

     

     

    [root@westos-mail postfix]# postmap -q "lee@lee.com" mysql:/etc/postfix/mailbox.cf

    postmap: warning: mysql query failed: Unknown column 'madir' in 'field list'

    postmap: fatal: table mysql:/etc/postfix/mailbox.cf: query error: Success

    [root@westos-mail postfix]# vim mailbox.cf

    [root@westos-mail postfix]# postmap -q "lee@lee.com" mysql:/etc/postfix/mailbox.cf

    /mnt/lee.com/lee

    [root@westos-mail postfix]#

     

     

     

     

     

     

     

    [root@westos-mail ~]# groupadd -g 666 vmail

    [root@westos-mail ~]# useradd  -s /sbin/nologin -u 666 vmail -g 666

    [root@westos-mail ~]# id vmail

    uid=666(vmail) gid=666(vmail) groups=666(vmail)

    [root@westos-mail ~]# postconf -d | grep virtual

    address_verify_virtual_transport = $virtual_transport

    propagate_unmatched_extensions = canonical, virtual

    proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $smtpd_sender_login_maps $sender_bcc_maps $recipient_bcc_maps $smtp_generic_maps $lmtp_generic_maps $alias_maps

    unknown_virtual_alias_reject_code = 550

    unknown_virtual_mailbox_reject_code = 550

    virtual_alias_domains = $virtual_alias_maps

    virtual_alias_expansion_limit = 1000

    virtual_alias_maps = $virtual_maps

    virtual_alias_recursion_limit = 1000

    virtual_delivery_slot_cost = $default_delivery_slot_cost

    virtual_delivery_slot_discount = $default_delivery_slot_discount

    virtual_delivery_slot_loan = $default_delivery_slot_loan

    virtual_destination_concurrency_failed_cohort_limit = $default_destination_concurrency_failed_cohort_limit

    virtual_destination_concurrency_limit = $default_destination_concurrency_limit

    virtual_destination_concurrency_negative_feedback = $default_destination_concurrency_negative_feedback

    virtual_destination_concurrency_positive_feedback = $default_destination_concurrency_positive_feedback

    virtual_destination_rate_delay = $default_destination_rate_delay

    virtual_destination_recipient_limit = $default_destination_recipient_limit

    virtual_extra_recipient_limit = $default_extra_recipient_limit

    virtual_gid_maps =

    virtual_initial_destination_concurrency = $initial_destination_concurrency

    virtual_mailbox_base =

    virtual_mailbox_domains = $virtual_mailbox_maps

    virtual_mailbox_limit = 51200000

    virtual_mailbox_lock = fcntl, dotlock

    virtual_mailbox_maps =

    virtual_minimum_delivery_slots = $default_minimum_delivery_slots

    virtual_minimum_uid = 100

    virtual_recipient_limit = $default_recipient_limit

    virtual_recipient_refill_delay = $default_recipient_refill_delay

    virtual_recipient_refill_limit = $default_recipient_refill_limit

    virtual_transport = virtual

    virtual_uid_maps =

    [root@westos-mail ~]# postconf -e "virtual_mailbox_base = /home/vmail"

    [root@westos-mail ~]# postconf -e "virtual_uid_maps = static:666"

    [root@westos-mail ~]# postconf -e "virtual_gid_maps = static:666"

    [root@westos-mail ~]# postconf -e "virtual_alias_maps = mysql:/etc/postfix/mailuser.cf"

    [root@westos-mail ~]# postconf -e "virtual_mailbox_maps = mysql:/etc/postfi/maildomain.cf

    [root@westos-mail ~]# postconf -e "virtual_mailbox_maps = mysql:/etc/postfix/mailbox.cf"

    [root@westos-mail ~]# ll /etc/postfix/mailuser.cf

    -rw-r--r--. 1 root root 134 May 21 04:06 /etc/postfix/mailuser.cf

    [root@westos-mail ~]# ll /etc/postfix/mailbox.cf

    -rw-r--r--. 1 root root 133 May 21 04:21 /etc/postfix/mailbox.cf

    [root@westos-mail ~]# ll /etc/postfix/maildomain.cf

    -rw-r--r--. 1 root root 130 May 21 04:19 /etc/postfix/maildomain.cf

    [root@westos-mail ~]# cd /home/vmail/

    [root@westos-mail vmail]# ls

    mail

    [root@westos-mail vmail]# mail lee@lee.com

    Subject: hello

    hello hello

    .

    EOT

    [root@westos-mail vmail]# mailq

    Mail queue is empty

    [root@westos-mail vmail]# ls

    lee.com  mail

    [root@westos-mail vmail]# cd lee.com/

    [root@westos-mail lee.com]# ls

    lee

    [root@westos-mail lee.com]# cd lee/

    [root@westos-mail lee]# ls

    cur  new  tmp

    [root@westos-mail lee]# cd new/

    [root@westos-mail new]# cat new/

    cat: new/: No such file or directory

    [root@westos-mail new]# cd ne

    -bash: cd: ne: No such file or directory

    [root@westos-mail new]# cd new/

    -bash: cd: new/: No such file or directory

    [root@westos-mail new]#

    [root@westos-mail new]# ls

    1495357341.Vfd01I30059aaM65037.westos-mail.westos.com

    [root@westos-mail new]# cat 1495357341.Vfd01I30059aaM65037.westos-mail.westos.com

    Return-Path: <root@westos.com>

    X-Original-To: lee@lee.com

    Delivered-To: lee@lee.com

    Received: by westos-mail.westos.com (Postfix, from userid 0)

    id DF62F273AC2; Sun, 21 May 2017 05:02:20 -0400 (EDT)

    Date: Sun, 21 May 2017 05:02:20 -0400

    To: lee@lee.com

    Subject: hello

    User-Agent: Heirloom mailx 12.5 7/5/10

    MIME-Version: 1.0

    Content-Type: text/plain; charset=us-ascii

    Content-Transfer-Encoding: 7bit

    Message-Id: <20170521090220.DF62F273AC2@westos-mail.westos.com>

    From: root@westos.com (root)

     

    hello hello














    本文转自blueclo51CTO博客,原文链接:http://blog.51cto.com/12774272/1929075 ,如需转载请自行联系原作者


    展开全文
  • centos7+sendmail+dovecot配置邮件服务

    千次阅读 2019-11-26 14:15:23
    配置虚拟机网络 配置虚拟机软件的网关 配置centos静态IP地址 vi /etc/sysconfig/network-scripts/ifcfg-ens33 修改内容 设置centos dns地址 vi /etc/resolv.conf 内容如下 重启网络 service network restart ...
  • Dovecot 配置

    2008-10-22 11:36:51
    #ssl_key_file = /etc/pki/dovecot/private/dovecot.pem #ssl_key_password = [root@station10 ~]# 6,修改配置文件: [root@station10 ~]# grep -e ssl_cert -e ssl_key /etc/dovecot.conf ssl_cert_file = /etc/...
  • Dovecot是一个安全性较好的POP3/IMAP服务器软件,响应速度快而且扩展性好 POP3 / IMAP 是 MUA 从邮件服务器中读取邮件时使用的协议。其中,POP3是从邮件服务器中下载邮件,而IMAP则是将邮件留在服务器端直接对邮件...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 4,395
精华内容 1,758
关键字:

dovecot配置