Live data from Hacker News

Pledge and Unveil in OpenBSD [pdf]

openbsd.org

21–30 of 36 posts

Re: Pledge and Unveil in OpenBSD [pdf]

#21
post #18

Awesome! Given the Chrome example starting on page 6, here's my guess as to how pledge and unveil will contain Chrome to e.g. protect SSH keys. First, 3 of the 5 Chrome processes are already pledged to disallow filesystem reads. The two remaining ones (RenderProcess and UtilityProcess) can be unveiled to allow directories like * ~/.config/chromium * ~/.cache/chromium * ~/Downloads * /tmp * and anything important I do…

Shouldn't it be veil()?

Re: Pledge and Unveil in OpenBSD [pdf]

#22
post #16

Earlier quoted context omitted.

Not at all, for example you can't implement the ratcheting down semantics of pledge() using seccomp. Say starting with a broader promise set "stdio rpath recvfd", and then dropping to "stdio" after full init. pledge() can also be found in over 85% of OpenBSD's base system.

brings me to the next question: are there linux equivalent ?

There's Capsicum for Linux[1]. Its a port of Capsicum[2] from FreeBSD to Linux. Capsicum was a joint project between the FreeBSD foundation, Cambridge and Google to create a hybrid capabilities framework. But Capsicum allows developers to do the same privilege dropping that pledge does. However Capsicum is more fine grained then pledge so its less easy to use. Also Capsicum for Linux is also out of tree currently.

[1]: http://www.capsicum-linux.org/ [2]: https://www.freebsd.org/cgi/man.cgi?capsicum(4)

Re: Pledge and Unveil in OpenBSD [pdf]

#23
post #7
post #6

Earlier quoted context omitted.

I think you're refering to systrace. It was removed in OpenBSD 6.0. http://www.citi.umich.edu/u/provos/systrace/

Thanks, that's exactly what I meant. Why was it removed? I did notice pledge(2) first appeared in 5.9 [1] How do other Unices such as Linux deal with this issue (IIRC systrace was ported to other Unices)? Is Pledge ported to other BSDs? [1] http://man.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man2/...

> How do other Unices such as Linux deal with this issue (IIRC systrace was ported to other Unices)? Is Pledge ported to other BSDs?

I don't believe pledge is ported to other BSD operating systems, for example FreeBSD uses their own framework, capsicum[1] instead of pledge.

[1]: https://www.freebsd.org/cgi/man.cgi?capsicum(4)

Re: Pledge and Unveil in OpenBSD [pdf]

#24
post #21
post #18

Awesome! Given the Chrome example starting on page 6, here's my guess as to how pledge and unveil will contain Chrome to e.g. protect SSH keys. First, 3 of the 5 Chrome processes are already pledged to disallow filesystem reads. The two remaining ones (RenderProcess and UtilityProcess) can be unveiled to allow directories like * ~/.config/chromium * ~/.cache/chromium * ~/Downloads * /tmp * and anything important I do…

Shouldn't it be veil()?

The idea is that everything is "veiled" and you "unveil" the stuff you need access to.

Re: Pledge and Unveil in OpenBSD [pdf]

#25
post #16
post #8

Earlier quoted context omitted.

pledge is seccomp

Not at all, for example you can't implement the ratcheting down semantics of pledge() using seccomp. Say starting with a broader promise set "stdio rpath recvfd", and then dropping to "stdio" after full init. pledge() can also be found in over 85% of OpenBSD's base system.

On linux you can use firejail if it's necessary (or a container if it's needed).

Re: Pledge and Unveil in OpenBSD [pdf]

#26
post #16

Earlier quoted context omitted.

Not at all, for example you can't implement the ratcheting down semantics of pledge() using seccomp. Say starting with a broader promise set "stdio rpath recvfd", and then dropping to "stdio" after full init. pledge() can also be found in over 85% of OpenBSD's base system.

brings me to the next question: are there linux equivalent ?

The firejail is the closest i know.

Re: Pledge and Unveil in OpenBSD [pdf]

#27
post #25
post #16

Earlier quoted context omitted.

Not at all, for example you can't implement the ratcheting down semantics of pledge() using seccomp. Say starting with a broader promise set "stdio rpath recvfd", and then dropping to "stdio" after full init. pledge() can also be found in over 85% of OpenBSD's base system.

On linux you can use firejail if it's necessary (or a container if it's needed).

This doesn't address what they just said - dropping privileges incrementally. Firejail is just a whole process filter applied at process start.

Re: Pledge and Unveil in OpenBSD [pdf]

#28
post #21

Earlier quoted context omitted.

Shouldn't it be veil()?

The idea is that everything is "veiled" and you "unveil" the stuff you need access to.

Yes, but the weird thing is that before you call unveil, everything is already unveiled, which is not in sync with the dictionary definition of unveiling. I hope a better name is found.

Re: Pledge and Unveil in OpenBSD [pdf]

#29
post #9
post #7

Earlier quoted context omitted.

Thanks, that's exactly what I meant. Why was it removed? I did notice pledge(2) first appeared in 5.9 [1] How do other Unices such as Linux deal with this issue (IIRC systrace was ported to other Unices)? Is Pledge ported to other BSDs? [1] http://man.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man2/...

Systrace was removed because it's unsafe for multi-threaded programs because of TOCTOU.

TOCTOU = time-of-check time-of-use

Re: Pledge and Unveil in OpenBSD [pdf]

#30
post #21
post #18

Awesome! Given the Chrome example starting on page 6, here's my guess as to how pledge and unveil will contain Chrome to e.g. protect SSH keys. First, 3 of the 5 Chrome processes are already pledged to disallow filesystem reads. The two remaining ones (RenderProcess and UtilityProcess) can be unveiled to allow directories like * ~/.config/chromium * ~/.cache/chromium * ~/Downloads * /tmp * and anything important I do…

Shouldn't it be veil()?

Honest question, why is this downvoted?
Post reply on HN