Application Proxy
An application proxy is used to communicate with the Internet on behalf of your host. If you want to visit a Web page, the HTTP proxy (Web proxy) contacts that Web host on your behalf, then sends the information back to your system (Figure 310). You need only to communicate with the proxy. In essence, the proxy acts as a middleman between you and the remote host.
FIGURE 310 Application proxy. The internal client requests a page from http://www.example.com. The client's browser is configured to send all requests to Proxy. Proxy receives request from Client and issues its own request for the page at http://www.example.com. The remote host replies to Proxy. Proxy replies with the data from http://www.example.com to Client.
Proxied communications provide a very powerful layer of protection. The proxy can actually examine the data content of the communication and determine if it is valid for the application being used. For example, some applications like Napster circumvent many firewalls by passing traffic on port 80. Napster, in reality, is providing a file transfer service and should be communicating on some other ports; 7777, 8888, and 8875 are just some of the ports recorded as being used by Napster. If your packet-filtering firewall blocks all normal Napster traffic, but allows HTTP traffic on port 80, you could simply choose to use port 80 for the Napster traffic as well. An application proxy, however, would recognize that the content of the packets traveling through port 80 does not match normal Web traffic and would block the application.
I don't mean to pick on Napster here. Many applications, from streaming audio to email programs, can change the ports used in communications. In fact, anything could really be listening on a given port regardless of the service registered at IANA.
There is a cost associated with using a proxy. The proxy must intercept every packet sent from your host to a remote host, the proxy then generates its own request to the remote host, receives the reply, and generates the reply to be sent to your computer. A benefit of this, however, is that subsequent requests for that same service may be faster as the proxy can cache the information it receives from the remote host. If you request a Web page at http://www.example.com for the first time, the proxy must get the information from the actual remote host. It will then cache that information so that the next time you request the page at http://www.example.com the proxy can simply send you the cached version of the page.
Proxies do not, by definition, provide any packet-filtering services. You do not configure them to allow or disallow certain types of traffic. They only examine the data content to be sure it matches the content expected for a given application.
Application proxies also have the ability to perform a function often called reverse proxying (see Figure 311). Let's say you have a Web server you wish to protect; you publish the proxy server's address to the world, and external users connect to the proxy, which then sends a request to the Web server on the external client's behalf. The only host to ever contact your Web server is your proxy server.
FIGURE 311 Reverse proxy. The remote client requests the page at http://www.example.net. http://www.example.net resolves to 244.1.2.3, the address of the Proxy. Proxy sends a request from itself to the Web server, 172.16.1.3. Web server replies to Proxy. Proxy replies to remote client.
An application proxy is an application, normally run on a separate host. All protected hosts are configured to talk only to the proxy for a given service. It is important to note, though, that you need an application proxy for each application you wish to use. An HTTP/Web proxy is not going to be able to handle SMTP or FTP traffic for you. You will require an SMTP proxy and an FTP proxy if you wish to use these services.
How an Application Proxy Is Implemented in Personal Firewalls
In its most basic form, you run an application proxy for a given service, say HTTP (Web), then you configure the applicationsbrowsers, in this caseon your client computers to use the proxy for all requests. In MS Internet Explorer on a Windows box, you do this by configuring the proxy settings in the Tools, Internet Options dialogue.
In most cases, large companies who want all of their employees to access the Web through their proxy server use this method. Why? Well, for all the same reasons you would consider an application proxy: to hide and protect clients, to monitor and restrict access, and to speed up service for clients (through caching).
The Trusted Information Systems (TIS) Firewall Toolkit (fwtk) was designed to provide the building blocks for a Linux-based firewall solution. You take the components you need and build the system that is right for your environment. It provides proxies for FTP, HTTP, telnet, and others. As the product is no longer officially supported, the TIS team is not building any new proxy applications. However, there is a strong community surrounding the product that has added proxy applications for such things as IRC, UDP traffic, and MS SQL. Source code is also available and users are encouraged to review the code before implementing it.
fwtk uses three files to control access to the new proxy services. These files are /etc/services, which defines the ports that the services listen on; /etc/inetd.conf, which tells the inetd process which program to call for when a service is requested; and /usr/local/etc/netperm-table, which sets out the parameters that fwtk uses to allow or deny access to a service.
The entries in netperm-table for the HTTP proxy may look like the example below. This example is taken directly from the Firewall-HOWTO-10 at linux.org.2
# www and gopher gateway rules: http-gw: userid root http-gw: directory /jail http-gw: timeout 90 http-gw: default-httpd http://www.afs.net http-gw: hosts 192.168.2.* -log { read write ftp } http-gw: deny-hosts *
The first two lines simply set out the temporary directory for any files that need to travel through the proxy to the end user. The directory is owned by root and only accessible by root. Next is a short time-out value; since Web connections take little time, this will limit how long a client waits when there is a bad connection. The "default-httpd" line simply sets the default home page for those connecting to the proxy server. The settings for the HTTP proxy allow all hosts on the subnet 192.168.2 to access Web pages and FTP through this proxy, and log the connections. Finally, the last line denies all other hosts access to the proxy service.
In order to get this to work, you must also configure the /etc/services file to associate http-gw with port 80 traffic rather than the standard HTTP service. Finally, /etc/inetd.conf will be set up to call the correct program when traffic is seen on port 80.
Products That Use This Method
When I started to write this book, I figured this section would be very short. I didn't think any personal firewall products made use of proxy technologies. Well, I was wrong. I haven't found any commercial products yet, but, you guessed it, Linux has options. The TIS fwtk seems to be the original, but it is no longer officially supported or developed. There are other products like DeleGate and fw that are actively being developed. Check the Linux.org site for more information.
The nature of application proxy means you end up needing a proxy for every service you wish to run or connect to. So, while you can typically find HTTP and FTP proxies easily it may be more difficult to find an IRC proxy. What does this mean? Well, either you can't do IRC from your host (no proxy, no communication), you can use IRC but it's unprotected, or you install another type of firewall to ensure your host is protected while using IRC.
Advantages
The ability to cache data means that connections appear faster to end users when pages are retrieved from a proxy instead of the Internet. Caching in itself is not a firewall feature, but it is one benefit of using a proxy.
Proponents feel application proxies are the most secure methodthe proxy can validate the packet contents against the protocol's expectations, blocking packets that do not comply.
It is possible for an application proxy to be transparent to the user. This means that applications are aware of, and configured for, the proxy. The user does not have to perform any special steps in order to access the services they desire. Unfortunately, transparent proxies do not exist for all applications.
You can perform some level of content or access control. Through the authentication of users and applications, you can restrict access to resources based on a user ID, an IP address, even a MAC address.
Application proxies provide the best logging capabilities. You can see where a host is going and even retrieve the data exchanged when configured appropriately. From a corporate perspective, this could be useful for monitoring employee usage of the Internet.
Disadvantages
The primary issue with application proxies is the need to have one for every application. It can be difficult, if not impossible, to find an application proxy to support every application you wish to use. As a result, you will end up either accessing resources insecurely or using a second product to secure those services.
Application proxies are the slowest of the firewall solutions. They process the packets at the Application layer of the OSI model, which means a lot of resources are used to perform a proxy's tasks. To the user, it appears as if the Internet has slowed.
Not all application proxies are transparent to the user. In some cases, they require software to be installed on client computers, in others users must perform special functions to direct their applications to use the proxy server.
You will likely require a separate computer to host the proxy services. You will need to protect this host, as it is accessible to Internet hosts. The proxy server has protected your internal computers from attack, but that leaves it vulnerable to threats from the Internet.
Active Content
"HTTP is designed_to be readily extensible."3
In English, this means that we can expand the capabilities of Web pages beyond simple static content. Web pages now include programs that run on the client computer. Such features enhance our Web experiences.
Unfortunately, such features can also be used to cause damage to your computer. There are several computer Trojans and viruses that arrive as HTML pages with ActiveX code in them. One such Trojan, Trojan.JS.Offensive, uses ActiveX features to modify your browser's default home page as well as affecting your computer's functionality.
As far as the HTTP protocol is concerned, such applications are valid, the protocol allows for passing executable data. Because the data follow the rules of the protocol, a Web proxy server will forward the data on to the requesting client. When the data includes malicious code, this can be disastrous for the end user. An application proxy can only validate data against the protocol; it cannot determine the intent of the data.
Where an Application Proxy Fits in the Design of a Secure Environment
I guess I have a bias herefor the average home person, this approach is a little over the top. I'd argue there is too much maintenance, setup, overhead, and so on to make it a truly viable personal firewall option. If you have a small office with multiple users, it may make sense to send their communications through a proxy. Then you benefit from the ability to authenticate to the proxy and control who has access to what Internet resources (Figure 312).
FIGURE 312 Network design with application proxy. Server sits between clients and the Internet. All requests flow through proxy server. Must still protect the proxy server from attacks aimed at it, generally exploiting vulnerabilities below the Application layer.
Remember also, that an application proxy does not by definition perform any filtering. When you run an HTTP proxy, for example, your users can access any sites that provide HTTP services. If you want to stop communication with certain hosts, you will require another product to filter them out.