Skip to content

Add ban feature to fail2ban script#2538

Merged
casperklein merged 20 commits intodocker-mailserver:masterfrom
casperklein:fail2ban-custom-ban
Apr 19, 2022
Merged

Add ban feature to fail2ban script#2538
casperklein merged 20 commits intodocker-mailserver:masterfrom
casperklein:fail2ban-custom-ban

Conversation

@casperklein
Copy link
Copy Markdown
Member

@casperklein casperklein commented Apr 7, 2022

Description

This PR adds a new "ban" option to the fail2ban script. This allows to easily block custom IPs with fail2ban:

./setup.sh failban ban <IP>

The default bantime is 180 days, but can be adjusted easily like other fail2ban settings.

setup.sh: fail2ban was moved from the "debug" section to it's own fail2ban section:

setup.sh debug fail2ban --> setup.sh fail2ban

While adding the necessary changes to config-examples/fail2ban-jail.cf, I've also synced all values there, with our default settings.

A new fail2ban test was added and the existing ones were improved.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Improvement (non-breaking change that does improve existing functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (README.md or the documentation under docs/)
  • If necessary I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@casperklein casperklein added kind/new feature A new feature is requested in this issue or implemeted with this PR area/scripts labels Apr 7, 2022
@casperklein casperklein self-assigned this Apr 7, 2022
@georglauterbach
Copy link
Copy Markdown
Member

I assigned v11 to this PR, but if you think this should rather go into v11.1, please change it :)

@casperklein casperklein marked this pull request as ready for review April 8, 2022 17:15
@casperklein casperklein requested a review from a team April 8, 2022 17:15
@casperklein casperklein marked this pull request as draft April 8, 2022 17:33
@casperklein casperklein marked this pull request as ready for review April 8, 2022 17:43
Comment thread target/bin/fail2ban Outdated
Comment thread target/bin/fail2ban Outdated
Copy link
Copy Markdown
Member

@georglauterbach georglauterbach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good all in all. I'd just like to discuss the `__usage´ section.

Copy link
Copy Markdown
Member

@georglauterbach georglauterbach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@casperklein casperklein linked an issue Apr 13, 2022 that may be closed by this pull request
Comment thread config-examples/fail2ban-jail.cf Outdated
Comment thread target/fail2ban/jail.local Outdated
@casperklein casperklein enabled auto-merge (squash) April 18, 2022 16:18
@casperklein casperklein merged commit de61d42 into docker-mailserver:master Apr 19, 2022
@github-actions
Copy link
Copy Markdown
Contributor

Documentation preview for this PR is ready! 🎉

Built with commit: 8bcdbd6

@casperklein casperklein deleted the fail2ban-custom-ban branch April 19, 2022 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/scripts kind/new feature A new feature is requested in this issue or implemeted with this PR service/security/fail2ban

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FR] Setting up IP blacklists for Iptables

3 participants