我正在运行带有 postifx 2.11.3-1 的 Debian 8.5,我尝试将整个 smtp 会话(包括数据)记录到mail.log
.
-vvv
通过添加到smtpd
in 中(参见下面的整个文件)来增加详细程度,可以看到部分数据,master.cf
但我不可能获得完整的数据,只记录了前 10 个字符。
邮件日志
--- snip ---
Sep 18 18:22:03 vagrant postfix/smtpd[9220]: rec_put: type T len 17 data 1474215723
Sep 18 18:22:03 vagrant postfix/smtpd[9220]: rec_put: type A len 18 data log_ident=
Sep 18 18:22:03 vagrant postfix/smtpd[9220]: rec_put: type A len 21 data rewrite_co
Sep 18 18:22:03 vagrant postfix/smtpd[9220]: rec_put: type S len 23 data foo@exampl
Sep 18 18:22:03 vagrant postfix/smtpd[9220]: rec_put: type A len 25 data log_client
--- snip ---
Run Code Online (Sandbox Code Playgroud)
另外,通过增加冗长的后缀,确实会记录很多日志。除了增加详细程度之外,还有更好的方法吗?
据我发现只能使用 tcpdump 或 whireshark 来真正只记录 smtp 会话,我认为这是正确的吗?
我想要记录的示例 smtp 会话:
telnet www.sample.com 25
Server Response: 220 www.sample.com ESMTP Postfix
Client Sending : HELO domain.com
Server Response: 250 Hello domain.com
Client Sending : MAIL FROM: <me@domain.com>
Server Response: 250 Ok
Client Sending : RCPT TO: <friend@sample.com>
Server Response: 250 Ok
Client Sending : DATA
Server Response: 354 End data with <CR><LF>.<CR><LF>
Client Sending : Subject: Example Message
Client Sending : From: me@domain.com
Client Sending : To: you@sample.com
Client Sending :
Client Sending : Yo,
Client Sending :
Client Sending : Sending a test message.
Client Sending :
Client Sending : Later,
Client Sending : Carl
Client Sending : .
Server Response: 250 Ok: queued as 45334
Client Sending : QUIT
Server Response: 221 Bye
Run Code Online (Sandbox Code Playgroud)
大师.cf
smtp inet n - - - - smtpd -vvv
pickup unix n - - 60 1 pickup
cleanup unix n - - - 0 cleanup
qmgr unix n - n 300 1 qmgr
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
relay unix - - - - - smtp
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
maildrop unix - n n - - pipe
flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
uucp unix - n n - - pipe
flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
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}
Run Code Online (Sandbox Code Playgroud)
主文件
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
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
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = localhost.at.dev
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = localhost.at.dev
mydestination = localhost.at.dev, 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
Run Code Online (Sandbox Code Playgroud)
在该级别进行日志记录并拥有可用的日志确实很难。我只在设置为调试级别的客户端中看到它。您也许可以对每条有用的消息进行日志记录。
您有什么理由需要此级别的日志吗?您应该能够创建消息的卷影副本,但这会排除所使用的命令。
获取命令相对容易exim4
,但我认为获取响应就没那么容易了。数据是另一回事,但您应该能够捕获包含数据的假脱机文件。我相信由于 Postfix 的结构方式,在 Postfix 中获取命令更加困难。
归档时间: |
|
查看次数: |
2965 次 |
最近记录: |