Ctrl K
ring2all.com

Firewall Settings 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 Are Firewall Settings?

Firewall Settings is a security configuration module that manages the system firewall (nftables) and intrusion detection (Fail2Ban). This module works with related Firewall Services and Firewall Rules modules for complete traffic control.

Architecture

Plaintext
┌─────────────────────────────────────────────────────────────────┐
│              Firewall System Architecture                      │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  Firewall Settings                                              │
│  ┌──────────────────────────────────────────────────────────┐   │
│  │        Global Configuration                              │   │
│  │                                                          │   │
│  │  Firewall (nftables):                                   │   │
│  │  └─ Enable/Disable                                      │   │
│  │                                                          │   │
│  │  Intrusion Detection (Fail2Ban):                        │   │
│  │  ├─ Enable/Disable                                      │   │
│  │  ├─ Failed Attempts: 5                                  │   │
│  │  ├─ Find Time: 10 minutes                               │   │
│  │  ├─ Ban Duration: 60 minutes                            │   │
│  │  └─ Notification Email: admin@company.com               │   │
│  │                                                          │   │
│  └──────────────────────────────────────────────────────────┘   │
│       │                                                         │
│       ▼ Works with                                             │
│  ┌──────────────────────────────────────────────────────────┐   │
│  │                                                          │   │
│  │  Firewall Services          Firewall Rules              │   │
│  │  ┌────────────────┐         ┌────────────────┐          │   │
│  │  │ HTTP: TCP/80   │         │ Allow HTTP     │          │   │
│  │  │ HTTPS: TCP/443 │    →    │ Block SSH      │          │   │
│  │  │ SIP: UDP/5060  │         │ Accept SIP LAN │          │   │
│  │  │ SSH: TCP/22    │         │ Drop Others    │          │   │
│  │  └────────────────┘         └────────────────┘          │   │
│  │                                                          │   │
│  └──────────────────────────────────────────────────────────┘   │
│       │                                                         │
│       ▼ Applied to system                                      │
│  ┌──────────────────────────────────────────────────────────┐   │
│  │        Linux Firewall                                    │   │
│  │                                                          │   │
│  │  nftables:                                              │   │
│  │  ├─ Input chain rules                                   │   │
│  │  ├─ Output chain rules                                  │   │
│  │  └─ Forward chain rules                                 │   │
│  │                                                          │   │
│  │  Fail2Ban:                                              │   │
│  │  ├─ SSH jail                                            │   │
│  │  ├─ SIP jail                                            │   │
│  │  └─ Web jail                                            │   │
│  │                                                          │   │
│  └──────────────────────────────────────────────────────────┘   │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

Key Tables

TablePurpose
public.firewall_settingsGlobal settings
public.firewall_servicesService definitions
public.firewall_rulesTraffic rules

Key Files

FileDescription
modules/firewallSettings/Settings module
modules/firewallServices/Services module
modules/firewallRules/Rules module
/etc/nftables.confnftables config
/etc/fail2ban/Fail2Ban config
---

2. Module Overview (Commercial/Business)

Business Value

Firewall Settings provides network security:

Without FirewallWith Firewall
Open portsControlled access
No protectionIntrusion detection
Manual bansAutomatic bans
Unknown attacksEmail alerts

Use Cases

  1. Network Protection
- Block unauthorized access

- Allow only needed ports

  1. Intrusion Prevention
- Detect brute force

- Auto-ban attackers

  1. SIP Security
- Protect SIP ports

- Ban SIP scanners

  1. Compliance
- Audit trail

- Security controls

Feature Highlights

FeatureBenefit
nftablesModern Linux firewall
Fail2BanIntrusion detection
Auto-BanAutomatic blocking
Email AlertsAttack notifications
ServicesReusable port definitions
Priority RulesOrdered evaluation
---

3. Module Overview (End User/Administrator)

What Can You Do?

  • Enable/disable system firewall
  • Enable/disable intrusion detection
  • Configure failed attempt limits
  • Set ban duration
  • Configure email alerts
  • Define firewall services
  • Create firewall rules

Firewall Settings Interface

