Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Apple > Operating Systems

Mac OS X Security and Mobility v10.6: Using a Firewall

  • Print
  • + Share This
This chapter focuses on mitigating and controlling access using Mac OS X firewalls on both the client and server. You’ll learn how to verify when attack attempts and system failures occur, and how to configure firewalls to guard against them.
This chapter is from the book


This lesson takes approximately 30 minutes to complete.


Control network traffic

Understand the firewall options in Mac OS X and Mac OS X Server

Explore the command line and remote configuration of firewalls

Security has never been more critical when administrating client and server systems.

Today’s external threats range from macro viruses embedded in documents and spreadsheets, to denial of service network attacks. All networked systems are potentially vulnerable to probes and attacks—intentional and unintentional—as assailants constantly scan systems connected to the Internet. However, attacks can also come from internal sources. In 2008 and 2009, the greatest number of reported data breaches actually came from within corporate networks.

To help administrators protect their systems, this chapter focuses on mitigating and controlling access using Mac OS X firewalls on both the client and server. In this chapter, you’ll learn how to verify when attack attempts and system failures occur, and how to configure firewalls to guard against them.

Understanding the Mac OS X Firewall

In the days before digital technology, the term firewall described an actual fireproof wall designed to contain fires, such as the barrier between a car’s engine and its passenger section.

Like those physical walls, computer firewalls work to prevent improper network packets from “burning through” a host or network perimeter. Today’s digital firewalls consist of hardware or software that blocks unauthorized network access from sources outside or inside your network.

Mac OS X has two software firewalls: the IP Firewall (ipfw) and the Application Firewall. While ipfw is available in both Mac OS X and Mac OS X Server, Mac OS X Server includes a graphical user interface for detailed configuration, monitoring, and troubleshooting. Mac OS X provides basic, user-oriented service configuration, and optional advanced configuration. Mac OS X Server also includes an Adaptive Firewall, which can add and remove firewall rules based on network events.

Using the Mac OS X Application Firewall

The most common method for securing network services is to configure a firewall at the network perimeter, where the network connects to a remote network such as the Internet. Most networks use a firewall to limit inbound traffic from the Internet or remote connections. In fact, most home and small business routers, such as Apple’s AirPort base stations, are designed with built-in firewall software.

While network-level firewalls will block unauthorized traffic trying to enter your network, they will not block traffic that originated inside your network. Also, if your Mac is mobile and frequently joins new wired or wireless networks, your computer will regularly encounter networks with different firewall rules or, possibly, no firewall protection at all. So secure mobile access is an important consideration in designing your overall firewall policies.

To protect against unauthorized network access to your Mac, you can enable the Application Firewall via System Preferences. Administrators can utilize command-line tools to enable and configure the firewall.

Network-based firewalls use a set of rules that target specific service port numbers, such as TCP port 80, the port used for standard HTTP services. However, certain network services—such as iChatAgent (the background process that receives incoming connections for iChat)—use a wide range of dynamically assigned ports. These dynamic multiport services use more than one port to transfer multiple data types. For example, iChat can transmit audio, video, screen sharing, and text all at one time, which requires a multiport approach. This typically causes configuration complications with network-based firewalls because numerous ports need to be open to allow the service to function.

As a solution to this issue, Mac OS X’s Application Firewall allows connections based on application and service needs without requiring the user or administrator to know the myriad ports these apps and services may use. For example, you can authorize iChatAgent to allow incoming connections without manually configuring ports or port ranges.

The Application Firewall in Mac OS X version 10.6 includes a new feature that enables administrators to allow signed software to receive incoming connections automatically. Applications that have been digitally signed by their authors can accept inbound network connections without further configuration from the user or administrator, simplifying administration of deployed systems. Digitally signing an application provides reassurance that the application has not been tampered with.

Its adaptive nature means the Application Firewall will open necessary ports only when an application is running. This prevents several types of known attacks on personal systems.

Configuring the Mac OS X Application Firewall

To enable and configure the Max OS X firewall using System Preferences, here’s what you do:

  1. Open iChat by clicking its icon in the Dock.
  2. Choose Apple menu > System Preferences and then click the Security icon to open Security preferences.
  3. In the lower-left corner of the security pane, click the lock icon and then authenticate yourself as an administrative user to unlock Sharing preferences.
  4. Click the Firewall tab, and then click Start to turn on the Max OS X firewall using its default rules.

    When the firewall is enabled, the Start button changes to a Stop button and the advanced button is enabled.

    The default firewall configuration allows incoming traffic for established connections (such as a website responding to a click in Safari) and communications from any signed software or enabled services. This default configuration provides a level of security that is adequate for most users.

  5. To customize the firewall, click Advanced for additional configuration options.

    You can see which services are currently enabled from the Sharing preferences. Sharing service ports are enabled by default when a service such as Web Sharing is enabled.

    If you want to exercise more control over the configuration, you can manually set which applications and services the firewall allows by selecting or deselecting the checkbox that automatically allows signed software.

    With this firewall choice enabled, when a network-aware application such as iChat opens or requests a network connection, a dialog, such as the one shown in the following figure, asks if you want to allow the application access to the network. This dialog will appear as a warning anytime a network-aware application requests incoming access for the first time.

  6. Click Allow to create a firewall rule that allows access for the application.

    When manually setting firewall access by application or service in the Advanced tab, you can return to the Advanced tab to review and modify or specifically deny connections.

    Another option provided by the firewall, Stealth Mode, prevents network probing tools that use common discovery tools based on the ICMP protocol (such as ping) from discovering the Mac is even on the network.

  7. Select the checkbox to enable Stealth Mode.
  8. From Applications > Utilities in Finder, open the Terminal and execute the following command to attempt to ping your system:
    ping localhost

    You will see the following timeout message illustrating that your system is not responding to the ping request.

    Request timeout for icmp_seq

    When utilizing your Mac on an unfamiliar network such as at an Internet café or a trade show, you can select “Block all incoming connections” to prevent any access except that required for basic network services, Internet browsing, and email. Selecting this option also will disable access to all shared services hosted on your Mac, but on an unfamiliar network this is highly desirable.

    Unlike in Mac OS X Server, in Mac OS X the command-line ipfw program is the only interface available to configure port-based rules for a firewall manually.

  • + Share This
  • 🔖 Save To Your Account