Automatic cron security ban #47
Replies: 4 comments 2 replies
-
|
If you want to submit it as a helper script, clean it up, add a header, with instructions on how to use it and what it does. Then submit a PR with it placed in the That's if you want to of course. |
Beta Was this translation helpful? Give feedback.
-
|
Clean it up? |
Beta Was this translation helpful? Give feedback.
-
|
Yes, done this its up and ready to roll. This will help out a lot of people against bots etc. |
Beta Was this translation helpful? Give feedback.
-
|
Actually i redo it in POSIX also to work in any system, so no Bash is required. So that will help more people also. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have created a script that runs every 1 hour on my servers with a cronjob.
Basically it bans ips on a server using CSF any unusual hits over 500 or whatever you want on a server.
This helps me a lot as i have websites that get lot of bot hits (wordpress, prestashops etc).
With the script 3 years now... the server is fully healthy and rested.
The only config needed is the path of the websites to look for the ssls logs and the amount of hits each ip gives everyday.
I made a safe, production script that scans the SSL logs of accounts on server , finds IPs with > 500 hits today (or whatever you want to add for your needs), and automatically blocks them via CSF in one go.
It also:
skips private/local IPs,
avoids duplicate blocks (checks /etc/csf/csf.deny first),
logs actions to /var/log/auto-blocker.log,
only reloads CSF once if there were changes,
supports --dry-run to test without blocking, and
is cron-friendly.
Save it as /usr/local/sbin/protect.sh, chmod +x, and run with sudo (CSF requires root).
To use it
And you can run it anytime you need with
sudo ./protect.sh
Let me know if this helps you out.
Beta Was this translation helpful? Give feedback.
All reactions