Plaintext
┌─────────────────────────────────────────────────────────────────┐
│              Firewall Settings                                  │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  Configure system firewall and intrusion detection             │
│                                                                 │
│  ┌─────────────────────────────────────────────────────────────┐│
│  │                                                             ││
│  │  Enable Firewall: ✓                                        ││
│  │    Enable or disable the system firewall (nftables)        ││
│  │    When enabled, the firewall will enforce all rules       ││
│  │                                                             ││
│  └─────────────────────────────────────────────────────────────┘│
│                                                                 │
│  ──────────────────────────────────────────────────────────────│
│                                                                 │
│  ▼ Intrusion Detection (Fail2Ban)                               │
│                                                                 │
│  ┌─────────────────────────────────────────────────────────────┐│
│  │                                                             ││
│  │  Enable Intrusion Detection: ✓                             ││
│  │    Enable Fail2Ban to automatically ban IPs after          ││
│  │    failed login attempts                                    ││
│  │                                                             ││
│  │  ────────────────────────────────────────────────────────── ││
│  │                                                             ││
│  │  Failed Attempts Allowed: [5          ]                    ││
│  │    Number of failed attempts before ban (1-20)             ││
│  │                                                             ││
│  │  Find Time Window: [10         ] minutes                   ││
│  │    Time window to count failed attempts                     ││
│  │                                                             ││
│  │  Ban Duration: [60            ] minutes                    ││
│  │    Duration that an IP will be banned                       ││
│  │                                                             ││
│  │  Notification Email: [admin@company.com          ]         ││
│  │    Email address to receive ban notifications              ││
│  │                                                             ││
│  └─────────────────────────────────────────────────────────────┘│
│                                                                 │
│  [Save Settings]                                                │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

Firewall Services Interface

Plaintext
┌─────────────────────────────────────────────────────────────────┐
│              Firewall Services                                  │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  Manage firewall services for nftables (Debian 13)            │
│                                                                 │
│  [+ Add Service]                                                │
│                                                                 │
│  [🔍 Search services...]                                        │
│                                                                 │
│  ┌───────────────────────────────────────────────────────────┐  │
│  │ Name     │ Protocol │ Port      │ Description    │ Status│  │
│  ├──────────┼──────────┼───────────┼────────────────┼───────┤  │
│  │ HTTP     │ TCP      │ 80        │ Web traffic    │ ●     │  │
│  │ HTTPS    │ TCP      │ 443       │ Secure web     │ ●     │  │
│  │ SSH      │ TCP      │ 22        │ Secure shell   │ ●     │  │
│  │ SIP      │ UDP      │ 5060      │ SIP signaling  │ ●     │  │
│  │ RTP      │ UDP      │ 16384-32768│ Voice media   │ ●     │  │
│  └───────────────────────────────────────────────────────────┘  │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

Firewall Rules Interface

Plaintext
┌─────────────────────────────────────────────────────────────────┐
│              Firewall Rules                                     │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  Manage firewall rules for nftables (Debian 13)                │
│                                                                 │
│  [+ Add Rule]  [Apply Rules]                                    │
│                                                                 │
│  [🔍 Search rules...]                                           │
│                                                                 │
│  ┌───────────────────────────────────────────────────────────┐  │
│  │ Name         │ Action │ Direction│ Service │ Priority│ St │ │
│  ├──────────────┼────────┼──────────┼─────────┼─────────┼────┤ │
│  │ Allow HTTP   │ Accept │ Input    │ HTTP    │ 100     │ ● │ │
│  │ Allow HTTPS  │ Accept │ Input    │ HTTPS   │ 110     │ ● │ │
│  │ Allow SIP    │ Accept │ Input    │ SIP     │ 200     │ ● │ │
│  │ Allow RTP    │ Accept │ Input    │ RTP     │ 210     │ ● │ │
│  │ Block SSH Ext│ Drop   │ Input    │ SSH     │ 300     │ ● │ │
│  └───────────────────────────────────────────────────────────┘  │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

Add/Edit Rule Modal

Plaintext
┌─────────────────────────────────────────────────────────────────┐
│              Add Firewall Rule                                  │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  Rule Name: [Allow SIP from LAN            ]                   │
│    Descriptive name for the rule                                │
│                                                                 │
│  Action: [Accept ▼]                                            │
│    Accept | Drop | Reject                                       │
│                                                                 │
│  Direction: [Input ▼]                                          │
│    Input | Output | Forward                                     │
│                                                                 │
│  Service: [SIP ▼]                                              │
│    Select service (required)                                    │
│                                                                 │
│  Priority: [200           ]                                    │
│    Lower numbers evaluated first (0-9999)                       │
│                                                                 │
│  Source Address: [192.168.1.0/24           ]                   │
│    Optional: IP or CIDR                                         │
│                                                                 │
│  Destination Address: [                    ]                   │
│    Optional: IP or CIDR                                         │
│                                                                 │
│  Interface: [eth0                          ]                   │
│    Optional: Network interface                                  │
│                                                                 │
│  Enabled: ✓                                                    │
│                                                                 │
│  [Save] [Cancel]                                                │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

Quick Tips

TIP
Apply Rules: Click "Apply Rules" after changes.
TIP
Priority: Lower numbers = higher priority.
WARNING
Don't Lock Yourself Out: Always allow SSH from your IP first!

---

4. Configuration Sections

Firewall Settings

