0% found this document useful (0 votes)
762 views5 pages

FreePBX Firewall Command Line Guide

The fwconsole firewall command provides controls to manage the FreePBX firewall including commands to disable, stop, start, restart the firewall service and to add or remove hosts from the trusted, blacklisted and other zones. Some example usages include fwconsole firewall disable to disable the firewall, fwconsole firewall start to start the firewall, and fwconsole firewall add trusted 192.168.1.0/24 to add a subnet to the trusted zone.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
762 views5 pages

FreePBX Firewall Command Line Guide

The fwconsole firewall command provides controls to manage the FreePBX firewall including commands to disable, stop, start, restart the firewall service and to add or remove hosts from the trusted, blacklisted and other zones. Some example usages include fwconsole firewall disable to disable the firewall, fwconsole firewall start to start the firewall, and fwconsole firewall add trusted 192.168.1.0/24 to add a subnet to the trusted zone.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Firewall Command Line

Starting with FreePBX Firewall version [Link] (with additional options added in ver. [Link]), the FreePBX Firewall has the following
command line controls:

for help use: fwconsole firewall --help


Help
[root@lgaetzdev2 ~]# fwconsole firewall --help
______ ______ ______ __ __
| ___| | ___ \| ___ \\ \ / /
| |_ _ __ ___ ___ | |_/ /| |_/ / \ V /
| _| | '__| / _ \ / _ \| __/ | ___ \ / \
| | | | | __/| __/| | | |_/ // /^\ \
\_| |_| \___| \___|\_| \____/ \/ \/

Usage:
firewall [options] [--] <cmd> [<opt>] [<ids>]...

Arguments:
cmd Command to run (see --help)
opt Optional parameter
ids IDs to add or remove from a zone

Options:
-f, --force Force Add/Removal of entry
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal
output, 2 for more verbose output and 3 for debug

Help:
Valid Commands:
disable : Disable the System Firewall. This will shut it down cleanly.
stop : Stop the System Firewall
start : Start (and enable, if disabled) the System Firewall
restart : Restart the System Firewall
lerules [enable] or [disable] : Enable or disable Lets Encrypt rules.
trust : Add the hostname or IP specified to the Trusted Zone
untrust : Remove the hostname or IP specified from the Trusted Zone
list [zone] : List all entries in zone 'zone'
add [zone] [id id id..] : Add to 'zone' the IDs provided.
del [zone] [id id id..] : Delete from 'zone' the IDs provided.
fix_custom_rules : Create the files for the custom rules if they don't
exist and set the permissions and owners correctly.
When adding or deleting from a zone, one or many IDs may be provided.
These may be IP addresses, hostnames, or networks.
For example:

fwconsole firewall add trusted [Link]/24 [Link] [Link]


Firewall commands and usage examples:
disable - This disables the FreePBX Firewall module, stops the service, and immediately flushes all iptables rules. Disable differs from
stop in that the module stays disabled after a reboot. Note there is no corresponding enable command, use start instead.

Example
# fwconsole firewall disable

stop - This temporarily stops the FreePBX Firewall until it is manually started or until the pbx is booted. All existing iptables rules are
immediately flushed.

Example
# fwconsole firewall stop

start - This starts the FreePBX Firewall, enabling first if necessary

Example
# fwconsole firewall start
Enabling Firewall.

Broadcast message from <fqdn redacted> (Wed Apr 13 [Link] 2016):


Firewall service now starting.

restart - Stops service if running and starts again

# fwconsole firewall restart


Enabling Firewall.

lerules - enables or disables the Lets Encrypt rules to allow inbound LE validation on port 80

# fwconsole firewall lerules enable


Lets Encrypt rules enabled successfully. Restarting Firewall...
# fwconsole firewall lerules disable
Lets Encrypt rules disabled successfully. Restarting Firewall...

trust - Adds a host to the list of trusted networks shown on the zones, networks page
Examples
# fwconsole firewall trust [Link]
Attempting to add [Link] to Trusted Zone
Success. Entry added to Trusted Zone.

# fwconsole firewall trust [Link]/24


Attempting to add [Link]/24 to Trusted Zone
Success. Entry added to Trusted Zone.

untrust - removes a host (if present) from the list of trusted networks shown on the zones, networks page

Examples
# fwconsole firewall untrust [Link]
Attempting to remove [Link] from Trusted Zone
Success. Entry removed from Trusted Zone.

# fwconsole firewall untrust [Link]/24


Attempting to remove [Link]/24 from Trusted Zone
Success. Entry removed from Trusted Zone.

list - list all hosts for a specified zone, acceptable zones are external, other, internal, trusted, and blacklist

Examples
[root@lgaetzdev2 ~]# fwconsole firewall list blacklist
All blacklisted entries.
[Link]
[Link]: (Resolves to [Link])

[root@lgaetzdev2 ~]# fwconsole firewall list trusted


All entries in zone 'trusted':
[Link]/16
[Link]/12
[Link]/8
fc00::/8
fd00::/8
[Link]/32

