1

I am developing an application for Mac, and wants to add firewall rule when my application launches,

would like to know the entry point, if anyone has any idea,
I guess, i need to modify
/Library/Preferences/com.apple.sharing.firewall.plist
But this file is not present in my Machine and any info about structure of this file ?

Requirement is something like this

When it runs, then browser shouldn't allow to open some particulars website, so i believe, this is going to be a application level firewall.

Amitg2k12
  • 3,765
  • 10
  • 48
  • 97
  • Can you clarify what you're trying to do? Specifically, are you trying to modify the [packet firewall](http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man8/ipfw.8.html) or the [application firewall](http://support.apple.com/kb/ht1810)? Are you trying to allow traffic to your app, or to something else (and if so what)? – Gordon Davisson Nov 23 '11 at 16:30
  • [This question is a dupe of a more recent one you've asked](http://stackoverflow.com/questions/8604816/mac-ipfw-adding-firewall-rule). You really shouldn't post duplicate and repeated questions. – Michael Dautermann Dec 26 '11 at 16:16
  • Did you ever get the problem solved? @Amitg2k12 Since `ipfw` is now deprecated you must be using `pf` now – Minhaz Aug 17 '14 at 08:57
  • 1
    I did this implementation on the 10.6 , and after that i didn't get chance to check it further.... – Amitg2k12 Aug 20 '14 at 05:22
  • can we get the status of fire wall e.g. on/off – Vikas Bansal Aug 03 '15 at 09:22
  • @vikas yes its possible, please throw more detail – Amitg2k12 Aug 05 '15 at 13:24
  • @Amitg2k12 I am trying to make an applicaiton that Identify if the firewall is off or on. If the firewall is off then it switch it on. I am using Cocoa with objective C and I am not able to find the solution how to do so. Thanks for reply amit – Vikas Bansal Aug 05 '15 at 17:15
  • @Amitg2k12 hi i have install the HelperTool, now i want to know how add rule in firewell through Objective c cocoa Osx application? please help me. Thanks – Sawan Cool Nov 17 '15 at 08:22
  • @vikas : I am not sure,about any API to detect the firewall status @ swan , there is no interface to add firewall rule , i was running a shell script from the Cocoa Application – Amitg2k12 Nov 18 '15 at 07:24

1 Answers1

0

Thanks for looking at it, Finally i am using ipfw to do so, but still not yet clear about how to configure the rule

Amitg2k12
  • 3,765
  • 10
  • 48
  • 97
  • For anyone that will stumble upon this question/answer - 10.10+ approach is to use either `pfctl` or `/usr/libexec/ApplicationFirewall/socketfilterfw`. – solgar Jan 17 '17 at 10:41