加载评论时出现问题。

Find spam activity in Plesk (Postfix)

支持门户  »  Knowledgebase  »  查看文章

  打印
This post helps you to find spam activity in Plesk. Plesk supports two Mail Transfer Agents (MTA). They are Postfix and Qmail. The newer versions of Plesk installed with Postfix mail server by default.

I have already written a post about Useful Postfix commands. You can see that thread before proceeding. Also, to identify the spam source in Plesk, you need to follow the below steps.

1. Create /usr/sbin/sendmail.postfix-wrapper script:

You can use your favourite editor to create the script. I am using VIM here.

  • vim /usr/sbin/sendmail.postfix-wrapper

Add the following into it.

  • #!/bin/sh
  • (echo X-Additional-Header: $PWD ;cat) | tee -a /var/tmp/mail.send|/usr/sbin/sendmail.postfix-bin "$@"

2. Create a log file

  • touch /var/tmp/mail.send
  • chmod a+rw /var/tmp/mail.send

3. Set the executable permission for the wrapper script

  • chmod a+x /usr/sbin/sendmail.postfix-wrapper

4. Rename the sendmail.postfix script and link it to the wrapper script

  • mv /usr/sbin/sendmail.postfix /usr/sbin/sendmail.postfix-bin
  • ln -s /usr/sbin/sendmail.postfix-wrapper /usr/sbin/sendmail.postfix

Wait for some time (10 minutes to 60 minutes) and check the log file /var/tmp/mail.send. Also, revert the sendmail.postfix script back.

  • rm -f /usr/sbin/sendmail.postfix
  • mv /usr/sbin/sendmail.postfix-bin /usr/sbin/sendmail.postfix

To find the spam originating directory, run the following command:

  • grep X-Additional /var/tmp/mail.send | grep `cat /etc/psa/psa.conf | grep HTTPD_VHOSTS_D | sed -e 's/HTTPD_VHOSTS_D//' `

The above command will show you the spam originating directory consisting of the problematic PHP script.

That’s it!

通过分享

相关文章

Copyright © 2026 TheGigabit. All right reserved. Reg.No: 200701034297 (792326-P)