Mar 10 19:21:31 v22017014258144095 sshd[30173]: Failed password for root from 118.212.135.3 port 60201 ssh2
Mar 10 19:21:31 v22017014258144095 sshd[30175]: Failed password for root from 58.218.199.182 port 33242 ssh2
Mar 10 19:21:33 v22017014258144095 sshd[30175]: Failed password for root from 58.218.199.182 port 33242 ssh2
Mar 10 19:21:33 v22017014258144095 sshd[30173]: Failed password for root from 118.212.135.3 port 60201 ssh2
Mar 10 19:21:36 v22017014258144095 sshd[30175]: Failed password for root from 58.218.199.182 port 33242 ssh2
Above has been going on for days.
Reference:
http://anti-hacker-alliance.com/index.php?ip=58.218.199.182
http://bannedhackersips.blogspot.com/2017/01/fail2ban-ssh-banned-1182121353-from.html
Do something about it.
This nifty script by: Tim Kennell Jr. ~ tikenn Source
The below code was slightly modified to be easier to copy - paste.
#!/bin/bash
DOWNLOAD=/opt/hulk
STORE=/etc/nginx/conf.d/
mkdir "$DOWNLOAD"
[[ -f "$DOWNLOAD/bannedips.zip" ]] && rm "$DOWNLOAD/bannedips.zip"
wget -O "$DOWNLOAD/bannedips.zip" http://www.stopforumspam.com/downloads/bannedips.zip
unzip -o "$DOWNLOAD/bannedips.zip" -d "$DOWNLOAD"
[[ -f "$STORE/bannedips.conf" ]] && rm "$STORE/bannedips.conf"
while read -r -d , ip ; do
echo "deny $ip;" >> "$STORE/bannedips.conf"
done < "$DOWNLOAD/bannedips.csv"
service nginx reload
To use it:
Create a file and paste above code into it and save it. Then give it permissions.
nano hulk.sh
Copy - Paste the script, CTRL-X, Y to save.
sudo chmod +x hulk.sh
./hulk.sh
Above script is great for blocking spammers but I noticed it did not include my attackers from China.
So I edited /etc/nginx/conf.d/bannedips.conf and added:
deny 118.212.135.3;
deny 58.218.199.182;
Nginx Bad Bot Blocker
https://github.com/mariusv/nginx-badbot-blocker/tree/master/VERSION_2
Fail2ban
A great resource for setting up Fail2ban.
https://www.linode.com/docs/security/using-fail2ban-for-security
Other helpful links:
http://www.parkansky.com/china.htm
http://www.wizcrafts.net/iptables-blocklists.html