mitchellkrogza / nginx-ultimate-bad-bot-blocker

Nginx Block Bad Bots, Spam Referrer Blocker, Vulnerability Scanners, User-Agents, Malware, Adware, Ransomware, Malicious Sites, with anti-DDOS, Wordpress Theme Detector Blocking and Fail2Ban Jail for Repeat Offenders
Other
3.97k stars 477 forks source link

Not getting Emails #342

Closed RealSuprim closed 4 years ago

RealSuprim commented 4 years ago

Hi there,

For some reason I am not getting any emails to my account. This is what it looks like on my setup

MAILTO=support@mydomain.net
15 3 * * 7 certbot renew --post-hook "service nginx restart"
00 22 * * * sudo /usr/local/sbin/update-ngxblocker -e support@mydomain.net

00 08 * * * tail -10000 /var/log/nginx/mydomain-access.log | awk '$11 !~ /google|bing|yahoo|yandex|mywebsite.net/' | awk '{print $11}' | tr -d '"' | sort | uniq -c | sort -rn | head -1000 | mail -s "Top 1000 Referers for Mydomain.com" support@mydomain.net

00 08 * * * tail -50000 /var/log/nginx/mydomain-access.log | awk '{print $12}' | tr -d '"' | sort | uniq -c | sort -rn | head -1000 | mail -s "Top 1000 Agents for Mydomain.net" support@mydomain.net

Thanks

itoffshore commented 4 years ago

To diagnose this issue send an email from a shell manually & check your mail logs:

mail -s "Top 1000 Agents for Mydomain.net" support@mydomain.net

RealSuprim commented 4 years ago

hmm for some reason my port 25 and port 487 are blocked. I contacted my service provider and they said it is open on their side and told me to check on server side firewall but I don't use any firewall except this ultimate bot blocker. Could it have blocked my port?

Thanks

mitchellkrogza commented 4 years ago

Hi @RealSuprim not possible at all. The blocker does nothing to block any ports whatsoever. Sure you don't have iptables installed?

mitchellkrogza commented 4 years ago

I do not advise disabling it. Rather learn to configure it and open the ports you need and close the ones you do not need.

But for now if you want to disable it > https://www.cyberciti.biz/faq/turn-on-turn-off-firewall-in-linux/

nixCraft
HowTo Disable The Iptables Firewall in Linux - nixCraft
I need to disable firewall in Linux for testing purpose. I'm using CentOS and RHEL version 4.4 / 5 / 6. How do I disable the firewall in Linux?
itoffshore commented 4 years ago

@RealSuprim - if you are using gmail as your relay you probably want something like

iptables -A OUTPUT -p tcp --dport 587 --ctstate NEW -j ACCEPT

Note port 587 (TLS) not 487

RealSuprim commented 4 years ago

Hi @itoffshore this is what I get when I put sudo iptables -Scommand. I am really sorry guys I am new to all this and struggling.

-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
-N f2b-nginx-botsearch
-N f2b-nginx-limit-req
-N f2b-ssh
-N f2b-sshd
-A INPUT -p tcp -m multiport --dports 80,443 -j f2b-nginx-botsearch
-A INPUT -p tcp -m multiport --dports 80,443 -j f2b-nginx-limit-req
-A INPUT -p tcp -m multiport --dports 22 -j f2b-ssh
-A INPUT -p tcp -m multiport --dports 22 -j f2b-sshd
-A INPUT -p tcp -m multiport --dports 22 -j f2b-sshd
-A OUTPUT -p tcp -m tcp --dport 25 -j LOG --log-prefix "mail connection"
-A OUTPUT -p tcp -m tcp --dport 25 -j ACCEPT
-A OUTPUT -p tcp -m tcp --dport 587 -j ACCEPT
-A OUTPUT -p tcp -m tcp --sport 25 -j ACCEPT
-A OUTPUT -p tcp -m tcp --sport 587 -j ACCEPT
-A OUTPUT -p tcp -m tcp --sport 25 -j ACCEPT
-A OUTPUT -p tcp -m tcp --sport 587 -j ACCEPT

Thanks

RealSuprim commented 4 years ago

I am using zoho mail service

itoffshore commented 4 years ago

you need to look at the logs of whatever you use to send mail from your web server