Trace local PHP mail sending to a system user
website sending spam | which script is sending emails | find spam sent via contact form | grep | postfix | spam | phpgrep "postfix/pickup" /var/log/maillog | grep -o "uid=[0-9]*" | sort | uniq -c | sort -rn | head -10Mail that PHP scripts send via sendmail appears in the log with the UID of the submitting user. The list shows which UID sends the most. Using id -nu with the UID gives you the system user and thus the webspace.
Note: With PHP-FPM running as the domain user, the mapping is unambiguous. If PHP runs as an Apache module, only the UID of www-data appears.
Also searched as
- website sending spam
- which script is sending emails
- find spam sent via contact form