Hi all, could I get some help please, I am new to this and I cannot identify a solution to my problem. reddit / BSD ---------------------------------------------------------------------- CrustyDong · 2015-02-25 01:25 I have come to the point where I am trying to learn how to develop software to solve an issue that largely seeming to be impossible to fix. I can only read so many books (newbie), but without any experience on programming, I am asking for any help or ideas. I have a BSD Subsystem and a Darwin kernel on Apple's iPhone. Due to a lack of flexibility on iOS, nearly all Unix-related packages don't have any network control in user-space (mobile user) and must run as root because of iOS limitations. So for the past few months I have slowly began to understand aspects of various areas (networking, kennel's, BSD, Darwin, iOS...) and the more I learn, the more daunting it becomes on how complex and vast all these variables combined have on one another. I just want to make a simple GUI with a on/off switch for any file that uses a connection, I just don't know where to start. Oh for any one interested about the platform, check out www.saurik.com/id/1 for how the developer made such an awesome project. Thank you in advance! **EDIT** I will clear up this post shortly as the issue is unclear, I have specified them in in the comments. For now if you goto http://apt.saurik.com/debs/ you will see the all the available packages for my platform. ---------------------------------------------------------------------- notpeter · 2015-02-25 03:46 You haven't described your problem, nor what you hope to accomplish with enough depth that anyone could have any idea what you're talking about. Remove the first two paragraphs and try again. As is your post is equivalent to "I've read lots of Einstein and Newton, but I don't understand enough physics to create a switch that controls the energy. Look! a diagram of thorium reactor." ---------------------------------------------------------------------- earlof711 · 2015-02-25 04:18 A little too poetic isn't it. Sounds like what he wants to do may be interesting though. ---------------------------------------------------------------------- ScallopedYam · 2015-02-25 06:56 it sounds like he wants to create some sort of [Little Snitch](http://www.obdev.at/products/littlesnitch/index.html) type application where you could let applications have internet access or not, but he's aiming for the underlying BSD user land type applications? ---------------------------------------------------------------------- notpeter · 2015-02-25 07:37 > "a simple GUI with a on/off switch for any file that uses a connection" Alright, I'm going to try and not be a snarky asshole like earlier and take the one nugget of content and run with it. Let's assume CustyDong wants to offer a granular way to restrict connectivity for individual applications. So something like DroidWall (Andoid), but since iOS devices don't have the Linux kernel & iptables and are BSD based, it'd probably have to ipfw or pf based. Unlike iptables which has [all sorts of wonky modules](http://www.tummy.com/blogs/2005/07/17/some-iptables-modules- you-probably-dont-know-about/) I don't think pf or ipfw can't easily support the same sort of granular per-user/group process control. Conceivably you could do default deny (with logging) which you could then use a GUI to create rules to whitelist individual hosts as allowed traffic, but it wouldn't be per-application and would be pretty invasive. So CrustyDong, if you have a jailbroken device, before you prototype a UI, perhaps look into pf (PacketFilter) which at least at one time was available in the iOS kernel. Start with something super simple, see if you can via the commandline get it to deny traffic to a single IP and go from there. Maybe even try first in a FeeeBSD VM under VirtualBox or on an old PC. Sadly, after looking at the link a second time, I realize it's Jay Freeman (saurik) announcing Cydia...in Feb 2008, seven years ago. Six months before the iPhone had apps or an app store when saurik was a little more optimistic about what the future might hold. Don't let that page misdirect you as what's possible on today's hardware. Next time try and make the title describe WHAT you need help with and offer sufficient detail in the body so someone with knowledge to help might have enough to go on. Happy hunting. ---------------------------------------------------------------------- CrustyDong · 2015-02-25 10:08 Using your analogy, I am in a position of not knowing 'who's work' to actually study, as I learn about one area, another is described and I follow the rabbit hole. I spouse my tittle is somewhat genetic, but owing to the issue at hand, cannot specify the exact area and why a generalised idea of the problem is posted. In sum, processes must run root, user-land has no control (network) mechanism over these processes. I wish to make a GUI with a on/off switch per file, denying connectivity and I cannot start without where too look. ---------------------------------------------------------------------- CrustyDong · 2015-02-25 10:23 Quite so, but without such complexity, rather a kill switch per file basses. I looked at the program a few months ago, only to find it is not open sourced, which led me to the OS X firewall which is open sourced. So, I stated reading about networking (among others) and the layers in involved. The issue is without the OS soundly establishing network support for such layers (undocumented for iOS) I have a notion that I require to build something form the ground up, but at what cost, I do not want to reinvent the wheel. http://opensource.apple.com/source/FirewallTool/FirewallTool- 16/FirewallTool.c ---------------------------------------------------------------------- CrustyDong · 2015-02-25 11:00 > "way to restrict connectivity for individual *applications*." The key here is subsystems and files, for example I have the whole APT backend without a (network) relationship to user land. Likewise, there are files in the subsystem called 'Tweaks', which offer various enhancements at runtime, like RSS feeds for example. > "I don't think pf or ipfw can't easily support the same sort of granular per-user/group process control." I researched iptables a while ago and came to the same conclusion. I have ipfw/pf availability among others, in relation to processes control, I did read the Kennel's error codes, some include a 'no network available' signal but relates to sockets rather than PIDs, but is this an really an effective method? Even so, how can one list, or establish an array of files, such as APT and lower directories which don't even appear. I did make a program which lists all runtime processes and I do have a switch based system, but I am missing the 'key' for the network switch. I abandoned the project because it only lists runtime processes and misses files like APT. I will have to cut it there, the girlfriend is starting to nag, thank you for the pointers! I will check back later on! ---------------------------------------------------------------------- CrustyDong · 2015-02-25 11:05 I specified the issue a bit clearer on the comments. I am just amused with what over 30+ million jailbroken iPhones, not one person has to identified a solution ... ---------------------------------------------------------------------- kramk · 2015-02-26 00:15 The only way I know to restrict network access per-application, or to allow processes to run as root with restricted privileges, is in a [ja il](https://www.freebsd.org/doc/en_US.ISO8859- 1/books/handbook/jails.html). I don't understand your situation well enough to have any idea if this is a useful answer. ---------------------------------------------------------------------- happycuddler · 2015-02-26 01:56 It seems you want to utilize MAC subsystem. You put appropriate labels on binaries. Then you have a MAC module which can decide whether access to given syscall (e.g. connect, socket, write on a socket etc.) should be allowed. I am unaware of any readily available module doing this, but kernel bits to allow writing such module are there hidden under 'mac framework' name. ---------------------------------------------------------------------- smileybone · 2015-03-05 03:30 I like this idea. Sure it might be overkill, but IT WORKS, with minimal hassle. ---------------------------------------------------------------------- kramk · 2015-03-05 03:34 > IT WORKS, with minimal hassle. Exactly why I am a huge fan of jails vs process isolation solutions on Linux with libvirt and friends. The documentation is even complete *and* up to date! ---------------------------------------------------------------------- smileybone · 2015-03-05 03:37 >The documentation is even complete and up to date! Woah now, we dont need any of that nonsense around here.