Ctrl K
ring2all.com

GeoFirewall Module Documentation

Table of Contents

  1. Module Overview (Technical)
  2. Module Overview (Commercial/Business)
  3. Module Overview (End User/Administrator)
  4. Configuration Sections
  5. Settings Reference
  6. Common Scenarios & Examples
  7. Limitations & Important Notes
  8. Troubleshooting Tips
  9. Glossary

---

1. Module Overview (Technical)

What Is GeoFirewall?

GeoFirewall is a country-based firewall module that creates rules based on geographic IP ranges. It provides an interactive world map for country selection and supports both blocking and allowing traffic by country.

Architecture

Plaintext
┌─────────────────────────────────────────────────────────────────┐
│              GeoFirewall Architecture                          │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  Interactive World Map                                          │
│  ┌──────────────────────────────────────────────────────────┐   │
│  │                                                          │   │
│  │    ┌─────┐ ┌─────┐ ┌─────┐ ┌─────┐ ┌─────┐             │   │
│  │    │ 🟢  │ │ 🔴  │ │ 🔴  │ │ ⚪  │ │ 🟢  │             │   │
│  │    │ USA │ │ CN  │ │ RU  │ │ BR  │ │ UK  │             │   │
│  │    └─────┘ └─────┘ └─────┘ └─────┘ └─────┘             │   │
│  │                                                          │   │
│  │  🟢 Allowed   🔴 Blocked   ⚪ Unselected                 │   │
│  │                                                          │   │
│  └──────────────────────────────────────────────────────────┘   │
│       │                                                         │
│       ▼ Generates rules                                        │
│  ┌──────────────────────────────────────────────────────────┐   │
│  │        GeoFirewall Rules                                 │   │
│  │                                                          │   │
│  │  ┌────────────────┐  ┌────────────────┐                 │   │
│  │  │ Block China    │  │ Block Russia   │                 │   │
│  │  │ Country: CN    │  │ Country: RU    │                 │   │
│  │  │ Action: Block  │  │ Action: Block  │                 │   │
│  │  │ Priority: 100  │  │ Priority: 110  │                 │   │
│  │  └────────────────┘  └────────────────┘                 │   │
│  │                                                          │   │
│  └──────────────────────────────────────────────────────────┘   │
│       │                                                         │
│       ▼ Applied to nftables with GeoIP                        │
│  ┌──────────────────────────────────────────────────────────┐   │
│  │        Linux Firewall (nftables + GeoIP)                 │   │
│  │                                                          │   │
│  │  table inet geo_filter {                                │   │
│  │    chain input {                                        │   │
│  │      # Block China                                       │   │
│  │      ip saddr @geoip_cn drop                            │   │
│  │      # Block Russia                                      │   │
│  │      ip saddr @geoip_ru drop                            │   │
│  │    }                                                     │   │
│  │  }                                                       │   │
│  │                                                          │   │
│  └──────────────────────────────────────────────────────────┘   │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

Key Tables

TablePurpose
public.geo_firewall_rulesCountry rules

Key Files

FileDescription
modules/geoFirewall/Frontend module
GeoIP databaseCountry IP ranges
---

2. Module Overview (Commercial/Business)

Business Value

GeoFirewall provides geographic access control:

Without GeoFirewallWith GeoFirewall
No geo blockingBlock by country
IP range researchVisual map selection
Manual rangesAuto GeoIP updates
Complex setupClick to block

Use Cases

  1. Block Attack Origins
- Block high-risk countries

- Reduce SIP scanning

  1. Regional Service
- Allow only service region

- Restrict global access

  1. Compliance
- Geographic restrictions

- Data sovereignty

  1. Cost Control
- Block toll fraud countries

- Limit international access

Feature Highlights

FeatureBenefit
Interactive MapVisual selection
Block/AllowFlexible actions
Bulk OperationsSelect/deselect all
Enable/DisableQuick toggle
Priority OrderControlled evaluation
GeoIP DatabaseAccurate IP mapping
---

3. Module Overview (End User/Administrator)

What Can You Do?

  • Block countries by clicking on map
  • Allow only specific countries
  • Search for countries
  • Select/deselect all countries
  • Enable/disable all rules
  • Set rule priority
  • Apply rules to firewall

