2

I'm trying to make a simple web server on my machine accessible to a peer on the same network, but with not much success. I am having an issue where my firewall continually turns back on, or won't turn off (I can't be sure which).

I go into System Preferences -> Security & Privacy -> Firewall, unlock settings, and click 'Turn off Firewall'. It appears to work. I click the lock in the bottom left to save my settings, and then exit System Preferences. But a port scan shows none of my ports are accessible to inbound connections, still. Then I go back into firewall settings, and it shows my firewall as being on again, even though I just turned it off.


What I have tried so far:

  • I have searched for others having this problem, but I cannot find anything.
  • I also restarted my machine, but the issue persists.
  • Per some google results, I executed sudo defaults write /Library/Preferences/com.apple.alf globalstate -int 0 in terminal, but defaults read /Library/Preferences/com.apple.alf globalstate still returns 1 (on).

How can I turn my firewall off?

EDIT: I think this may be related to the fact that these firewall settings were set on my previous Macbook Pro, and I have since upgraded to a newer macbook using Time Machine.

  • What happens when you start up the web server? You should be prompted one time to allow connections. Does that work for one invocation? If not, you might need to rule out configuration profiles/MDM unless you're sure you are managing the mac entirely yourself. Writing the defaults is no longer sufficient, but all my machines respect the GUI change when you toggle off the firewall. – bmike Jan 13 '16 at 23:04
  • @bmike It's a meteor application, and I've run meteor many times before. I don't remember if it ever prompted me to accept incoming connections, like most processes do, or what I said. I do have one node application listed as blocking incoming connections in the "Firewall options..." dialog. Strangely, though, changing the setting to 'Allow incoming connections' doesn't save, just like changing the firewall on/off state doesn't save. I bet this has something to do with the fact that I set those settings on my previous mac, and have since upgraded using time machine. – morsecoder Jan 13 '16 at 23:52
2

I'm going to put a short answer on how I'd troubleshoot this since this isn't the intended behavior.

  1. Make a backup of your Mac - just in case.
  2. Try a simple python web server in terminal.app

    python -m SimpleHTTPServer

You should see text like: Serving HTTP on 0.0.0.0 port 8000 ... and get a pop up like:

enter image description here

If you don't, perhaps delete the entire firewall preference and restart the Mac once the backup is complete.

sudo -H mv /Library/Preferences/com.apple.alf.plist ~/Desktop

That way you can inspect/move the preference file back if desired. If you still cannot get the firewall pop up after the restart, recheck the firewall system preferences and optionally see if you might have a configuration profile that might be enforcing some firewall settings that you do not control.

enter image description here

If you have no profiles icon, you can probably rule that out.

  • Thanks! I do get the popup running the basic python server (although I had to use python 2.7 executable). What's interesting, though, is that if I click okay and then kill the process and start it again, I get prompted again (I think it's not supposed to work that way, at least, in that it should remember I had already allowed it network access). Maybe it's related to the read/write ability of the plist file since it was created by my user on the previous mac? It's the same 'user' I believe, though, so maybe not. The directory shows -rw-r--r--@ for access permissions on that file. – morsecoder Jan 14 '16 at 0:17
  • I don't have a profiles icon. I'm gonna do a time machine backup now and then try the deleting the plist and restarting. – morsecoder Jan 14 '16 at 0:20
  • So I think I solved the issue. What ended up working was to restart in recovery mode, execute csrutil disable in terminal, restart again, and then sudo chflags nouchg /Library/Preferences/com.apple.alf.plist to allow me to edit it. Not sure which step did the trick, but I can now turn my firewall on and off in System preferences (and fortunately didn't have to lose all my firewall settings). Thanks for your help! If you change your answer to include the debugging steps I mentioned that worked, I'll definitely mark it. – morsecoder Jan 14 '16 at 12:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .