Welcome to WebProNews Breaking eBusiness and Search News
Advertise | Newsletter | Sitemap | News Feeds News Feed 
 WebProNews Search Part of the iEntry network iEntry inc. 

Mac Sandbox Wrapper

A.P. Lawrence
Expert Author
Published: 2008-01-16

WebProNews RSS Feed


Mac OS X Leopard includes a new command line tool called "sandbox-exec". What it does is provide a "sandbox" - a restricted environment.

You can use this to provide more safety when testing unknown software (such as that whiz-bang thingy you just downloaded) or to provide additional security for our ordinary applications and daemons..

Let's try something very simple. First we need to create a sandbox profile. There are pre-made profiles in /usr/share/sandbox, but we'll make our own here. I'll call it "my.sb":

(version 1)
(allow default)
(deny network*)


Not much to it, is there? Yes, just three lines: I didn't leave anything out. Let's take it for a spin.

new-host-2:~ apl$ sandbox-exec -f ./my.sb /bin/bash
bash-3.2$ # we're in the sanbox running bash
bash-3.2$ date
Sat Dec 29 19:22:05 EST 2007
bash-3.2$ echo "I'm in a sandbox"
I'm in a sandbox
bash-3.2$ ping aplawrence.com
bash: /sbin/ping: Operation not permitted
bash-3.2$ ssh aplawrence.com
ssh: connect to host aplawrence.com port 22: Operation not permitted
bash-3.2$ exit
new-host-2:~ apl$


The "deny network*" in our profile stopped us from using the network. There are other restrictions we can enforce in our sandbox: we can prohibit file system writes, prohibit writes except to /tmp or other specific places, allow only certain libraries to be read , and much more. The best place to get an idea of what's possible is to look at the /usr/share/sandbox files: strangely, they aren't XML as most of Mac OS X is now, but they are easy enough to understand in spite of being undocumented.

If we had a suspicious binary, we could run it within a sandbox that locked it down from doing anything potentially harmful. We could also run processes that we fear might be subverted - a web server or ssh server, for example. Any sub-process started by a sandboxed process will be just as restricted, so this would let us very specifically allow only what our process needs to do its work. If it were hacked, the resulting process would be prevented from doing anything more. In combination with our normal security measures (permissions, acl's and so on), this could provide a very large degree of security.

A comment in one of the /usr/share/sandbox files might indicate that a different name for this was contemplated:

Use "debug deny" to log only operations that are denied by seatbelt

Seatbelt? OK, a seatbelt restrains you and keeps you from hurting yourself..

There is, of course, a system call for the same purpose - sandbox_init() - and a man page. There's also a "sandbox" man page that is supposedly an overview of this facilty, but neither of them are very helpful. A little experimentation would probably tease out their secrets.

Comments

*Originally published at APLawrence.com

View All Articles by A.P. Lawrence



Receive Our Daily Email of Breaking eBusiness News


About the Author:
A.P. Lawrence provides SCO Unix and Linux consulting services http://www.pcunix.com

WebProNews RSS Feed

More Expert Articles Articles

Contact WebProNews
Advertisement





TOP NEWS

WebProBlog
The official blog of WebProNews.

Go to WebProBlog

Targeted Information for Business
WebProNews is part of the iEntry network

Internet Business: Marketing: Small Business:
WebProNews MarketingNewz SmallBusinessNewz
WebProWorld AdvertisingDay PromoteNews
EcommNewz SalesNewz EntrepreneurNewz

Software: Search Engines: Web Design:
WebMasterFree Jayde B2B DesignNewz
NetworkingFiles SearchZA FlashNewz
SecurityConfig SearchNewz WebSiteNotes

Developer: IT Management: Security:
DevWebPro ITManagement SecurityProNews
DevNewz SysAdminNews SecurityConfig
TheDevWeb NetworkingFiles NetworkNewz

The iEntry Network consists of over 100 web publications reaching millions of Internet Professionals. Contact us to advertise.
eBUSINESS RESOURCES






 Advertise | Contact Us | Corporate | Newsletter | Sitemap | Submit an Article | News Feeds
 WebProNews is an iEntry, Inc. ® publication - $line) { echo $line ; } ?> All Rights Reserved
WebProWorld
Ten most recent posts.


SearchBrains.com
NetworkingFiles
Featured Software


About WebProNews
WebProNews is the number one source for eBusiness News. Over 5 million eBusiness professionals read WebProNews and other iEntry business and tech publications.

WebProNews provides real-time coverage of internet business.

Free Email Newsletters:
WebProNews SearchNewz
WebProWorld DevWebPro
Marketing SecurityNews
Plus over 100 other newsletters!

Send me relevant info on products and services.


iEntry.com WebProWorld RSS Feed WebProWorld Contact WebProNews Print Version Email a friend Bookmark us SearchBrains.com SearchBrains RSS Feed