FieldDescription
Enable Firewallnftables on/off
Enable Intrusion DetectionFail2Ban on/off
Failed AttemptsMax attempts (1-20)
Find TimeCount window (minutes)
Ban DurationBan time (minutes)
Notification EmailAlert recipient

Firewall Services

FieldDescription
NameService identifier
ProtocolTCP, UDP, ICMP, All
PortPort or range (e.g., 8000-8010)
DescriptionOptional notes
EnabledActive/Inactive

Firewall Rules

FieldDescription
NameRule identifier
ActionAccept, Drop, Reject
DirectionInput, Output, Forward
ServiceAssociated service
PriorityOrder (0-9999)
Source AddressSource IP/CIDR
Destination AddressDest IP/CIDR
InterfaceNetwork interface
EnabledActive/Inactive
---

5. Settings Reference

Rule Actions

ActionBehaviorUse Case
AcceptAllow trafficLegitimate traffic
DropSilent blockStealth blocking
RejectBlock with responseInform sender

Rule Directions

DirectionDescription
InputTraffic TO the server
OutputTraffic FROM the server
ForwardRouted traffic

Common Protocols

ProtocolUse
TCPHTTP, HTTPS, SSH, SIP-TCP
UDPSIP, RTP, DNS
ICMPPing
AllAny protocol

Fail2Ban Recommendations

SettingDefaultAggressivePermissive
Failed Attempts5310
Find Time10 min5 min30 min
Ban Duration60 min1440 min (24h)30 min
---

6. Common Scenarios & Examples

Scenario 1: Enable Firewall & Detection

  1. Enable Firewall = ✓
  2. Enable Intrusion Detection = ✓
  3. Failed Attempts = 5
  4. Find Time = 10 minutes
  5. Ban Duration = 60 minutes
  6. Email = admin@company.com
  7. Save

Scenario 2: Create SIP Service

  1. Add Service
  2. Name = "SIP"
  3. Protocol = UDP
  4. Port = 5060
  5. Description = "SIP signaling"
  6. Enable = ✓
  7. Save

Scenario 3: Allow SIP from LAN Only

  1. Add Rule
  2. Name = "Allow SIP LAN"
  3. Action = Accept
  4. Direction = Input
  5. Service = SIP
  6. Priority = 200
  7. Source = 192.168.1.0/24
  8. Enable = ✓
  9. Save
  10. Apply Rules

Scenario 4: Block External SSH

  1. First: Create "Allow SSH from Admin IP" rule (Priority 90)
  2. Add Rule
  3. Name = "Block SSH External"
  4. Action = Drop
  5. Direction = Input
  6. Service = SSH
  7. Priority = 100
  8. Enable = ✓
  9. Save
  10. Apply Rules

---

7. Limitations & Important Notes

Technical Notes

NOTE
Apply Required: Rules don't take effect until applied.
NOTE
Priority Order: Lower number = evaluated first.
CAUTION
SSH Access: Always allow your IP before blocking!

Best Practices

  1. SSH First: Always allow admin SSH
  2. Specific to General: Specific rules before broad rules
  3. Test Changes: Verify access after changes
  4. Enable Fail2Ban: Protect against brute force
  5. Monitor Bans: Check for false positives

Common Services to Allow

ServicePortNotes
HTTP80Web (redirect to HTTPS)
HTTPS443Secure web
SIP UDP5060SIP signaling
SIP TLS5061Secure SIP
RTP16384-32768Voice media
SSH22Remote admin (restrict!)
---

8. Troubleshooting Tips

Common Issues

SymptomPossible CauseSolution
Can't connectBlocked by firewallCheck rules
False bansFail2Ban too strictAdjust settings
Rules not workingNot appliedClick Apply Rules
Locked outSSH blockedConsole access

Check Firewall Status

Bash
# Check nftables
nft list ruleset

# Check Fail2Ban status
fail2ban-client status

# Check specific jail
fail2ban-client status sshd

# Unban an IP
fail2ban-client set sshd unbanip 192.168.1.100

Check Bans

Bash
# View banned IPs
fail2ban-client status sshd

# Check ban log
tail -f /var/log/fail2ban.log

# View all bans
iptables -L -n | grep -i ban

---

9. Glossary

TermDefinition
nftablesLinux firewall framework
Fail2BanIntrusion detection system
JailFail2Ban protection scope
CIDRIP range notation
ChainRule processing group
Input ChainIncoming traffic rules
---

Lua Script Status ℹ️

Security Module

ComponentStatus
Firewall Settingsℹ️ nftables/Fail2Ban config - no Lua handler required
Firewall Servicesℹ️ Port definitions - no Lua handler required
Firewall Rulesℹ️ Traffic rules - no Lua handler required
Firewall is a security configuration module. It manages nftables firewall and Fail2Ban intrusion detection. No Lua handlers are used - configuration is applied by the backend service to the Linux firewall.

---

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?