Recently was looking though the logs and found alot of this
so if anyone else has the same issue what helped was fail2ban and these are the steps, feel free to add if i missed something
1) install fail2ban
2) then copy the configs
3) then create rule
and add this
4) then edit the config
5) add this line at the bottom (port the ports i have 2 email servers which use another ports which is why the 28 and 27)
then restart fail2ban and to check run
iptables -L -n
and as you see it blocked that user was spamming
Code:
Dec 24 13:58:07 pmg postfix/smtpd[13854]: disconnect from unknown[110.82.240.28] ehlo=1 auth=0/1 commands=1/2
Dec 24 13:58:07 pmg postfix/postscreen[13536]: CONNECT from [110.82.240.28]:58941 to [192.168.3.141]:25
Dec 24 13:58:07 pmg postfix/postscreen[13536]: PASS OLD [110.82.240.28]:58941
Dec 24 13:58:07 pmg postfix/smtpd[13854]: warning: hostname 28.240.82.110.broad.np.fj.dynamic.163data.com.cn does not resolve to address 110.82.240.28: Name or service not known
Dec 24 13:58:07 pmg postfix/smtpd[13854]: connect from unknown[110.82.240.28]
Dec 24 13:58:08 pmg postfix/smtpd[13854]: lost connection after AUTH from unknown[110.82.240.28]
Dec 24 13:58:08 pmg postfix/smtpd[13854]: disconnect from unknown[110.82.240.28] ehlo=1 auth=0/1 commands=1/2
Dec 24 13:58:09 pmg postfix/postscreen[13536]: CONNECT from [110.82.240.28]:59015 to [192.168.3.141]:25
Dec 24 13:58:09 pmg postfix/postscreen[13536]: PASS OLD [110.82.240.28]:59015
Dec 24 13:58:09 pmg postfix/smtpd[13854]: warning: hostname 28.240.82.110.broad.np.fj.dynamic.163data.com.cn does not resolve to address 110.82.240.28: Name or service not known
Dec 24 13:58:09 pmg postfix/smtpd[13854]: connect from unknown[110.82.240.28]
Dec 24 13:58:09 pmg postfix/smtpd[13854]: lost connection after AUTH from unknown[110.82.240.28]
Dec 24 13:58:09 pmg postfix/smtpd[13854]: disconnect from unknown[110.82.240.28] ehlo=1 auth=0/1 commands=1/2
Dec 24 13:58:10 pmg postfix/postscreen[13536]: CONNECT from [110.82.240.28]:59108 to [192.168.3.141]:25
Dec 24 13:58:10 pmg postfix/postscreen[13536]: PASS OLD [110.82.240.28]:59108
Dec 24 13:58:10 pmg postfix/smtpd[13854]: warning: hostname 28.240.82.110.broad.np.fj.dynamic.163data.com.cn does not resolve to address 110.82.240.28: Name or service not known
Dec 24 13:58:10 pmg postfix/smtpd[13854]: connect from unknown[110.82.240.28]
Dec 24 13:58:11 pmg postfix/smtpd[13854]: lost connection after AUTH from unknown[110.82.240.28]
Dec 24 13:58:11 pmg postfix/smtpd[13854]: disconnect from unknown[110.82.240.28] ehlo=1 auth=0/1 commands=1/2
Dec 24 13:58:11 pmg postfix/postscreen[13536]: CONNECT from [110.82.240.28]:59182 to [192.168.3.141]:25
Dec 24 13:58:11 pmg postfix/postscreen[13536]: PASS OLD [110.82.240.28]:59182
Dec 24 13:58:11 pmg postfix/smtpd[13854]: warning: hostname 28.240.82.110.broad.np.fj.dynamic.163data.com.cn does not resolve to address 110.82.240.28: Name or service not known
Dec 24 13:58:11 pmg postfix/smtpd[13854]: connect from unknown[110.82.240.28]
Dec 24 13:58:12 pmg postfix/smtpd[13854]: lost connection after AUTH from unknown[110.82.240.28]
Dec 24 13:58:12 pmg postfix/smtpd[13854]: disconnect from unknown[110.82.240.28] ehlo=1 auth=0/1 commands=1/2
Dec 24 13:58:12 pmg postfix/postscreen[13536]: CONNECT from [110.82.240.28]:59275 to [192.168.3.141]:25
Dec 24 13:58:12 pmg postfix/postscreen[13536]: PASS OLD [110.82.240.28]:59275
so if anyone else has the same issue what helped was fail2ban and these are the steps, feel free to add if i missed something
1) install fail2ban
Code:
apt-get install fail2ban
2) then copy the configs
Code:
cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
3) then create rule
Code:
nano /etc/fail2ban/filter.d/postfix-auth.conf
Code:
# Fail2ban postfix-auth filter
[INCLUDES]
before = common.conf
[Definition]
_daemon = postfix/smtpd
failregex = ^%(__prefix_line)slost connection after .*\[<HOST>\]$
ignoreregex =
4) then edit the config
Code:
nano /etc/fail2ban/jail.local
5) add this line at the bottom (port the ports i have 2 email servers which use another ports which is why the 28 and 27)
Code:
[postfix-auth]
enabled = true
port = smtp,ssmtp,28,27
filter = postfix-auth
action = iptables[name=SMTP-auth, port=smtp, protocol=tcp]
logpath = /var/log/mail.info
maxretry = 2
bantime = 36000
findtime = 300
then restart fail2ban and to check run
iptables -L -n
and as you see it blocked that user was spamming
Code:
Chain f2b-SMTP-auth (1 references)
target prot opt source destination
REJECT all -- 110.82.240.28 0.0.0.0/0 reject-with icmp-port-unreachable
RETURN all -- 0.0.0.0/0 0.0.0.0/0