table of contents
UID_WRAPPER(1) | UID_WRAPPER(1) |
NAME¶
uid_wrapper - A wrapper to fake privilege separation
SYNOPSIS¶
LD_PRELOAD=libuid_wrapper.so UID_WRAPPER=1 UID_WRAPPER_ROOT=1 ./myapplication
DESCRIPTION¶
Some projects like a file server need privilege separation to be able to switch to the connection user and do file operations. uid_wrapper convincingly lies to the application letting it believe it is operating as root and even switching between UIDs and GIDs as needed.
ENVIRONMENT VARIABLES¶
UID_WRAPPER
UID_WRAPPER_ROOT
UID_WRAPPER_DEBUGLEVEL
UID_WRAPPER_MYUID
uid_t uid; setenv("UID_WRAPPER_MYUID", "1", 1); uid = geteuid(); unsetenv("UID_WRAPPER_MYUID");
UID_WRAPPER_DISABLE_DEEPBIND
EXAMPLE¶
$ LD_PRELOAD=libuid_wrapper.so UID_WRAPPER=1 UID_WRAPPER_ROOT=1 id uid=0(root) gid=0(root) 0(root)
WORKAROUNDS¶
If you need to write code that behaves differently depending on whether uid_wrapper is enabled or not, for example in cases where you have to file permissions, you can predefine the uid_wrapper_enabled() function in your project as follows:
bool uid_wrapper_enabled(void) {
return false; }
Since uid_wrapper overloads this function if enabled, you can use it in your code to detect uid_wrapper.
2015-11-03 |