Mac OS X - Really Just FreeBSD ?

I am sitting at BlackHat. Yes, I turned my laptop on, but the network interfaces are turned off! I was going to configure my firewall to lock everything down and then go online. First shock: ipfw is the firewall OS X uses.

There is some history with me and ipfw.

I am a big fan of OpenBSD and when Daniel wrote the pf firewall to replace ipfw , I was delighted. I started using pf and even fiddled around with the source code.

I am no expert on all the features anymore, but I got a pretty good handle on that beast at some point. Now I have to learn ipfw… Okay.

Let’s do that and face the challenge.

First things first. Where’s the configuration file for it? Hmm… There is a guy. Let me play with that. I am shocked. By default, UDP traffic is allowed in and out, even if you turn off all your services in the main tab.

Only if you use the advanced tab, can you turn UDP off.

Logging is not turned on either (what a surprise). Alright, I am turned that on too.

How do the rules look now? OMG! Ridiculous. It allows port 5353, 137, 427, and 631 inbound! Why? Turn that off! Lesson learned: Don’t use the default config. Again, show me the configuration file. But where is it?

I still haven’t found it. I am just going to write a script which uses the ipfw add command to add ipfw rules one by one.

That’s really the same thing I am doing with iptables on my Linux boxen. But before doing so, I wanted to see how ipfw log entires look. To test that, I added the following rule:

deny log ip from any to any

I just wanted to see how a log entry looks when I telnet to some port on my box. Well. Surprise surprise. Right after adding that rule not much worked anymore.

sudo is not functioning anymore. Some digging around and I realized that the /etc/passwd file is not used for authentication!

It’s some service that uses the loopback interface. Not really sure what to do without sudo and a bit frustrated, I closed the laptop to resume later. Well, later, the laptop did not wake up anymore.

Authentication gone! It just hung. A reboot was necessary. Darn. At this point I am really frustrated!