Repository navigation
Automatic cron security ban #47
Closed
theking81
started this conversation in
Show and tell
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. |
0 replies
|
Clean it up? |
1 reply
|
Yes, done this its up and ready to roll. This will help out a lot of people against bots etc. |
0 replies
|
Actually i redo it in POSIX also to work in any system, so no Bash is required. So that will help more people also. |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
All reactions