linux 安装配置 postfix+pop3+sasl

这是我这几天来配置linux环境下的邮件服务器的汇总


首先介绍下环境与提前准备。
            postfix      192.168.1.121
  
 1.在自己的域名服务商添加 域名 与A记录,我的是内部测试也就在自己的内部DNS 上添加了 以下记录
                    IN      MX       10  mail.ludy.com  
mail             IN      A             192.168.6.121

这一步必须要做,不然就是你能发邮件到外部邮箱,但外部邮箱发不了给你。会提示找不到该域名
 
2. 安装软件  postfix   dovecot-pop3d    sasl2  因为我是ubuntu 我就懒点,编译安装就不多说了。
shell $>     apt-get install sasl2-bin postfix dovecot-pop3d

3.修改 saslauthd 配置文件
shell $> vim /etc/default/saslauthd
START=yes
DESC="SASL Authentication Daemon"
NAME="saslauthd"
MECHANISMS="shadow"
MECH_OPTIONS=""
THREADS=5
OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd"
 
4.重启 saslauthd 服务
shell $> /etc/init.d/saslauthd restart
ln -s /var/spool/postfix/var/run/saslauthd/ /var/run/saslauthd
## 不做这步操作,验证总是报错.
shell $> adduser postfix sasl
shell $> testsaslauthd -u root -p 123
0: OK "Success."
 
5. 配置  dovecot pop3服务
shell $> vim /etc/dovecot/dovecot.conf
protocols = pop3 pop3s
log_timestamp = "%Y-%m-%d %H:%M:%S "
disable_plaintext_auth = no
mail_privileged_group = mail
protocol imap {
}
protocol pop3 {
       pop3_uidl_format = %08Xu%08Xv
}
protocol managesieve {
       sieve=~/.dovecot.sieve
       sieve_storage=~/sieve
}
auth default {
  mechanisms = plain login
  passdb pam {
  }
  userdb passwd {
  }
 user = root
 socket listen {
    client {
      path = /var/spool/postfix/private/auth-client
      mode = 0660
        user = postfix
        group = postfix
    }
  }
}
dict {
}
plugin {
}
 
6.重启 dovecot 服务
shell $> /etc/init.d/dovecot restart
 
7.测试 dovecot pop 服务
shell $> telnet localhost 110
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
+OK Dovecot ready.
user yang1
+OK
pass ypmwbg
+OK Logged in.
quit
+OK Logging out.
quit
### logging 成功
 
8.配置 postfix 服务
shell $> vim /etc/postfix/main.cf

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
append_dot_mydomain = no
readme_directory = no
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
myhostname = mail.ludy.com
mydomain = ludy.com
myorigin = $mydomain
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = ludy.com, mail.ludy.com, localhost.ludy.com, , localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth-client
smtpd_sasl_auth_enable = yes
smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination
 
修改 master.cf
shell $> vim master.cf
smtp      inet  n       -       -       -       -       smtpd
替换为
smtp      inet  n       -       n       -       -       smtpd
 
9.重启 postfix 服务
/etc/init.d/postfix restart
 
10.测试 postfix 服务smtp
shell $> telnet localhost 25
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 mail.ludy.com ESMTP Postfix (Ubuntu)
ehlo mail.ludy.com
250-mail.ludy.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
quit
 
11.添加用户
shell $> adduser  yang1           
shell $> adduser  yang2
 
##密码大家自己记得啊。

12. FOXMAIL测试

打开帐号管理,添加帐号


设置 pop3 服务器,由于我们都安装在了一台机器上,都是一个mail.mplite.com


然后同样的操作,再添加 yang2 这个用户,以便我们发收信建做测试.


发信测试:



点击收取,查看yang2的收件箱



收到了!接下来就可以测试发送/接收外部邮箱的邮件了!

展开阅读全文

postfix sasl认证出错.....

06-02

