mirror of
https://github.com/amidaware/tacticalrmm.git
synced 2026-04-26 06:55:52 +03:00
[PR #2409] [CLOSED] Add application-level firewall with IP and GeoIP blocking #1936
Labels
No labels
In Process
bug
bug
dev-triage
documentation
duplicate
enhancement
fixed
good first issue
help wanted
integration
invalid
pull-request
question
requires agent update
security
ui tweak
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tacticalrmm#1936
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/amidaware/tacticalrmm/pull/2409
Author: @staticgroup
Created: 2/10/2026
Status: ❌ Closed
Base:
develop← Head:claude/explain-codebase-mlf1g7iq0horr3sf-8TkJq📝 Commits (5)
70b99c3Add firewall, fail2ban, and GeoIP features (adapted from HuduGlue)aa14afeAdd Let's Encrypt and monitoring bypass to firewall middleware5ae0adbFix 7 security vulnerabilities in firewall app1003d5bBump version to 1.5.08a907f3Update update.sh for fork: point to staticgroup/tacticalrmm, add fail2ban sudoers📊 Changes
17 files changed (+1359 additions, -7 deletions)
View changed files
➕
api/tacticalrmm/accounts/migrations/0041_role_can_view_firewall_role_can_manage_firewall.py(+21 -0)📝
api/tacticalrmm/accounts/models.py(+4 -0)➕
api/tacticalrmm/firewall/__init__.py(+0 -0)➕
api/tacticalrmm/firewall/apps.py(+6 -0)➕
api/tacticalrmm/firewall/middleware.py(+240 -0)➕
api/tacticalrmm/firewall/migrations/0001_initial.py(+189 -0)➕
api/tacticalrmm/firewall/migrations/__init__.py(+0 -0)➕
api/tacticalrmm/firewall/models.py(+144 -0)➕
api/tacticalrmm/firewall/permissions.py(+17 -0)➕
api/tacticalrmm/firewall/serializers.py(+100 -0)➕
api/tacticalrmm/firewall/urls.py(+31 -0)➕
api/tacticalrmm/firewall/views.py(+573 -0)📝
api/tacticalrmm/tacticalrmm/constants.py(+6 -0)📝
api/tacticalrmm/tacticalrmm/settings.py(+3 -1)📝
api/tacticalrmm/tacticalrmm/urls.py(+1 -0)➕
deploy/tacticalrmm-fail2ban-sudoers(+10 -0)📝
update.sh(+14 -6)📄 Description
Summary
This PR introduces a comprehensive application-level firewall system to Tactical RMM, enabling administrators to block or allow requests based on IP addresses and geographic location (country). The firewall includes IP-based rules (supporting CIDR notation), country-based rules, detailed logging, and integration with fail2ban for additional protection.
Key Changes
Core Firewall System
firewallDjango app with models for firewall settings, IP rules, country rules, and request logsip-api.comfor GeoIP lookups (free, no API key required)Database Models
FirewallSettings: Singleton configuration model with toggles for IP/GeoIP firewalls, bypass options, and loggingFirewallIPRule: Supports single IPs and CIDR notation (e.g.,192.168.1.0/24)FirewallCountryRule: ISO 3166-1 alpha-2 country codes with validationFirewallLog: Comprehensive logging of blocked requests with IP, country, reason, request details, and timestampAPI Endpoints
fail2ban Integration
Role-Based Access Control
can_view_firewallandcan_manage_firewallpermissions to the Role modelFirewallPermsandFail2BanPermspermission classesConfiguration
firewallapp in Django settingsFirewallMiddlewareto middleware stack (after authentication)Implementation Details
AuthenticationMiddlewareallows staff bypass checkspython-ipwarelibrary (already a TRMM dependency)sudowith timeout protectionhttps://claude.ai/code/session_01HLnvu6mEsUaDabZsZZMSoF
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.