Im still relatively new and green to being a linux admin. I had to take over a few servers some months ago and they all have a number of problems and Ive been fixing what I can but Im still learning a lot of this stuff at the same time.
They are all CentOS (6.9) WHM/Cpanel servers with LAMP stacks with a larger number of websites on different ips and one of them seemed to have a mail spam issue. I found that the disk space was filling up very fast in places such as /var/log/exim and in exim_mainlog there were records like this:
2017-06-28 23:02:42 1dQPj7-0005Mm-JP <= NAME@MYDOMAIN H=([127.0.0.1]) [78.90.72.196]:41899 P=esmtpa A=dovecot_plain:NAME@one_of_my_site.com S=15548 id=4D248BBE.3420710@one_of_my_sites.com T="Hand regard: following the hand with the eyes!" for some_name@prodigy.net
some_other_name@google.comanother_name@yahoo.com etc etc...
I posted this in another thread on /r/webhosting at the time and was told that the account was compromised and most likely sending spam emails. So I deleted that email address (and all other emails for that site I think) from that account and also changed all logins and pws. I also changed or deleted something else related to exim as the /exim directory stopped filling up then but I cant recall exactly what I did.
Emails are not working for the any of the sites at all on the sever though still and I would like to fix it now. Ive tried sending test mails and it just hangs and nothing comes through. None of the email reports from cron jobs come through either and no messages from the contact forms on the websites are delivered.
The cpanel Mail Queue Manager has a bunch of frozen messages that seem to be from 'System' to 'root@server.my_server_name.com' and these mostly seem to be ones trying to send to my own Gmail accounts and failing due to the ip missing a PTR record.
I can the server name through mxtoolbox.com and got an ip back that some of my sites reside on so I guess that means that mail is sent from that ip to? After doing an SMTP test I got the following results too:
SMTP Reverse DNS Mismatch Reverse DNS does not contain the hostname SMTP Valid Hostname Reverse DNS is not a valid Hostname SMTP Banner Check Reverse DNS does not match SMTP Banner SMTP TLS Warning - Does not support TLS. SMTP Transaction Time 15.067 seconds - Not good! on Transaction Time More Info SMTP Connection Time 0 seconds - Good on Connection time SMTP Open Relay OK - Not an open relay.
also it seems the ip is blacklisted on BARRACUDA (all other spam lists returned green though)
here's a sample of exim_mainlog:
2017-10-09 06:37:49 1e1VRU-00034a-Ie ** some_person@gmail.com R=lookuphost T=remote_smtp H=gmail-smtp-in.l.google.com [173.194.74.27] X=TLSv1.2:ECDHE-RSA- AES128- GCM-SHA256:128 CV=yes: SMTP error from remote mail server after end of data: 550-5.7.1 [129.121.177.10] The IP address sending this message does not have a\n550-5.7.1 PTR record setup. As a policy, Gmail does not accept messages from\n550-5.7.1 IPs with missing PTR records. Please visit\n550-5.7.1
https://support.google.com/mail/answer/81126#authentication for more\n550 5.7.1 information. p10si6085927ite.12 - gsmtp 2017-10-09 06:37:49 cwd=/var/spool/exim 7 args: /usr/sbin/exim -t -oem -oi -f <> -E1e1VRU-00034a-Ie 2017-10-09 06:37:49 1e1VRV-00034u-By <= <> R=1e1VRU-00034a-Ie U=mailnull P=local S=2923 T="Mail delivery failed: returning message to sender" for one_of_my_sites@server.MY_SERVER_NAME.com 2017-10-09 06:37:49 cwd=/var/spool/exim 3 args: /usr/sbin/exim -Mc 1e1VRV-00034u-By 2017-10-09 06:37:49 1e1VRU-00034a-Ie Completed 2017-10-09 06:37:49 1e1VRV-00034u-By => ONE_OF_MY_SITES < one_of_my_sites@server.MY_SERVER_NAME.com> R=localuser T=dovecot_delivery S=3107 C="250 2.0.0 < one_of_my_sites@server.MY_SERVER_NAME.com> CIzRIX1R21kxLgAAQA8zkQ Saved" 2017-10-09 06:37:49 1e1VRV-00034u-By Completed 2017-10-09 06:37:50 SMTP connection from [171.61.112.215]:51188 (TCP/IP connection count = 1) 2017-10-09 06:37:50 SMTP connection from [182.18.168.216]:42187 (TCP/IP connection count = 2)
here's a sample output from exim_rejectlog
2017-10-09 06:30:24 dovecot_plain authenticator failed for (aahzvnlmll) [185.110.241.27]:64693: 535 Incorrect authentication data (set_id=support@ONE_OF_MY_SITES.com) 2017-10-09 06:30:30 dovecot_login authenticator failed for (aahzvnlmll) [185.110.241.27]:64693: 535 Incorrect authentication data (set_id=support@ONE_OF_MY_SITES.com)
2017-10-09 06:33:09 dovecot_plain authenticator failed for (info-api.ru) [93.174.93.46]:59517: 535 Incorrect authentication data (set_id=admin@MY_SERVER_NAME.com)
Ive spent most of today reading up about Exim, Dovecot and how to setup mail severs but still feeling pretty overwhelmed and not sure where to start or even what my exact problem is.
What would be my best course of action here? Would removing everything and setting everything up again from scratch be an option?
thanks