postfix - tips

最後更新: 2021-06-09

目錄

 


Clear mail from "MAILER-DAEMON"

 

cleanup.sh

# 找出 Mail ID
for i in `postqueue -p | grep 'MAILER-DAEMON' | awk {'print $1'}`
do
  mailid=`echo $i | tr '*' ''`
  echo $mailid
  # do some job
done

P.S.

postqueue -p

-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
84C46805669A*   11350 Wed Jun  9 18:26:46  MAILER-DAEMON

 


找出 User 的 password

 

main.cf

debug_peer_list = R.R.R.R

Version 2.6.6

log

... postfix/smtpd[27917]: < unknown[R.R.R.R]: AUTH LOGIN
... postfix/smtpd[27917]: xsasl_cyrus_server_first: sasl_method LOGIN
... postfix/smtpd[27917]: xsasl_cyrus_server_auth_response: uncoded server challenge: Username:
... postfix/smtpd[27917]: > unknown[R.R.R.R]: 334 xxxxxxxxxxxx
... postfix/smtpd[27917]: < unknown[R.R.R.R]: xxxxxxxxxxxxxxxx
... postfix/smtpd[27917]: xsasl_cyrus_server_next: decoded response: [email protected]
... postfix/smtpd[27917]: xsasl_cyrus_server_auth_response: uncoded server challenge: Password:
... postfix/smtpd[27917]: > unknown[R.R.R.R]: 334 xxxxxxxxxxxxx
... postfix/smtpd[27917]: < unknown[R.R.R.R]: xxxxxxxxxxxxxx
... postfix/smtpd[27917]: xsasl_cyrus_server_next: decoded response: test1234
... postfix/smtpd[27917]: warning: unknown[R.R.R.R]: SASL LOGIN authentication failed: authentication failure
... postfix/smtpd[27917]: > unknown[R.R.R.R]: 535 5.7.8 Error: authentication failed: authentication failure

 


postfix segfault

 

dmesg

smtpd[2199]: segfault at 400 ip 0045c5d7 sp bfed07cc error 6 in libresolv-2.12.so[451000+15000]

log

... postfix/postfix-script[2707]: warning: /var/spool/postfix/lib/libresolv-2.12.so and /lib/libresolv-2.12.so differ

發生情況

yum update 後

fix

# Backup
cd /var/spool/postfix/lib
mkdir _bak
mv *.so _bak

# Update Library
cd /lib
cp -a libnss* /var/spool/postfix/lib
cp -a libresolv* /var/spool/postfix/lib

 


Log Mail Subject

 

main.cf

header_checks = pcre:/etc/postfix/header_checks

/etc/postfix/header_checks

# Log
/^subject: /      WARN

# 修改 header_checks 後是需要 reload postfix 的 !!

postfix reload

log

... postfix/cleanup[34672]: ID: warning: header Subject: =?UTF-8?B?U2VydmVyIEJhY2t1cCDllY/poYw=?=
 from HOST[r.r.r.r]; from=<sender@from> to=<re@to> proto=ESMTP helo=<HOST>

P.S.

不用加

/^from: /   WARN
/^to: /    WARN

原因: 以下 msg 係會自動額外加上去的

 from HOST[R.R.R.R]; from=<sender@from> to=<recipient@to> proto=ESMTP helo=<HOST>

 


Bypass Amavis

 

/etc/postfix/header_checks

# Bypass amavis
# 由於是 first win, 所以要放頂
/^From: .*<?sender@domain>?/      FILTER smtp:[127.0.0.1]:10025

...
/^subject: /      WARN

 

 

Creative Commons license icon Creative Commons license icon