How to Identify Spam Activity in Plesk (Qmail)
This post helps you to identify spam activity in Plesk server using Qmail. 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 Qmail 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 /var/qmail/bin/sendmail-wrapper script:
You can use your favourite editor to create the script. I am using VIM here.
vim /var/qmail/bin/sendmail-wrapper
Add the following to it.
#!/bin/sh (echo X-Additional-Header: $PWD ;cat) | tee -a /var/tmp/mail.send|/var/qmail/bin/sendmail-wrapper "$@"
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 /var/qmail/bin/sendmail-wrapper
4. Rename the sendmail.postfix script and link it to the wrapper script
mv /var/qmail/bin/sendmail /var/qmail/bin/sendmail-qmail ln -s /var/qmail/bin/sendmail-wrapper /var/qmail/bin/sendmail
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 /var/qmail/bin/sendmail mv /var/qmail/bin/sendmail-qmail /var/qmail/bin/sendmail
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!
Also Read:
- Fix: BUSY: Update operation was locked by another update process
- How to backup and restore Plesk Database
- Block outgoing email of a domain in Plesk – Postfix
- How to Install ImageMagick on Plesk Server
- 7 Best Evernote Clients and Alternatives for Ubuntu
- How to Combine Apache Access Logs in cPanel
- Install UFW Firewall on Ubuntu or Debian based distros
- Fix: retry time not reached for any host after a long failure period
- Find outdated versions of WordPress and Joomla on your server
If you like this post and wish to receive more articles from us, please like our FB page: GrepItOut
Your suggestions and feedbacks will encourage us and help to improve further, please feel free to write your comments.
For more details on our services, please drop us an E-mail at info@grepitout.com
Add Comment