nanos-unveil
v1.1.0
Published
OpenBSD-style unveil syscall to restrict filesystem view on a Nanos unikernel
Downloads
21
Readme
nanos-unveil
OpenBSD-style unveil syscall to restrict filesystem view on a Nanos unikernel
Usage
Access to the filesystem by a running process can be modified by calling the unveil function exported by this module, with the first argument (path) set to a filesystem path, and the second argument (permissions) set to a string containing zero or more of the following characters:
r: makepathavailable for read operationsw: makepathavailable for write operationsx: unused because a Nanos unikernel cannot execute arbitrary programsc: allowpathto be created and removed
The unveil function returns 0 on success, and a negative error number on failure. Error codes are available as module attributes:
errPerm: the process is attempting to increase permissions, i.e. thepermissionsstring contains characters that were not present in a previous call to theunveilfunction with the givenpatherrNoent: a directory inpathdoes not existerrInval:permissionscontains invalid characters
Example:
unveil = require('nanos-unveil');
unveil.unveil("/", "r");For more information, see the relevant OpenBSD man page.
