What's new

Script to block DoS IP addresses reported in the log

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

multicast

Regular Contributor
Hi everyone

Just in case someone need it, I wrote a script to block the IP addresses reported as DoS attacks in the log for the R9000 using Voxel's firmware, just add it to your crontab and have it run hourly, it will capture all the IPs reported and block them in the INPUT filter in IPTABLES

add in crontab

0 * * * * * /root/shieldup.sh attackers.txt

Enjoy!


*note: remove .txt from the extension.
 

Attachments

  • shieldup.sh.txt
    5.9 KB · Views: 553
Last edited:
Hi everyone

Just in case someone need it, I wrote a script to block the IP addresses reported as DoS attacks in the log for the R9000 using Voxel's firmware, just add it to your crontab and have it run hourly, it will capture all the IPs reported and block them in the INPUT filter in IPTABLES

add in crontab

0 * * * * * /root/shieldup.sh attackers.txt

Enjoy!


*note: remove .txt from the extension.

Hello multicast,

thanks for the script, just a little comment :
- when you filter local ip adress with sed you must escape the dot in the regex
- to store list of ip to block you use 3 files "/root/attackers.txt" "attackers.txt" and "$1" (first argument on cli) => probably the same file but its better to stick to the same naming,
- to filter dns server, you can read resolver file instead of hardcoding your dns in the script
- your file contain many spaces at end of line and on new line, i have removed them

The update script is attached, the cli argument $1 is use if you want to provide additional ip to block

*note: remove .txt from the extension.
 

Attachments

  • shieldup.v2.sh.txt
    1.2 KB · Views: 497
Also be careful with false positives. I've attempted to check a few IPs from log and most of them were WhatsApp and Facebook related.
 

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top