GeoFirewall Interface - Map View

Plaintext
┌─────────────────────────────────────────────────────────────────┐
│              GeoFirewall                                        │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  Manage firewall rules by country                              │
│                                                                 │
│  [🔍 Search country...]  [GeoFirewall: ● Enabled]              │
│                                                                 │
│  [Map] [Form]                                                   │
│                                                                 │
│  ┌───────────────────────────────────────────────────────────┐  │
│  │                                                           │  │
│  │                    WORLD MAP                              │  │
│  │                                                           │  │
│  │   ┌─────────────────────────────────────────────────────┐ │  │
│  │   │                                                     │ │  │
│  │   │    🟢 USA        🔴 CN         ⚪ IN               │ │  │
│  │   │                                                     │ │  │
│  │   │    🟢 UK         🔴 RU         ⚪ BR               │ │  │
│  │   │                                                     │ │  │
│  │   │    🟢 CA         🔴 KP         ⚪ AU               │ │  │
│  │   │                                                     │ │  │
│  │   └─────────────────────────────────────────────────────┘ │  │
│  │                                                           │  │
│  │  [+ Zoom] [- Zoom] [Reset] [Select All] [Unselect All]   │  │
│  │                                                           │  │
│  └───────────────────────────────────────────────────────────┘  │
│                                                                 │
│  Legend: 🟢 Allowed  🔴 Blocked  ⚪ Unselected                  │
│                                                                 │
│  Selected: 6 countries (3 blocked, 3 allowed)                   │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

GeoFirewall Interface - Form/List View

Plaintext
┌─────────────────────────────────────────────────────────────────┐
│              GeoFirewall                                        │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  [Map] [Form]                                                   │
│                                                                 │
│  [+ Add Rule]  [Enable All] [Disable All] [Apply Rules]        │
│                                                                 │
│  [🔍 Search rules...]                                           │
│                                                                 │
│  ┌───────────────────────────────────────────────────────────┐  │
│  │ Name         │ Country    │ Action│ Direction│ Pri │ St │  │
│  ├──────────────┼────────────┼───────┼──────────┼─────┼────┤  │
│  │ Block China  │ 🇨🇳 China   │ Block │ Input    │ 100 │ ●  │  │
│  │ Block Russia │ 🇷🇺 Russia  │ Block │ Input    │ 110 │ ●  │  │
│  │ Block N.Korea│ 🇰🇵 N. Korea│ Block │ Input    │ 120 │ ●  │  │
│  │ Allow USA    │ 🇺🇸 USA     │ Allow │ Input    │ 200 │ ●  │  │
│  │ Allow UK     │ 🇬🇧 UK      │ Allow │ Input    │ 210 │ ●  │  │
│  │ Allow Canada │ 🇨🇦 Canada  │ Allow │ Input    │ 220 │ ●  │  │
│  └───────────────────────────────────────────────────────────┘  │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

Add/Edit Rule

Plaintext
┌─────────────────────────────────────────────────────────────────┐
│              Add GeoFirewall Rule                               │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  Rule Name: [Block China                     ]                 │
│    Descriptive name (e.g., Block China, Allow USA)             │
│                                                                 │
│  Country: [🇨🇳 China (CN) ▼]                                    │
│    Selected from map or dropdown                                │
│    Rule applies to all traffic from/to this country            │
│                                                                 │
│  Action: [Block ▼]                                             │
│    Block (discard traffic) | Allow (permit traffic)            │
│                                                                 │
│  Direction: [Input ▼]                                          │
│    Input (to server) | Output (from server) | Forward          │
│                                                                 │
│  Priority: [100           ]                                    │
│    Rule priority (0-9999). Lower numbers evaluated first       │
│                                                                 │
│  Enabled: ✓                                                    │
│                                                                 │
│  [Save] [Cancel]                                                │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

Quick Tips

TIP
Map Click: Click any country on the map to block/allow.
TIP
Search: Use search to quickly find countries.
WARNING
Don't Block Your Country: Ensure your access isn't blocked!

---

4. Configuration Sections

Rule Fields

