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 don't know of
Additionally, if unveil works like pledge and can be further restricted after e.g. reading files into memory, unveils can then be undone. Anyone know if the following would work to first allow access to /tmp and then revoke that access? unveil("/tmp", "rw");
/* do some work */
unveil("/tmp", "");For example:
/* Only the system calls required
* for the standard I/O library and
* for accessing /dev/tty are allowed
* by the kernel from this point on.
*/
pledge("stdio tty", NULL);
The second argument is the execpromises, i.e., the pledges enforced for child processes. This does not need to be specified if you pledge in a way that does not include any way of spawning a new process.What's new in the slides linked is unveil(2). This seems to be used to limit the exact paths a process can access and with what access flags (rwxc).
[1] http://packetfactory.openwall.net/projects/stephanie/index.h...
pledge() can also be found in over 85% of OpenBSD's base system.
http://www.bsdcan.org/2018/schedule/events/968.en.html
Video should eventually show up on YouTube.
[0] https://twitter.com/bob_beck/status/1005162340956794880 ;-)
https://www.openbsd.org/papers/florian_slaacd_bsdcan2018.pdf