LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1606|回复: 2

postfix安好,telnet localhost 25 永远没反应。

[复制链接]
发表于 2008-10-29 16:52:57 | 显示全部楼层 |阅读模式
今天遇到的怪事真多。

$ telnet agape 25
或者
$ telnet localhost 25
[PHP]Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.[/PHP]

我最想看到的。220 localhost.localdomain ESMTP Postfix (Debian) 怎么都不出来。
输入ehlo、mail form等等任何命令无效,quit我想退出也退不出来,只能新开个终端。

$ tail -f /var/log/mail.log
[PHP]Oct 29 16:29:08 agape postfix/tlsmgr[10717]: fatal: open database /var/lib/postfix/smtpd_scache.db: Permission denied
Oct 29 16:29:09 agape postfix/master[10697]: warning: process /usr/lib/postfix/tlsmgr pid 10717 exit status 1
Oct 29 16:29:09 agape postfix/master[10697]: warning: /usr/lib/postfix/tlsmgr: bad command startup -- throttling
Oct 29 16:29:14 agape pop3d: chdir Maildir: No such file or directory
Oct 29 16:30:09 agape postfix/tlsmgr[10720]: fatal: open database /var/lib/postfix/smtpd_scache.db: Permission denied
Oct 29 16:30:10 agape postfix/master[10697]: warning: process /usr/lib/postfix/tlsmgr pid 10720 exit status 1
Oct 29 16:30:10 agape postfix/master[10697]: warning: /usr/lib/postfix/tlsmgr: bad command startup -- throttling
Oct 29 16:31:10 agape postfix/tlsmgr[10721]: fatal: open database /var/lib/postfix/smtpd_scache.db: Permission denied
Oct 29 16:31:11 agape postfix/master[10697]: warning: process /usr/lib/postfix/tlsmgr pid 10721 exit status 1
Oct 29 16:31:11 agape postfix/master[10697]: warning: /usr/lib/postfix/tlsmgr: bad command startup -- throttling[/PHP]

这是我的main.cf

$ cat /etc/postfix/main.cf
[PHP]# See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Debian)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# TLS parameters
smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.crt
smtpd_tls_key_file = /etc/postfix/ssl/smtpd.key
smtpd_use_tls = yes
smtpd_tls_session_cache_database = btree:/var/lib/postfix/smtpd_scache
smtp_tls_session_cache_database = btree:/var/lib/postfix/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

myhostname = agape
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = $myhostname, localhost, localhost.agape,
relayhost =
mynetworks = 127.0.0.0/8 192.168.1.0/24
config_directory = /etc/postfix
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
smtpd_sasl_local_domain =
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_sasl_authenticated_header = yes
smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination
smtpd_tls_auth_only = no
smtp_use_tls = yes
smtp_tls_note_starttls_offer = yes
smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
tls_random_source = dev:/dev/urandom[/PHP]

$ cat /etc/postfix/master.cf
[PHP]#
# Postfix master process configuration file.  For details on the format
# of the file, see the master(5) manual page (command: "man 5 master").
#
# Do not forget to execute "postfix reload" after editing this file.
#
# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (100)
# ==========================================================================
smtp      inet  n       -       -       -       -       smtpd
#submission inet n       -       -       -       -       smtpd
#  -o smtpd_tls_security_level=encrypt
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
#  -o milter_macro_daemon_name=ORIGINATING
#smtps     inet  n       -       -       -       -       smtpd
#  -o smtpd_tls_wrappermode=yes
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
#  -o milter_macro_daemon_name=ORIGINATING
#628      inet  n       -       -       -       -       qmqpd
pickup    fifo  n       -       -       60      1       pickup
cleanup   unix  n       -       -       -       0       cleanup
qmgr      fifo  n       -       n       300     1       qmgr
#qmgr     fifo  n       -       -       300     1       oqmgr
tlsmgr    unix  -       -       -       1000?   1       tlsmgr
rewrite   unix  -       -       -       -       -       trivial-rewrite
bounce    unix  -       -       -       -       0       bounce
defer     unix  -       -       -       -       0       bounce
trace     unix  -       -       -       -       0       bounce
verify    unix  -       -       -       -       1       verify
flush     unix  n       -       -       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
proxywrite unix -       -       n       -       1       proxymap
smtp      unix  -       -       -       -       -       smtp
# When relaying mail as backup MX, disable fallback_relay to avoid MX loops
relay     unix  -       -       -       -       -       smtp
        -o smtp_fallback_relay=
