ClearOS Incoming Firewall
ClearOS Incoming Firewall
Installation
If your system does not have this app available, you can install it via the Marketplace.
Menu
You can find this feature in the menu system at the following location:
Network|Firewall|Incoming Firewall
Configuration
Incoming Connections
When the firewall is enabled on your ClearOS system, the default behavior is to block all external
(Internet) traffic. If you plan on running services on your ClearOS system that can be accessible from the
Internet, then you will need to add the firewall policy to do so. For example, the OpenVPN server requires
UDP port 1194 to be open on the firewall.
You can also open up ports to allow for remote management of your ClearOS system. For example, you
can open up TCP port 81 to give access to the web-based administration tool (webconfig).
Links
Port Forwarding
Intrusion Prevention
Intrusion Protection Updates
Port Forwarding
The Port Forwarding app is required if you plan to have publicly available servers running on your local
network. For example, you may need use the port forward tool to send voice traffic to a PBX (phone
system) running on your local network.
The ClearOS Port Forwarding module takes packets destined for a port on the ClearOS firewall's external
IP and translates that to an internal IP address. If you wish to add additional public IP addresses and
forward those ports you will want to use the 1 to 1 NAT app which takes care of the IP addressing,
firewalling, and NAT translations in a simple way.
Installation
If your system does not have this app available, you can install it via the Marketplace.
Menu
You can find this feature in the menu system at the following location:
Network|Firewall|Port Forwarding
Configuration
If you run servers behind your ClearOS gateway, you can use the Port Forwarding page to forward ports
to a system on your local network. There are three ways to add a port forwarding firewall rule:
Select a standard service in the Standard Services form.
Input a protocol and single port number in the Port form.
Input a protocol and multiple consecutive ports in a port range in the Port Range form.
Troubleshooting
In order for port forwarding to work properly, the target system on your local network must have the
default gateway set to ClearOS system.
Links
1 to 1 NAT
Custom Firewall
Though most administrators will be able to accomplish all their firewall needs using the standard ClearOS
web interface, it may be necessary to add custom firewall rules in some scenarios. The Custom Firewall
Tool provides a way to create advanced firewall rules. Please use with caution!
Installation
If you did not select this module to be included during the installation process, you must first install the
module.
Menu
You can find this feature in the menu system at the following location:
Network|Firewall|Custom
Configuration
An invalid custom rule can block remote access to webconfig.
Examples
Limit SSH/Webconfig Access to Specific IP Addresses
The following entries would restrict remote SSH (port 22) an Webconfig (port 81) access to specific IP
address that you define (i.e. allow remote login from office, home, datacenter etc.).
More Examples
You can find more examples here.
Custom Firewall Module Examples
This Howto will give specific examples to help you craft appropriate firewall rules that work well with
ClearOS. ClearOS has a Custom Firewall app that allows raw IPTables rules that can be used in
conjunction with the rest of the firewall. This guide contains examples of some useful rules. Be careful
making rules. Iptables can deny your connection to the server if malformed.
For these examples we will use the network WAN network of 1.2.3.0/28 with .1 as the target router of our
ISP, .4 is our ClearOS server. The DMZ network is 5.6.7.0/27 with 5.6.7.8 as the ClearOS DMZ IP
address. The HotLAN network is 172.22.22.0/24 with ClearOS as 172.22.22.22. The LAN is
192.168.1.0/24 with 192.168.1.1 as the ClearOS server and 192.168.1.10 as a third party web/file server.
Content Filter
Bypass
If you are running a gateway ClearOS system and wish to bypass the content filter for a single IP address
you can create a rule so that it surfs the web normally.
Same as above but for a group of computers from .16 through .31.
Another example of a content filter bypass method is to bypass a certain URL for a everyone. This can
come in handy if the content filter is having difficulty processing a non-standard web object. Certain
authentication types from a large OS vendor in Redmond, Washington (for example) sometimes get
crushed by the content filter. The following will bypass the filter for that site:
Proxy Server
Bypass
If you are running a gateway ClearOS system and wish to bypass the proxy server for a single IP address
you can create a rule so that it surfs the web normally. This is the same method for the content filter.
Same as above but for a group of computers from .16 through .31.
Another example of a proxy bypass method is to bypass a certain URL for a everyone. This can come in
handy if the proxy is having difficulty processing a certain web object:
Port-based Filtering
Much like passing traffic to bypass the content filter, you can single out ports that are normally passed and
drop them for certain hosts or a range of hosts. For example, you can block SMTP for your entire DHCP
range of addresses if your DHCP scope goes from 192.168.1.128-254
eth1: LAN1
eth2: LAN2
iptables -N log-traffic
iptables -I log-traffic -j LOG --log-prefix "Traffic log: "
Next, you can add rules that can be directed to the logger. Here are some examples:
# Log traffic destined to 1.2.3.4
iptables -I FORWARD -d 1.2.3.4 -j log-traffic
# Log traffic destined to port 12345
iptables -I FORWARD -p tcp --dport 12345 -j log-traffic
The information is logged to the /var/log/messages log which can be viewed in the web-based interface
using the Log Viewer app. Please be careful with this tool since it doesn't take long to fill up the log file if
too much traffic is caught!
Gateway Services
To bypass all gateway services except for NAT, you can use a rule like this:
This rule will bypass all filtering of all types for this IP address. If you want to limit it to bypass for TCP only
services, you the following:
HotLAN to LAN
Let us say that there is a service on a server inside your LAN that you wish for users on the HotLAN to
access. This is similar to a Pinhole method in the DMZ app. For this example your LAN network is
10.1.1.0/24 and your HotLAN network is 192.168.1.0/24. In this example the service is port 25 SMTP on
the server 10.1.1.10. You can add a forwarding rule using the Custom Firewall app:
In this example, our internal server is 10.1.1.110 and is running SMTP. We want to make it so that
3.2.1.0/24 can get to it but only this range.
Links