This document shows how to create a network security firewall to meet specific network protection goals. It contains actual examples for configuring a series of IP filters that together allow only specific user activity, while blocking all other activity.
This chapter contains the following section:
Firewall Scenario
Goals of the Firewall
Creating the Firewall Profile
Allowing Access to the Web Server
Allowing Internal Client Access to External Services
Preventing Spoofing of Source Addresses
Summary
Note: This chapter does not cover all connectivity issues. See Profile and Filter Examples for examples of additional filters that you may need.
Figure 1 Typical Data Flow Between a Corporate Network and the Internet
There are a number of data flows between computers inside the corporate network and computers outside the corporate network.
All the packets in these data flows must pass through the GTSecure firewall.
IP Filters Config>add profile firewall
IP Filters Config>set interface 1 profile=firewall
Figure 2 No Filters Defined, No Communication
Allowing Access to the Web Server
IP Filters Config>add filter firewall.webaccess direction=both destination=162.2.2.1 dport=http
The filter does not need a source address because the goal is to allow everyone to communicate with this server.
When you set a filter's direction to both, enter the source and destination information for inbound traffic. Before GTSecure applies the filter to outbound traffic, it swaps the source and destination information. In this case, when the software compares the filter against outbound packets, it looks for a source address of 162.2.2.1 and a source port of HTTP.
Setting the destination port to HTTP allows access only to the Web server, and does not allow access to, for example, FTP or Telnet servers on the same host.
The software recognizes certain well-known ports, such as HTTP, by name. When you enter a well-known port name, the software automatically sets the protocol correctly.
To enter a port number, you must first set the protocol to TCP or UDP. For example, HTTP is port 80. If you set the destination port to 80 in the above command, instead of HTTP, you first need to specify protocol=TCP.
Note: Because the direction of the webaccess filter is both, the destination address and destination port have an "i" next to them, which means that the information shown applies to inbound packets. As Figure 3 shows, outside users can send HTTP packets to Server-C, but they cannot send FTP packets or other packets to Server-C.IP Filters Config>list filter firewall.webaccess
Listing Filters
Name Dir Address Port Protocol Idle
Action
---------------------------------------------------------------------------
webaccess both ida=162.2.2.1 idp=HTTP(80) TCP Pass Off
Figure 3 Filter Defined, Outside Users Can Send HTTP Packets To and Receive HTTP Packets From the Web Server
Allow any computer to establish data flows with the corporate Web server (HTTP) running on Server-C.
Prevent external access to other applications on Server-C.
Prevent external access to any application on personal computers.
Prevent internal users from offering illegal servers to the Internet.
FTP utilities that do not run in PASV mode. These utilities use two connections, an initial channel for commands only and an additional channel for actual file transfers.
TFTP, which uses UDP and changes port numbers in mid stream.
Scoping the Command Line
The scope command reduces the amount of data entry. Since the next steps involve the firewall profile, enter the scope command to reduce data entry.
Notice that the prompt changed to include firewall. All commands you enter at theIP Filters Config>scope firewall
IP Filters Config firewall>
IP Filters Config firewall> prompt apply to the firewall profile.
Allowing Internal Access to External Servers
Client programs generally use transient port numbers. Therefore, a simple scheme to allow internal access to external servers is to create an opening in both directions for transient port numbers inside the firewall. Add the following filter:
This filter also works for FTP, which has an incoming connection back from external servers, because that connection is to a transient port on the internal client.IP Filters Config firewall>add filter client dir=both protocol=tcp dport=transient
However, this simple scheme neither prevents internal users from offering illegal servers to the outside world by configuring them on transient ports, nor does it protect internal clients from a form of attack called port fishing. In this attack, an external hacker tries to send data to all transient port numbers hoping to disrupt established data flows.
Improving Security on Internal Client Connections
This section shows how to modify the profile to prevent the port fishing and illegal server problems.
IP Filters Config firewall>delete filter client
IP Filters Config firewall>add filter icout dir=out protocol=tcp sport=transient
IP Filters Config firewall>add filter icout.response dir=in destination=source source=destination sport=dport dport=sport idle=300
Figure 4 How the Parent and Child Filters Work
Handling FTP
The filter icout does not work for FTP client applications unless they operate in PASV mode, which uses only one TCP connection. If the application does not run in PASV mode, when an internal client connects to an external FTP server, the initial channel is for commands only. Actual file transfers take place over additional connections that the FTP server establishes. That is, the internal client receives an incoming connection from an FTP port to a transient port.
The following steps show how to create a parent filter and a series of child filters to handle FTP applications that do not operate in PASV mode.
IP Filters Config firewall>add filter ftpclient dir=out dport=ftp_control sport=transient before=icout
IP Filters Config firewall>add filter ftpclient.response dir=in dest=source source=dest sport=dport dport=sport idle=300
IP Filters Config firewall>add filter ftpclient.inwide dir=in dest=source source=dest dport=transient sport=ftp_data ptype=syn delete=on idle=30
As soon as GTSecure recognizes a packet from the FTP server to the client, it uses the specific destination port to install this child filter, inwide.narrower. The filter ftpclient.inwide uninstalls itself. The idle time on the final filter is five minutes, which should be enough to allow a file transfer to pause and recover.
IP Filters Config firewall>add filter ftpclient.inwide.narrower dir=both dest=dest source=source dport=dport sport=sport idle=300
IP Filters Config firewall>add filter udp dir=out protocol=udp sport=transient
IP Filters Config firewall>add filter udp.reply da=sa sa=da dp=sp sp=dp idle=30
The following steps show how to create parent and child filters to handle TFTP traffic from an internal client to an external TFTP server.
IP Filters Config firewall>add filter tftpc dir=out protocol=udp sport=transient dport=tftp
IP Filters Config firewall>add filter tftpc.response dir=in dest=source source=dest sport=transient dport=sport delete=on idle=30
IP Filters Config firewall>add filter tftpc.response.narrower dir=both dest=dest source=source dport=dport sport=sport idle=600
Because the direction of this filter is both, it also adds a new hole to pass the client's outbound packets back to the server. These packets are now going to a different port than the first packet.
To prevent this, add a filter that blocks any packets coming from the Internet that claim to have a source address that matches any network on the inside of the firewall. Such a packet is clearly a spoof and is some sort of attack.
In the example in Figure 1, the internal network number is 162.2.2.0. The following filter suffices:
IP Filter Config firewall>add filter nospoof before=* dir=in source=162.2.2.0&255.255.255.0 action=block
| Goal | Filters Added to Satisfy |
|---|---|
| webaccess | |
|
icout (2 filters) ftpclient (4 filters) tftpc (3 filters) udp (2 filters) | |
| None needed | |
| None needed | |
| None needed | |
| nospoof |