{"id":17520441,"url":"https://github.com/xaf/fail2ban-subnets","last_synced_at":"2025-04-23T15:25:33.792Z","repository":{"id":31985845,"uuid":"35556296","full_name":"XaF/fail2ban-subnets","owner":"XaF","description":"fail2ban-subnets aims to provide a way to ban subnets of IPs repeatingly banned by fail2ban for multiple offenses.","archived":false,"fork":false,"pushed_at":"2016-07-25T19:09:20.000Z","size":12,"stargazers_count":11,"open_issues_count":7,"forks_count":3,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-04-18T03:43:20.816Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/XaF.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-13T15:11:23.000Z","updated_at":"2023-10-15T08:58:48.000Z","dependencies_parsed_at":"2022-07-30T05:37:49.839Z","dependency_job_id":null,"html_url":"https://github.com/XaF/fail2ban-subnets","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XaF%2Ffail2ban-subnets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XaF%2Ffail2ban-subnets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XaF%2Ffail2ban-subnets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XaF%2Ffail2ban-subnets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/XaF","download_url":"https://codeload.github.com/XaF/fail2ban-subnets/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250458771,"owners_count":21433940,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-20T11:04:55.570Z","updated_at":"2025-04-23T15:25:33.775Z","avatar_url":"https://github.com/XaF.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"fail2ban-subnets\n================\n\n## Presentation\n\n```fail2ban-subnets``` aims to provide a way to ban subnets of IPs repeatingly banned by [```fail2ban```][fail2ban] for multiple offenses. It thus uses the ```fail2ban``` logfiles and calculates the most restricted subnet to be banned for these IPs. Using the log file generated by ```fail2ban-subnets```, and a new ```action.d``` script, we can thus create a specific jail in ```fail2ban``` for banning those subnets.\n\n```fail2ban-subnets``` is here to provide what's currently impossible in ```fail2ban```, even if there are issues that are progressing on that side.\n\n## Licence\n\nCopyright (C) 2015       Raphaël Beamonte \u003c\u003craphael.beamonte@gmail.com\u003e\u003e\n\nThis program is free software; you can redistribute it and/or\nmodify it under the terms of the GNU General Public License\nas published by the Free Software Foundation; either version 2\nof the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  [See the\nGNU General Public License for more details] [GPLv2].\n\n## Installation\n\n### Get the code\n\nYou can get the code by cloning this repository or downloading the [last version of the zip package][zip]\n\n### Configuration of ```fail2ban-subnets```\n\nYou should edit the first part of the ```fail2ban-subnets.py``` file to adjust to your system. All comments on this configuration are provided in the file.\n\n### Configuration of ```fail2ban```\n\nHere's the way I recommand setting ```fail2ban``` to avoid problems in future developments.\nThese settings are based on a Debian system and consider you got the ```fail2ban-subnets``` files in ```/home/usr/f2b-sn/```, you should adapt them to your needs.\n\nGo to the ```fail2ban``` settings directory of your system **as root**:\n```sh\ncd /etc/fail2ban\n```\n\nCreate the directories ```action.d.local``` and ```filter.d.local```:\n```sh\nmkdir action.d.local filter.d.local\n```\n\nCopy the ```fail2ban-subnets``` action and filter files in these new directories:\n```sh\ncp /home/usr/f2b-sn/action.d.local/* action.d.local/\ncp /home/usr/f2b-sn/filter.d.local/* filter.d.local/\n```\n\nAdd the configuration for the ```fail2ban-subnets``` jail at the end of your local jail:\n```sh\ncat /home/usr/f2b-sn/jail.local \u003e\u003e jail.local\n```\n\n### Run `fail2ban-subnets`\n\nInstall the ```fail2ban-subnets``` script to be executed once an hour:\n```sh\ncp /home/usr/f2b-sn/fail2ban-subnets.py /etc/cron.hourly/fail2ban-subnets\nchown root:adm /etc/cron.hourly/fail2ban-subnets\n```\n\n**Note:** you could also set a crontab to go more regularly, still *as root*, by running ```crontab -e``` then setting your crontab.\n\n## Issues\nPlease use the [GitHub integrated issue tracker] [issues] for every problem you can\nencounter. Please **DO NOT** use my email for issues or walkthrough.\n\n\n[fail2ban]: https://github.com/fail2ban/fail2ban\n[GPLv2]: https://www.gnu.org/licenses/gpl-2.0.html\n[zip]: https://github.com/XaF/fail2ban-subnets/archive/master.zip\n[issues]: https://github.com/XaF/fail2ban-subnets/issues\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxaf%2Ffail2ban-subnets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxaf%2Ffail2ban-subnets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxaf%2Ffail2ban-subnets/lists"}