Chromium Code Reviews| Index: sandbox/linux/services/credentials.h |
| diff --git a/sandbox/linux/services/credentials.h b/sandbox/linux/services/credentials.h |
| index 3ea3cfc984ee1606ad4ac03041ee0d5a8f403d8e..6f63a657dfb2c4205e52f25cb2f55192bdb26c90 100644 |
| --- a/sandbox/linux/services/credentials.h |
| +++ b/sandbox/linux/services/credentials.h |
| @@ -28,14 +28,34 @@ class Credentials { |
| // Drop all capabilities in the effective, inheritable and permitted sets for |
| // the current process. |
| - void DropAllCapabilities(); |
| + bool DropAllCapabilities(); |
| // Return true iff there is any capability in any of the capabilities sets |
| // of the current process. |
| - bool HasAnyCapability(); |
| + bool HasAnyCapability() const; |
| // Returns the capabilities of the current process in textual form, as |
| // documented in libcap2's cap_to_text(3). This is mostly useful for |
| // debugging and tests. |
| - scoped_ptr<std::string> GetCurrentCapString(); |
| + scoped_ptr<std::string> GetCurrentCapString() const; |
| + |
| + // Move the current process to a new "user namespace" as supported by Linux |
| + // 3.8+ (CLONE_NEWUSER). |
| + // The uid map will be set-up so that the perceived uid and gid will not |
| + // change. |
| + // If this call succeeds, the current process will be granted a full set of |
| + // capabilities in the new namespace. |
| + bool MoveToNewUserNS(); |
| + |
| + // Remove the ability of the process to access the file system. File |
| + // descriptors which are already open prior to calling this API remain |
| + // available. |
| + // The implementation currently uses chroot(2) and requires CAP_SYS_CHROOT. |
| + // CAP_SYS_CHROOT can be acquired by using the MoveToNewUserNS() API. |
| + // Make sure to call DropAllCapabilities() after this call to prevent |
| + // escapes. |
| + // To be secure, it's very important that this API is not called with any |
|
Jorge Lucangeli Obes
2013/11/05 00:44:51
.. very important for this API not to be called...
jln (very slow on Chromium)
2013/11/05 00:54:42
Done.
|
| + // directory file descriptor present. TODO(jln): integrate with |
|
Jorge Lucangeli Obes
2013/11/05 00:44:51
descriptors.
jln (very slow on Chromium)
2013/11/05 00:54:42
palmer@ says that singular is "more common". Keepi
|
| + // crbug.com/269806 when available. |
| + bool DropFileSystemAccess(); |
| private: |
| DISALLOW_COPY_AND_ASSIGN(Credentials); |