Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Unified Diff: sandbox/linux/services/credentials.h

Issue 54643010: Linux: add basic unprivileged namespace support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: (unneeded) rebase Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sandbox/linux/services/credentials.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/linux/services/credentials.h
diff --git a/sandbox/linux/services/credentials.h b/sandbox/linux/services/credentials.h
index 3ea3cfc984ee1606ad4ac03041ee0d5a8f403d8e..80b2ec181197eabc0148781580b6f64eb36e0431 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 for this API to not be called with any
+ // directory file descriptor present. TODO(jln): integrate with
+ // crbug.com/269806 when available.
+ bool DropFileSystemAccess();
private:
DISALLOW_COPY_AND_ASSIGN(Credentials);
« no previous file with comments | « no previous file | sandbox/linux/services/credentials.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698