Merged
Conversation
c2660c3 to
c6c66f5
Compare
c6c66f5 to
2e23376
Compare
2e23376 to
74dcd07
Compare
74dcd07 to
92459c6
Compare
92459c6 to
0203014
Compare
0203014 to
3e89454
Compare
3e89454 to
b2153e3
Compare
b2153e3 to
f6fd1b9
Compare
f6fd1b9 to
0f9c763
Compare
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR enables fail2ban protection across all VMs in the Ghaf framework to protect against SSH brute-force attacks. The implementation includes a custom jail configuration that redirects SSH connections from banned IPs to an ssh-tarpit server on the net-vm, deliberately slowing down attackers, while other VMs drop packets from banned IPs immediately.
Key changes include:
- Integration of fail2ban module with configurable SSH jail and firewall marking
- SSH tarpit service enhancement with firewall mark support and custom action configuration
- Rate limiting for ICMP requests (5 pings per minute per IP) and SSH connections (30 new connections per minute)
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| modules/common/security/fail2ban.nix | New fail2ban module with custom SSH jail configuration and iptables-ipset-mark action |
| modules/common/security/ssh-tarpit/default.nix | Enhanced ssh-tarpit with configurable firewall marks and fail2ban integration |
| modules/common/security/default.nix | Added fail2ban module to security imports |
| modules/development/ssh.nix | Added SSH flood protection with rate limiting rules |
| modules/microvm/sysvms/*.nix | Enabled fail2ban on all system VMs (netvm, guivm, audiovm, adminvm) |
| modules/microvm/appvm.nix | Enabled fail2ban on application VMs |
| modules/common/firewall/firewall.nix | Enhanced ICMP rate limiting per IP and conditional firewall marking |
| tests/firewall/default.nix | Added fail2ban and ssh-tarpit to firewall tests |
vunnyso
requested changes
Sep 16, 2025
0f9c763 to
88b47bb
Compare
* Fail2Ban is enabled on all VMs to protect against SSH brute-force attacks. * A custom jail is configured to redirect SSH connections from banned IPs to the ssh-tarpit server on the net-vm, slowing down attackers by deliberately delaying their connections. * On all other VMs, packets from banned IPs are dropped immediately. * VMs allow a maximum of 5 ICMP request packets (ping) in a single burst per minute for each IP address. * SSH sync flood protection has been activated for every VM. ( maximum 30 new ssh connection requests/minute) Signed-off-by: Enes Öztürk <enes.ozturk@unikie.com>
88b47bb to
2628646
Compare
|
Tested on Darter Pro and Orin-AGX (new images)
|
vunnyso
approved these changes
Sep 17, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Changes
Type of Change
Related Issues / Tickets
Checklist
make-checksand it passesTesting Instructions
Applicable Targets
aarch64aarch64x86_64x86_64x86_64Installation Method
nixos-rebuild ... switchTest Steps To Verify:
Scenario - 1 (External Network - Netvm)
systemctl status endless-goipset list f2b-blacklist. You should see the attacker's IP address listed in the members section.Scenario - 2 (VM - VM)
ipset list f2b-blacklist. You should see the comms-vm IP address listed in the members section.Scenario - 3 (SSH sync flood protection, Icmp flood protection)
hping3 -S -p 22 -i u10000 -c 35 ${VmIp}Note: The device under test must be in its default state before each test scenario.(Can be rebooted)