main.cf-----------------------rnrnqueue_directory = /var/spool/postfixrnrncommand_directory = /usr/sbinrnrndaemon_directory = /usr/libexec/postfixrnrnmail_owner = postfixrnrnmyhostname = mail.gdvcp.netrn#myhostname = virtual.domain.tldrnrnmydomain = gdvcp.netrnrnmyorigin = $myhostnamern#myorigin = $mydomainrnrn#inet_interfaces = allrn#inet_interfaces = $myhostnamern#inet_interfaces = $myhostname, localhostrninet_interfaces =allrnrn# The proxy_interfaces parameter specifies the network interfacern# addresses that this mail system receives mail on by way of arn# proxy or network address translation unit. This setting extendsrn# the address list specified with the inet_interfaces parameter.rn#rn# You must specify your proxy/NAT addresses when your system is arn# backup MX host for other domains, otherwise mail delivery loopsrn# will happen when the primary MX host is down.rn#rn#proxy_interfaces =rn#proxy_interfaces = 1.2.3.4rnrnmydestination = $myhostname,$mydomain, localhostrnrnunknown_local_recipient_reject_code = 550rnrnmynetworks = 168.100.189.0/28, 127.0.0.0/8,192.168.0.0/100,192.168.1.0/100rn#mynetworks = $config_directory/mynetworksrn#mynetworks = hash:/etc/postfix/network_tablernrnrelay_domains =gdvcp.netrnrnalias_database = hash:/etc/aliasesrnrndebug_peer_level = 2rnrndebugger_command =rn PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/binrn xxgdb $daemon_directory/$process_name $process_id & sleep 5rnrnsendmail_path = /usr/sbin/sendmail.postfixrnrn# newaliases_path: The full pathname of the Postfix newaliases command.rn# This is the Sendmail-compatible command to build alias databases.rn#rnnewaliases_path = /usr/bin/newaliases.postfixrnrn# mailq_path: The full pathname of the Postfix mailq command. Thisrn# is the Sendmail-compatible mail queue listing command.rn# rnmailq_path = /usr/bin/mailq.postfixrnrn# setgid_group: The group for mail submission and queue managementrn# commands. This must be a group name with a numerical group ID thatrn# is not shared with other accounts, not even with the Postfix account.rn#rnsetgid_group = postdroprnrn# html_directory: The location of the Postfix HTML documentation.rn#rnhtml_directory = nornrnsample_directory = /usr/share/doc/postfix-2.3.3/samplesrnrn# readme_directory: The location of the Postfix README files.rn#rnreadme_directory = /usr/share/doc/postfix-2.3.3/README_FILESrnrnsmtpd_sasl_auth_enable = yes //启用sasl验证 rnsmtpd_sasl_security_options = noanonymous //设定验证机制,拒绝匿名用户 rnbroken_sasl_auth_clients = yes //rnsmtpd_recipient_restrictions = rn permit_sasl_authenticated, rn permit_mynetworks, rn reject_unauth_destination[img=http://b39.photo.store.qq.com/http_imgload.cgi?/rurl4_b=330ec2dd367158f41360ab48d297c5dc1561e19bb25efa7d4e1f9f4ac0fdde32b220c3e8078590a61f8c67490a22776e2b7d495d105275b9c815b4268751276b2d9e15802cc15c2fecfff375748805eb9a2daf2f&a=38&b=39][/img]rnrn 论坛

postfix cyrus-imapt linux邮件服务器

03-12

1.通过postfix发邮件时,有这样的日志,如下:rnrnMar 12 20:15:17 localhost postfix/smtpd[18252]: connect from unknown[192.168.59.104]rnMar 12 20:15:17 localhost postfix/smtpd[18252]: 170F6E55A: client=unknown[192.168.59.104]rnMar 12 20:15:17 localhost postfix/cleanup[18257]: 170F6E55A: message-id=<>rnMar 12 20:15:17 localhost postfix/qmgr[18120]: 170F6E55A: from=, size=345, nrcpt=1 (queue active)rnMar 12 20:15:17 localhost postfix/smtpd[18252]: disconnect from unknown[192.168.59.104]rnMar 12 20:15:17 localhost lmtpunix[17968]: accepted connectionrnMar 12 20:15:17 localhost lmtpunix[17968]: lmtp connection preauth'd as postmanrnMar 12 20:15:17 localhost master[18260]: about to exec /usr/lib/cyrus-imapd/lmtpdrnMar 12 20:15:17 localhost lmtpunix[18260]: executedrnMar 12 20:15:17 localhost lmtpunix[17968]: [b]IOERROR: fstating sieve script /var/lib/imap/sieve/c/cwp/defaultbc: No such file or directory[/b]rnMar 12 20:15:17 localhost lmtpunix[17968]: duplicate_check: user.cwp 0rnMar 12 20:15:17 localhost lmtpunix[17968]: duplicate_check: user.cwp 0rnMar 12 20:15:17 localhost lmtpunix[17968]: Delivered: to mailbox: user.cwprnMar 12 20:15:17 localhost lmtpunix[17968]: mystore: starting txn 2147483651rnMar 12 20:15:17 localhost lmtpunix[17968]: mystore: committing txn 2147483651rnMar 12 20:15:17 localhost lmtpunix[17968]: duplicate_mark: user.cwp 1331597717 132rnMar 12 20:15:17 localhost postfix/lmtp[18259]: 170F6E55A: to=, relay=mail.e6000.com[/var/lib/imap/socket/lmtp], delay=0.22, delays=0.09/0.01/0.01/0.11, dsn=2.1.5, status=sent (250 2.1.5 Ok)rnMar 12 20:15:17 localhost postfix/qmgr[18120]: 170F6E55A: removedrnrnrnrnrn2.通过SquirrelMail (web)登陆时提示如下,rnERROR rnUnknown user or password incorrect. rnrn服务端日志如下:rnMar 12 20:16:17 localhost master[17930]: process 17968 exited, status 0rnMar 12 20:16:27 localhost imap[17969]: accepted connectionrnMar 12 20:16:27 localhost master[18265]: about to exec /usr/lib/cyrus-imapd/imapdrnMar 12 20:16:27 localhost imap[17969]: badlogin: localhost [::1] PLAIN [SASL(-16): encryption needed to use mechanism: security flags do not match required]rnMar 12 20:16:27 localhost imap[18265]: executed 论坛

没有更多推荐了,返回首页