Classes | |
| class | ProcessAbortException |
| Secure::ProcessAbortException should be caught only at the top level of the program. More... | |
Namespaces | |
| namespace | Impl |
Enumerations | |
| enum | EChildGroupAction { E_NO_EXTENDED_GROUPS = 0, E_SOURCE_EXTENDED_GROUPS } |
Functions | |
| void | dropPrivilegesPermanently (::uid_t newuid,::gid_t newgid, EChildGroupAction extendedGroupAction) |
| void | addPlatformSpecificEnvVars (StringArray &absEnvironment) |
| StringArray | minimalEnvironment () |
| void | runAs (char const *username, EChildGroupAction extendedGroupAction=E_SOURCE_EXTENDED_GROUPS) |
| Look up user ID and group ID for username in password file, chdir to "/", then drop privileges and run with that user ID and group ID. | |
| void | dropPrivilegesPermanently (uid_t newuid, gid_t newgid, EChildGroupAction extendedGroupAction) |
| Changes both the effective and actual user ID to newuid, and the effective and actual group IDs to newgid, clearing out all of root's auxiliary groups. | |
| void | rand_init () |
| Initializes and seeds the cryptographic PRNG, if this has not been done already. | |
| unsigned char * | rand (unsigned char *buf, std::size_t n) |
| Generates n cryptographically secure pseudo-random bytes and stores them in buf. | |
| ::pid_t | fork_reseed () |
| Forks and reseeds the PRNG so that a compromise of the child cannot compromise the parent's PRNG state, and a compromise of the parent cannot compromise the child's PRNG state. | |
| void | rand_save_state () |
| template<typename UnsignedInt> | |
| UnsignedInt | rand_uint () |
| template<typename UnsignedInt> | |
| UnsignedInt | rand_uint_lt (UnsignedInt n) |
| template<typename Integer> | |
| Integer | rand_range (Integer min_val, Integer max_val) |
| template<typename Real> | |
| Real | rand_unit_interval () |
Variables | |
| LazyGlobal< StringArray, int, MinimalEnvironmentConstructor > | g_minimalEnvironment = { 0 , 0, {0, PTHREAD_MUTEX_INITIALIZER} } |
| void BLOCXX_NAMESPACE::Secure::@197::addPlatformSpecificEnvVars | ( | StringArray & | absEnvironment | ) | [static] |
| void BLOCXX_NAMESPACE::Secure::dropPrivilegesPermanently | ( | uid_t | newuid, | |
| gid_t | newgid, | |||
| EChildGroupAction | extendedGroupAction | |||
| ) |
Changes both the effective and actual user ID to newuid, and the effective and actual group IDs to newgid, clearing out all of root's auxiliary groups.
If newuid == -1, defaults to the actual user ID. If newgid == -1, defaults to the actual group ID.
The second parameter controls whether or not the new user's auxiliary groups are sourced.
Referenced by runAs().
| void BLOCXX_NAMESPACE::Secure::dropPrivilegesPermanently | ( | ::uid_t | newuid, | |
| ::gid_t | newgid, | |||
| EChildGroupAction | extendedGroupAction | |||
| ) |
Definition at line 137 of file Secure.cpp.
References ABORT_ERRNO_IF, ABORT_IF, E_SOURCE_EXTENDED_GROUPS, setresgid(), and setresuid().
| pid_t BLOCXX_NAMESPACE::Secure::fork_reseed | ( | ) |
Forks and reseeds the PRNG so that a compromise of the child cannot compromise the parent's PRNG state, and a compromise of the parent cannot compromise the child's PRNG state.
errno set accordingly).Definition at line 155 of file SecureRand.cpp.
References BLOCXX_INVALID_HANDLE, rand(), RESEED_BYTES, and BLOCXX_NAMESPACE::seed.
| StringArray BLOCXX_NAMESPACE::Secure::minimalEnvironment | ( | ) |
Definition at line 360 of file Secure.cpp.
References g_minimalEnvironment.
| unsigned char * BLOCXX_NAMESPACE::Secure::rand | ( | unsigned char * | buf, | |
| std::size_t | n | |||
| ) |
Generates n cryptographically secure pseudo-random bytes and stores them in buf.
rand_init() has been called.Definition at line 143 of file SecureRand.cpp.
References BLOCXX_THROW, BLOCXX_NAMESPACE::callOnce(), BLOCXX_NAMESPACE::SSLCtxMgr::getOpenSSLErrorDescription(), BLOCXX_NAMESPACE::guard, and rand_init_impl().
Referenced by fork_reseed(), BLOCXX_NAMESPACE::RandomNumber::getNextNumber(), BLOCXX_NAMESPACE::getNodeIdentifier(), and rand_uint().
| void BLOCXX_NAMESPACE::Secure::rand_init | ( | ) |
Initializes and seeds the cryptographic PRNG, if this has not been done already.
Note that this function gets called automatically the first time rand data are generated.
Definition at line 138 of file SecureRand.cpp.
References BLOCXX_NAMESPACE::callOnce(), BLOCXX_NAMESPACE::guard, and rand_init_impl().
Referenced by BLOCXX_NAMESPACE::SSLCtxMgr::initCtx().
| Integer BLOCXX_NAMESPACE::Secure::rand_range | ( | Integer | min_val, | |
| Integer | max_val | |||
| ) | [inline] |
rand_init() has been called. Integer is an integer type (signed or unsigned).
min_val <= max_val.
Definition at line 173 of file SecureRand.hpp.
| void BLOCXX_NAMESPACE::Secure::rand_save_state | ( | ) |
Definition at line 328 of file SecureRand.cpp.
References BLOCXX_NAMESPACE::FileSystem::Path::dirname(), BLOCXX_NAMESPACE::FileSystem::Path::E_SECURE_DIR, MAXPATHLEN, BLOCXX_NAMESPACE::FileSystem::removeFile(), and BLOCXX_NAMESPACE::FileSystem::Path::security().
| UnsignedInt BLOCXX_NAMESPACE::Secure::rand_uint | ( | ) | [inline] |
rand_init() has been called. UnsignedInt is an unsigned integer type.
Definition at line 138 of file SecureRand.hpp.
References rand().
| UnsignedInt BLOCXX_NAMESPACE::Secure::rand_uint_lt | ( | UnsignedInt | n | ) | [inline] |
rand_init() has been called. UnsignedInt is an unsigned integer type.
Definition at line 156 of file SecureRand.hpp.
| Real BLOCXX_NAMESPACE::Secure::rand_unit_interval | ( | ) | [inline] |
rand_init() has been called. Real is one of the floating-point numeric types.
Definition at line 189 of file SecureRand.hpp.
| void BLOCXX_NAMESPACE::Secure::runAs | ( | char const * | username, | |
| EChildGroupAction | extendedGroupAction = E_SOURCE_EXTENDED_GROUPS | |||
| ) |
Look up user ID and group ID for username in password file, chdir to "/", then drop privileges and run with that user ID and group ID.
The extendedGroupAction parameter determines whether or not the child process's extended groups get initialized, or if it only runs with its primary group.
Definition at line 365 of file Secure.cpp.
References ABORT_ERRNO_IF, ABORT_IF, and dropPrivilegesPermanently().
LazyGlobal<StringArray, int, MinimalEnvironmentConstructor> BLOCXX_NAMESPACE::Secure::g_minimalEnvironment = { 0 , 0, {0, PTHREAD_MUTEX_INITIALIZER} } [static] |
1.5.6