Linux Firewall Survey, Part 1
Security has always been a critical issue for computer networking, and firewalls are an essential ingredient for network security. In this series, I will show you how Linux offers you freedom of choice in this area. There are many firewall solutions for Linux. Most are open source applications, but some excellent commercial products have been ported to Linux. I'll also show you how the Linux kernel can be used to build a highly integrated hardware firewall.
Setting up a firewall on Linux
Many companies and ISPs use Linux machines as an Internet gateways. These machines often serve as mail, Web, news, or dialup servers. In addition, they also often work as network firewalls, enforcing access control policies between the Internet and corporate networks. That functional flexibility makes Linux an attractive alternative to commercial, proprietary network operating systems.
| Firewall architectures | |
|---|---|
|
ipchains command-line tool. Most firewall applications for Linux, such as PMFirewall or Mason, are nothing more than ipchains configuration tools that simplify the setting and maintenance of IP-filtering rules. If you want to use ipchains, you will need to establish a set of rules that will be used to define permissible and forbidden connections. Your rule set can look something like this:
# Allow Web connections to your Web Server
/sbin/ipchains -A our_chains_rules -s 0.0.0.0/0 www -d 192.16.0.11 1024:
-j ACCEPT
# Allow Web connections to outside Web Server
/sbin/ipchains -A our_chains_rules -s 192.61.0.0/24 1024: -d 0.0.0.0/0
www -j ACCEPT
# We want to deny everything else
/sbin/ipchains -P our_chains_rules input DENY
The most common network configuration for packet filtering is a dual-homed host -- a computer with two network interfaces, with each interface assigned a different IP address. These kinds of firewalls almost always cooperate with IP Masquerading to hide the internal network. Packet filtering is completely transparent to users and no additional client software (i.e., Web browser) configuration is required.
Unfortunately, the packet filtering included in the standard Linux kernel isn't a sufficient solution when you want to control and block content. Ipchains, for example, is unable to block ActiveX or Java applications. Another disadvantage is that the only identity a user has is the IP number assigned to his or her workstation, so problems arise when the administrator decides to use DHCP (dynamic IP assignments). The administrator will have to adjust the rules every time a new IP number is assigned. This can easily become a nightmare.
Thus, proxy gateway architectures are becoming more popular: they fulfill the need for active control and content blocking.
T.Rex Firewall -- use the source!
T.Rex Firewall is a complex application-gateway firewall developed by Freemont Avenue Software, a small company that has specialized in Internet security since 1994. T.Rex firewall is the company's main product. (By the way, the firewall is named after the Terrier Rex, a breed of dog known for its bravery.) The firewall runs on a multihomed machine with two or more network interfaces and contains specialized application proxy servers, a generic proxy server for TCP applications, and a SOCKS server for setting up a circuit gateway. T.Rex also comes with a simple intrusion detection system, extended logging, and strong authentication support.
T.Rex is the most powerful proxy firewall suite freely available to Linux users at this time. It features many tools and services (like process monitoring and failover capabilities) that have previously been available only in expensive proprietary firewalls.
T.Rex was open sourced in April 2000 and over 14,000 copies have been distributed since then. It isn't covered by the GPL license, however. Instead, it uses the more restrictive Livermore Public License 1.0 (LPL), which is based on the Q Public License (QPL, used by the Qt library). I think the GPL would have been a better choice, especially now that Trolltech has released a Qt Free Edition that is covered by the GPL. Therefore, T.Rex should be considered to be an open source application to the same degree that Qt is.
T.Rex is available in two versions. The commercial product comes on a CD-ROM along with precompiled binaries, source code, and an easy-to-use installation script. The second version is just the source code freely available for download. Documentation is also available for free download (including the T.Rex Administration Guide, which is 400 pages long!); however, you won't find too much information specific to Linux installation and configuration issues.
T.Rex strives to be a complete firewall solution. It has so many features that it's hard to briefly describe them all. T.Rex includes a bunch of application-specific proxy servers for FTP, HTTP, Telnet, RPC/UDP, reverse HTTP, and Real Audio. It also contains secure mail wrappers; Aproxy, a generic proxy for TCP applications (i.e., NNTP, Lotus Notes, Sybase SQL, DB2, Oracle SQL Net, Microsoft Exchange) and a SOCKS 4/5 server for setting a circuit gateway. It also features NAT, packet filtering, Web caching, and a dual DNS server (separate servers for internal and external hosts).
All proxies run without root privileges (in user-space mode), so software failures or security violations cannot propagate and cause a whole system to be compromised. The HTTP proxy has a Web content blocking ability and T.Rex comes with large sample list of IP addresses divided into 30 thematic categories. You can also turn on blocking for Java, JavaScript, and ActiveX objects.
There are also two tools intended for remote administration: ptelnet, a secure Telnet client, and Hoplite, a Java-based GUI administration tool that simplifies administration and is also intended for remote administration. Both tools use triple DES encryption and challenge-response strong authentication for external connections. Both tools are available for most common Unix systems and also for Windows.
I was impressed by the amazing support for tokens and smart cards that can be used for building a strong challenge-response-based authentication system (see Figure 1). This is another feature that cannot be found in other free firewalls. Tokens provide higher levels of security and are very comforting for administrators.
Figure 1. Hoplite's challenge-response login screen |
Setting up T.Rex on Linux
Like all application-level proxies, T.Rex requires a powerful machine. An average configuration would include a Pentium III processor with 32 MB RAM for every 100 concurrently active Web browsers, along with an Ultra Wide SCSI hard disk for caching. It is also a good idea to get a separate drive for firewall logs. Each log record contains about 150 bytes, so you can easily accumulate hundreds of megabytes of logs when running popular Web services. T.Rex can work not only in an Ethernet environment but also with Gigabyte Ethernet, Token Ring, and ATM networks.
I was able to compile T.Rex and perform a basic configuration in about an hour. The great thing about T.Rex is that it doesn't require kernel recompilation and doesn't use kernel modules. This simplifies initial setup. Of course, you must turn off the IP packet forwarding option in the kernel to force every IP packet through the proxy. If you're preparing a production environment, you should recompile the kernel without any extra options turned on (i.e., no sysRq key feature). The whole T.Rex compilation is started from one script, buildsetup.sh, and doesn't require too much interaction with the user.
Compilation takes about 20 minutes (though that can vary depending on your machine's processor speed) and will proceed without errors if you have the common GNU development tools installed (more or less the same requirements as for a kernel compilation). It is a good idea to prepare these binaries on a machine other than the firewall host itself because you shouldn't install unnecessary software (compilers, libraries, etc.) on a firewall machine.
Installation of T.Rex requires operating system hardening. You should remove all unnecessary network services such as lpd, all the r commands (rsh, rlogin, rexd, rexecd, rstatd, and rwalld), and finger, so you'll need to edit three key system configuration files: /etc/inittab, /etc/inetd.conf, and /etc/services. All T.Rex configuration files can be found in the /etc/firewall/ directory. The single most important file is /etc/firewall/securenets, which defines IP addresses for networks that should be treated as secure (no strong authentication is required to fulfill requests for various services from these nets). The second most important file is /etc/firewall/secureports, which contains IP addresses for the network adapter attached to the secure network.
Every proxy has its own short configuration file located in /etc/firewall -- /etc/ftproxy.conf for the FTP proxy or /etc/tnproxy.conf for the Telnet proxy, for example. I like this because it is easier and more secure to edit and check many short files than maintain one huge config file with hundreds of options.
T.Rex runs from the /etc/rc.d/TREX script that starts all services and tools in the appropriate order, so you need only make the appropriate symbolic links to the default run-level directory in /etc/rc.d/. All T.Rex binaries can be found in the /usr/local/etc/ directory, so it's easy to control them.
After a successful installation and initial configuration, you should create a special administration account in T.Rex to use for remote firewall administration. (You can, of course, also use the local system console.) To create an administration account, first create an ordinary Linux user account and then use the gwuser command to attribute administrative rights to it. You will also need to generate a private DES key, using the tnkey command, for the ptelnet and Hoplite administration tools. This key should be copied to the client machine that will be used by the administrator.
The T.Rex account system reminds me of the Linux account system for groups and users, but it uses its own encryption keys and access control rights database. The T.Rex access system is based on an individual user's ID and password; additional restrictions are based on source or destination addresses.
The next step is to configure Hoplite, the Java administration tool that connects with a special admin server, padminsvr, running on the firewall. This is where my troubles began: I was unable to run Hoplite right out of the box. This is because Hoplite comes in a binary form prepared under JDK 1.1.x plus the Swing libraries; I was unable to run it under JDK 1.2.2. My troubles ended after a Hoplite recompilation (although Hoplite's starting script also required some tweaking of the JDK base directory setting).
Hoplite is a rather primitive tool, used for editing configuration files for different proxies and backing up the T.Rex configuration. Nevertheless, it provides basic realtime event monitors, like Log Viewer and Alert Panels. You can even use it to start and stop selected proxies (see Figure 2). Unfortunately, you cannot create a firewall account for firewall users with Hoplite. You must use gwuser and gwgroup instead.
Figure 2. Managing T.Rex proxy servers with Hoplite |
Monitoring and logging features
T.Rex uses the syslogd daemon for logging all network and proxy activity. Only the HTTP proxy generates its own separate transfer and error logs. Hoplite can display a realtime preview for the system log. Logging levels can be set separately for each proxy server. Most proxies have their own reporting tools that read the system log and produce a concise report with information specific for that proxy. For example, Aproxy uses aproxsum, sockd uses sockdsum, and tnproxy uses tnrpt. Such reports are a good idea; it's much easier to read filtered and condensed information than it is to dive into a huge log file.
T.Rex also has a built-in monitoring/intrusion detection system that is built on three daemons, fwmon, procmon, and spoofmon:
fwmonperiodically checks the operating system's IP forwarding settings and disables them if needed. (See Figure 3).procmoncounts the number of occurrences for each defined process and issues an alert if that number falls outside of the specified range (e.g., if the process isn't running). You can useprocmonto monitor processes other than the T.Rex system.spoofmonis a spoofing detection system that monitors TCP/IP connection requests to the firewall to determine if a request's source IP address has been spoofed. It communicates with the proxies in order to reject and log any source IP address that is originating spoofing attempts.
Figure 3. Configuring the fwmon intrusion detection tool |
I also recommend the use of some automated tool (Tripwire is a good choice) for checking the integrity of binaries and configuration files.
| Pros and cons of T.Rex | |
|---|---|
|
Alternative free firewall solutions
Of course, T.Rex isn't the only open source proxy firewall available for Linux. Here are some of the alternatives:
Dante
Dante is a circuit-level firewall/proxy developed by Inferno Nettverk A/S and is freely available under the BSD license along with source code. Dante tries to be transparent to clients while offering detailed access-control and logging facilities to the server administrator. Dante derives from SOCKS 4/5. Dante has experimental (and incomplete) support for Microsoft Proxy, so Linux client applications can use that proxy.
SINUS
The SINUS Firewall is a TCP/IP packet filter for Linux distributed under the GNU GPL. It tries to address the disadvantages of ipchains -- static IP addressing and complicated administration. Its greatest advantage is that it is easy to configure and contains a Java-based GUI management interface, called sfControl (see Figure 4), for remote configuration and firewall management. SINUS is able to switch configurations on the fly without breaking existing TCP connections. If you combined SINUS with FWTK (see below), you could build a strong and flexible firewall solution.
Figure 4. Defining a filtering rule with the sfControl tool |
TIS Firewall Toolkit
TIS Firewall Toolkit (also known as FWTK) was developed by Trusted Information Systems, which merged with Network Associates in 1998. The TIS Internet Firewall Toolkit (available with source code under the TIS Firewall Toolkit License, a BSD-like license) is a set of proxy servers and tools designed to facilitate the construction of network firewalls. It contains proxy servers for FTP, Telnet, SMTP, the Web, Gopher, and rlogin. FWTK contains a simple tool, netacl (Network Access Control List), that simplifies access management to network services. Access is based on IP addresses. FTWK includes a login program called login-sh that replaces the user's initial shell. The shell supports Security Dynamics SecurID, SecureNet Key, and Racal Watchword authentication services.
- "Installing a Firewall, Part 1," Sam Mikes and Danielle Michaels (LinuxWorld, October 2000) -- first installment of our companion series:
http://www.linuxworld/linuxworld/lw-2000-10/lw-10-fwinstall1.html - "The Back Door to Frontpage," Nicholas Petreley (LinuxWorld, April 2000):
http://www.linuxworld.com/linuxworld/lw-2000-04/lw-04-penguin_3.html - Firewall HOWTO:
http://metalab.unc.edu/pub/Linux/docs/HOWTO/Firewall-HOWTO - Ipchains HOWTO:
http://www.linuxdoc.org/HOWTO/IPCHAINS-HOWTO.html - IP Masquerade HOWTO:
http://metalab.unc.edu/pub/Linux/docs/HOWTO/IP-Masquerade-HOWTO - T.Rex Website:
http://www.opensourcefirewall.com/ - Dante, from Inferno Nettverk A/S:
http://www.inet.no/dante/support.html - SINUS:
http://www.ifi.unizh.ch/ikm/SINUS/firewall/ - TIS Firewall Toolkit from Trusted Information Systems:
http://www.tis.com/research/software/ - SOCKS network proxy protocol:
http://www.socks.nec.com/ - ICSA's firewall testing criteria:
http://www.icsa.net/html/communities/firewalls/certification/criteria/criteria_3.0a.shtml - ICSA firewall buyer's guide:
http://www2.icsa.net/portal/portal.ctrl?
url=http://www.icsa.net/html/communities/firewalls/buyers_guide/index.shtml - CRYPTOCard tokens:
http://cryptocard.com - Mason -- the automated firewall builder tool for ipchains:
http://www.fwtk.org/mason/ - PMFirewall -- ipchains firewall and IP Masquerading configuration utility for Linux:
http://www.pointman.org - How to set up ipchains with PMFirewall tool (for beginners):
http://www.linux-mandrake.com/en/demos/Networking/IPmasq/pages/ipmasq3.php3 - Ganymede Chariot -- a network testing tool:
http://www.ganymede.com
F-Secure Warns About a Worm Affecting Corporate Networks 2009-01-08 16:42:00+11
Fortinet Cures Mobile Phone “Curse of Silence/CurseSMS” Attack 2009-01-07 16:30:00+11
SEAGATE SHIPS DESKTOP HARD DRIVE WITH WORLD’S HIGHEST AREAL DENSITY – 500GB PER DISK 2009-01-06 15:34:00+11
New FileMaker Pro 10 Ships With Sleek New Interface and Breakthrough Reporting and Automating Features 2009-01-06 12:21:00+11
Lexar extends KODAK offering with Secure Digital High-Capacity, High-Speed Memory Card 2009-01-06 09:36:00+11