FieldDescription
Rule NameUnique identifier
CountrySelected country
ActionBlock or Allow
DirectionInput, Output, Forward
PriorityOrder (0-9999)
EnabledActive/Inactive

Map Controls

ControlDescription
Zoom InEnlarge map
Zoom OutShrink map
ResetDefault view
Select AllBlock/allow all
Unselect AllRemove all rules
---

5. Settings Reference

Actions

ActionBehaviorUse Case
BlockDrop all trafficHigh-risk countries
AllowPermit trafficService regions

Common Blocked Countries (High SIP Attacks)

CountryCodeRisk Level
ChinaCNHigh
RussiaRUHigh
North KoreaKPHigh
IranIRMedium
VietnamVNMedium
IndonesiaIDMedium

Regional Allow Lists

RegionCountries
North AmericaUS, CA, MX
Western EuropeUK, DE, FR, ES, IT
APAC BusinessJP, AU, SG, KR
---

6. Common Scenarios & Examples

Scenario 1: Block High-Risk Countries

  1. Open GeoFirewall
  2. Click on China → Block
  3. Click on Russia → Block
  4. Click on North Korea → Block
  5. Apply Rules

Scenario 2: Allow Only USA

  1. Click "Select All" → Block All
  2. Click on USA → Allow
  3. Set priority (Allow lower than Block)
  4. Apply Rules

Scenario 3: Block Toll Fraud Origins

  1. Identify high-risk countries for toll fraud
  2. Block: Cuba, Somalia, Guinea-Bissau
  3. Block: Mauritania, Sierra Leone
  4. Apply Rules
  5. Monitor CDR for anomalies

Scenario 4: Regional Service

Plaintext
Allow Rules (Priority 10-100):
├─ USA (10)
├─ Canada (20)
├─ UK (30)
├─ Germany (40)
└─ France (50)

Block Rule (Priority 9999):
└─ All others (catch-all)

---

7. Limitations & Important Notes

Technical Notes

NOTE
GeoIP Database: Accuracy depends on database updates.
NOTE
VPN/Proxy: Users can bypass with VPNs.
WARNING
Self-Block: Don't block your own country!

Best Practices

  1. Know Your Users: Don't block legitimate users
  2. Allow First: Create allow rules with lower priority
  3. Test Access: Verify after applying rules
  4. Update Database: Keep GeoIP current
  5. Monitor Logs: Watch for blocked traffic

GeoIP Limitations

LimitationImpact
VPN bypassUsers appear from VPN country
CDN/CloudIP may show as different country
Accuracy~95-99% for countries
UpdatesNeed periodic database refresh
---

8. Troubleshooting Tips

Common Issues

SymptomPossible CauseSolution
Blocked unexpectedlyWrong country blockedCheck rules
Can't connectOwn country blockedConsole access
Still getting attacksVPN/proxyAdd IP blacklist
Map not loadingLibrary missingCheck npm install

Check Rules

Sql
SELECT 
  name,
  country_code,
  action,
  direction,
  priority,
  is_enabled
FROM public.geo_firewall_rules
ORDER BY priority;

GeoIP Lookup

Bash
# Check IP country
geoiplookup 8.8.8.8

# View GeoIP database info
geoiplookup -v

Emergency Recovery

Bash
# If blocked yourself:
# 1. Access server console
# 2. Disable GeoFirewall
systemctl stop nftables

# 3. Fix rules via admin panel
# 4. Re-enable
systemctl start nftables

---

9. Glossary

TermDefinition
GeoIPIP to country mapping
GeoFirewallCountry-based firewall
BlockDeny traffic
AllowPermit traffic
Country CodeISO 3166-1 alpha-2
---

Lua Script Status ℹ️

Security Module

ComponentStatus
GeoFirewallℹ️ Country-based firewall - no Lua handler required
GeoFirewall is a security configuration module. It manages country-based traffic rules using GeoIP databases. No Lua handlers are used - rules are applied to nftables by the backend service.

---

Documentation last updated: January 2026
AI Assistant

👋 Hello! I'm your Ring2All documentation assistant. I can help you find information about configuring and using the Ring2All PBX platform.

How can I help you today?