add - add host(s) to specified zone, acceptable zones are external, other, internal, trusted, and blacklist, separate multiple hosts by
spaces
Examples
[root@lgaetzdev2 ~]# fwconsole firewall add blacklist [Link]
[Link]/24
Attempting to add '[Link]' to Blacklist ... Success!
Attempting to add '[Link]/24' to Blacklist ... Success!

[root@lgaetzdev2 ~]# fwconsole firewall add other [Link]/24


Attempting to add '[Link]/24' to Zone 'other' ... Success!

del - delete host(s) from the specified zone, acceptable zones are external, other, internal, trusted, and blacklist, separate multiple hosts
by spaces

Examples
[root@lgaetzdev2 ~]# fwconsole firewall list other
All entries in zone 'other':
[Link]/24

[root@lgaetzdev2 ~]# fwconsole firewall del other [Link]/24


Attempting to remove [Link]/24 from 'other' Zone ... Success!

[root@lgaetzdev2 ~]# fwconsole firewall list other


All entries in zone 'other':

Common questions

Powered by AI

Listing hosts in specific zones facilitates network management by providing administrators with a clear overview of the entities associated with different security categories such as external, internal, trusted, or blacklist. This allows for quick auditing and verification of network policies, highlighting vulnerabilities or unauthorized access attempts. The command 'fwconsole firewall list [zone]' aids in maintaining efficient oversight and ensuring each host is properly categorized, which is essential for optimal network functionality and security management .

Differentiating between zones like 'trust', 'blacklist', 'external', and 'internal' is crucial for implementing a nuanced security strategy within a firewall. Each zone classification allows network administrators to apply different security policies tailored to the level of trust or threat associated with each category. This compartmentalized approach enhances security by isolating potential threats, ensuring trusted networks have requisite access while preventing unwanted entities from accessing sensitive areas. Strategically, it improves usability and control, streamlines security management, and supports robust, granular policy enforcement .

Placing hosts in the 'trusted' zone using the 'add' command allows them to bypass security restrictions, which can result in significant security risks should a supposedly trusted host be compromised. The risks include unauthorized data access, network breaches, and spread of malware. To mitigate these risks, it is essential to conduct thorough vetting and continuous monitoring of trusted hosts, regular review of access permissions, and employ intrusion detection systems to ensure that any potentially compromised trusted hosts are promptly identified and dealt with .

The 'trust' command within FreePBX is used when a network administrator wants to allow specific hosts or IP addresses to bypass the firewall's protective rules. This command is crucial in scenarios where trusted devices or networks need uninterrupted access to system resources for functionality or monitoring purposes. By adding these entities to the Trusted Zone using 'fwconsole firewall trust <hostname/IP>', the command ensures these entries are granted allowances through the firewall without restrictions, thereby optimizing network security management while maintaining necessary access .

The purpose of enabling or disabling Lets Encrypt rules within the FreePBX Firewall is to control the acceptance of inbound LE validation on port 80. This management is achieved using the command line by executing 'fwconsole firewall lerules enable' to allow or 'fwconsole firewall lerules disable' to reject Lets Encrypt validation requests. This facilitates secure certificate validation and management by selectively permitting inbound traffic only when needed .

Flushing iptables rules using the 'stop' command temporarily clears all established firewall settings, thereby stopping barriers to inbound and outbound traffic until the firewall is started again or the system is rebooted. Unlike 'disable', which remains active through reboots, 'stop' clears rules only for the current session, allowing normal operation upon a system restart. While temporary, rule flushing effectively creates a vulnerable state by allowing unrestricted access to and from the server, stressing operational caution in environments where continual protection is crucial .

The 'start' command in the FreePBX Firewall command line interface initializes the firewall and enables it if it was previously disabled. Unlike the 'stop' command, which temporarily halts the firewall until it is manually restarted or until the system reboots, the 'start' command not only initiates the firewall but also activates it permanently unless stopped again. This makes 'start' critical for permanently maintaining firewall protection, whereas 'stop' provides a means for temporary service cessation without persistent disablement .

Using the 'disable' command on the FreePBX Firewall module results in shutting down the firewall service and flushing all iptables rules immediately. A critical implication of this action is its persistence across system reboots, contrasting with the 'stop' command that only temporarily halts the service until a reboot occurs. Consequently, 'disable' carries significant risk if not reverted, as it leaves the system unprotected until the firewall is manually restarted after repeated reboots, potentially exposing the system to persistent vulnerabilities .

The 'fix_custom_rules' command is important because it automates the creation and configuration of files necessary for custom firewall rules. It ensures these files exist and that correct permissions and ownership are applied, preventing potential security oversights due to human error. By maintaining accurate and secure custom rule setups, this command helps administrators enforce tailored security policies efficiently, minimizing confusion and the risk of misconfigured firewall settings .

Verbosity levels in the FreePBX Firewall command line play a critical role in managing the output detail during command execution processes. By adjusting these levels — with simple to debug outputs (`-v`, `-vv`, `-vvv`) — administrators can control the amount of feedback received. Basic verbosity provides normal output, higher verbosity grants more detailed messages, and the maximum level provides comprehensive debugging information. This system is vital for troubleshooting and ensuring that administrators have the necessary information to monitor actions, diagnose issues, and verify command success .

You might also like