Sandbox with NSTask

I have the sandbox enabled and use / sbin / ping with NSTask:

[task setLaunchPath:@"/sbin/ping"]; [task setArguments:[NSArray arrayWithObjects:@"-c10", iPAddress, nil]]; 

Everything works fine, and I get the expected result.

I also want to use / usr / sbin / traceroute with NSTask:

 [task setLaunchPath:@"/usr/sbin/traceroute"]; [task setArguments:[NSArray arrayWithObject:iPAddress]]; 

But the task ends with the message: NSTask: Failed to create task for path '/ usr / sbin / traceroute': 22, "Invalid argument". Termination of the temporary process. * At the same time, sandbox logs: deny forbidden-exec-sugid

Why does it work with ping, but not with traceroute? And how do I get it to work with traceroute?

thanks!

+4
source share
1 answer

Q1: ping vs. traceroute - the former is an unprivileged program, the latter is privileged and runs as root. Your error indicates that it is running, since root is not allowed in the sandbox, not surprisingly.

Q2: write a bug report with Apple that details why you need traceroute features and ask for a sandbox. Given that you are actually using the sandbox, you are probably a registered Apple developer, so pick it up on the developer forums as well (indicate your error number).

+4
source

Source: https://habr.com/ru/post/1396282/


All Articles