#       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq     unix  n       -       -       -       -       showq
error     unix  -       -       -       -       -       error
retry     unix  -       -       -       -       -       error
discard   unix  -       -       -       -       -       discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       -       -       -       lmtp
anvil     unix  -       -       -       -       1       anvil
scache    unix  -       -       -       -       1       scache
#
# ====================================================================
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# Many of the following services use the Postfix pipe(8) delivery
# agent.  See the pipe(8) man page for information about ${recipient}
# and other message envelope options.
# ====================================================================
#
# maildrop. See the Postfix MAILDROP_README file for details.
# Also specify in main.cf: maildrop_destination_recipient_limit=1
#
maildrop  unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
#
# See the Postfix UUCP_README file for configuration details.
#
uucp      unix  -       n       n       -       -       pipe
  flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
#
# Other external delivery methods.
#
ifmail    unix  -       n       n       -       -       pipe
  flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp     unix  -       n       n       -       -       pipe
  flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
scalemail-backend unix  -       n       n       -       2       pipe
  flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
mailman   unix  -       n       n       -       -       pipe
  flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
  ${nexthop} ${user}[/PHP]

大家觉得是哪里出问题了。postfix saslauthd都启动了。但telnet不行。

$ sudo /etc/init.d/postfix restart
* Stopping Postfix Mail Transport Agent postfix                                                            [ OK ]
* Starting Postfix Mail Transport Agent postfix                                                            [ OK ]

$ sudo /etc/init.d/saslauthd start
* Starting SASL Authentication Daemon saslauthd                                                            [ OK ]
 楼主| 发表于 2008-10-29 21:19:42 | 显示全部楼层
今天大脑反应迟钝了。我检查了又检查,我觉得没问题啊。可为什么我怎么就看了log提示没反应呢?最后折腾了一个小时,也不行。查看了log还是一样,才想起来进目录看看。一看,我才傻眼了:yun:,原来问题就在这里。

$ ls -la /var/lib/postfix
[PHP]total 28
drwxr-xr-x  2 postfix     postfix     4096 2008-09-27 04:56 .
drwxr-xr-x 35 root        root        4096 2008-10-29 14:59 ..
-rw-------  1 postfix     postfix     1024 2008-10-09 00:39 prng_exch
-rw-------  1 Debian-exim Debian-exim 8192 2008-10-08 19:00 smtpd_scache.db
-rw-------  1 Debian-exim Debian-exim 8192 2008-10-08 19:00 smtp_scache.db[/PHP]

Debian-exim 占用了这两个文件。我把权限给postfix。呵呵。

$ cd /var/lib/postfix/
$ sudo chown postfix:postfix smtpd_scache.db
$ sudo chown postfix:postfix smtp_scache.db

$ ls -la
[PHP]total 28
drwxr-xr-x  2 postfix postfix 4096 2008-09-27 04:56 .
drwxr-xr-x 35 root    root    4096 2008-10-29 14:59 ..
-rw-------  1 postfix postfix 1024 2008-10-09 00:39 prng_exch
-rw-------  1 postfix postfix 8192 2008-10-29 20:48 smtpd_scache.db
-rw-------  1 postfix postfix 8192 2008-10-08 19:00 smtp_scache.db[/PHP]

$ telnet agape 25
[PHP]Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 agape ESMTP Postfix (Debian)[/PHP]

搞定了。
回复 支持 反对

使用道具 举报

发表于 2008-10-30 17:54:37 | 显示全部楼层
好,支持一下。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表