darwin-containers/rund

Allow running without disabling SIP - suggestion included

griels opened this issue · 7 comments

griels commented

https://poweruser.blog/using-dtrace-with-sip-enabled-3826a352e64b - not sure if this mechanism could be used?

Failing that, I gather there is some other sandboxing mechanism (relying on the Sandboxing frameworks, akin to using the officially-deprecated sandbox-exec) that might be usable, but obviously this work is heavily chroot based.

You mean, removing signatures from all binaries inside chroot? I'll try that.

WRT sandbox - it can be used as an additional isolation of chrooted processes from the host.

I'm not reproducing what that guy shows (though I'm on Ventura). If I try to execute binaries after codesign --remove-signature (both within and outside of chroot), I just get killed, without any traces in dmesg, even with SIP disabled.

griels commented

Oh well, thanks for trying.. Hopefully there's a SIP-free way ahead eventually.

Also, see darwin-containers/darwin-jail#2. I had chroot properly working on Catalina with SIP enabled: darwin-containers/darwin-jail@4d34280 But newer macOS versions have stricter rules.

Another idea. Do we actually need to disable the whole SIP? There are options to disable specific parts of it:

csrutil enable --no-internal
csrutil enable --without kext
csrutil enable --without fs
csrutil enable --without debug
csrutil enable --without dtrace
csrutil enable --without nvram

I'm not sure yet which one of them is responsible for chroot.

I'm not reproducing what that guy shows (though I'm on Ventura). If I try to execute binaries after codesign --remove-signature (both within and outside of chroot), I just get killed, without any traces in dmesg, even with SIP disabled.

I think the instant killing in the chroot from this comment might be due to Launch Constraints. I'm not sure exactly how one would remove those, but it would likely involve removing the codesigning from the binary, and possibly changing the file's contents/checksum, in case the binary has it's signature stored detached in the read only volume. Basically the goal is breaking the lookup of the constraints.