Truman Boyes零与一

存档 · IPv6

使用 grep 在 postfix 日志中查找 IPv6 连接

作者:Truman Boyes · · 1 分钟阅读

下面的 grep 和 egrep 命令将匹配目前已分配的 IPv6 地址块(我已更新以匹配 AFRINIC 块):

grep smtp /var/log/maillog| egrep “(\[2[0,4,6,8]0[1-3]:|\[2A00:|\[2C00:)"

它会显示如下日志:

May 28 05:00:50 inanna postfix/smtpd[25029]: connect from mout4.freenet.de[2001:748:100:40::2:6]
May 28 05:00:50 inanna postfix/smtpd[25029]: setting up TLS connection from mout4.freenet.de[2001:748:100:40::2:6]
May 28 05:00:50 inanna postfix/smtpd[25029]: TLS connection established from mout4.freenet.de[2001:748:100:40::2:6]: TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)
May 28 05:00:50 inanna postfix/smtpd[25029]: NOQUEUE: reject: RCPT from mout4.freenet.de[2001:748:100:40::2:6]: 450 <[email protected]>: Recipient address rejected: Greylisted for 300 seconds (see http://isg.ee.ethz.ch/tools/postgrey/help/suspicious.org.html); from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<mout4.freenet.de>
May 28 05:00:51 inanna postfix/smtpd[25029]: disconnect from mout4.freenet.de[2001:748:100:40::2:6]
May 28 06:19:02 inanna postfix/smtpd[25551]: connect from mout4.freenet.de[2001:748:100:40::2:6]
May 28 06:19:03 inanna postfix/smtpd[25551]: setting up TLS connection from mout4.freenet.de[2001:748:100:40::2:6]
May 28 06:19:03 inanna postfix/smtpd[25551]: TLS connection established from mout4.freenet.de[2001:748:100:40::2:6]: TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)


最初发表于 truman.net。查看存档副本。