![]() |
Kea 3.1.0
|
UNIX command config aka UNIX control socket info class. More...
#include <unix_command_config.h>
Public Member Functions | |
UnixCommandConfig (isc::data::ConstElementPtr config) | |
Constructor. | |
~UnixCommandConfig ()=default | |
Virtual destructor. | |
std::string | getLockName () |
Returns the lock file name. | |
std::string | getSocketName () const |
Returns socket name. | |
std::string | getSocketType () const |
Returns socket type. | |
void | setSocketName (const std::string &socket_name) |
Sets socket name. | |
void | setSocketType (const std::string &socket_type) |
Sets socket type. | |
virtual isc::data::ElementPtr | toElement () const |
Unparse a configuration object. | |
![]() | |
void | contextToElement (data::ElementPtr map) const |
Merge unparse a user_context object. | |
data::ConstElementPtr | getContext () const |
Returns const pointer to the user context. | |
void | setContext (const data::ConstElementPtr &ctx) |
Sets user context. | |
![]() | |
virtual | ~CfgToElement () |
Destructor. | |
Static Public Member Functions | |
static std::string | getSocketPath (bool reset=false, const std::string explicit_path="") |
Fetches the supported control socket path. | |
static mode_t | getSocketPathPerms () |
Fetches the required socket path permissions mask. | |
static void | setSocketPathPerms (mode_t perms=DEFAULT_SOCKET_PATH_PERMS) |
Sets the required socket path permissions mask. | |
static std::string | validatePath (const std::string socket_path) |
Validates a path against the supported path for unix control sockets. | |
![]() | |
static data::ElementPtr | toElement (data::ConstElementPtr map) |
Copy an Element map. | |
Static Public Attributes | |
static const mode_t | DEFAULT_SOCKET_PATH_PERMS = (S_IRWXU | S_IRGRP | S_IXGRP) |
Defines the default permissions for unix socket parent directory. | |
static mode_t | socket_path_perms_ = UnixCommandConfig::DEFAULT_SOCKET_PATH_PERMS |
Stores the default permissions for unix socket parent directory. | |
Additional Inherited Members | |
![]() | |
data::ConstElementPtr | user_context_ |
Pointer to the user context (may be NULL) | |
UNIX command config aka UNIX control socket info class.
Definition at line 22 of file unix_command_config.h.
isc::config::UnixCommandConfig::UnixCommandConfig | ( | isc::data::ConstElementPtr | config | ) |
Constructor.
config | Pointer to the configuration to parse. |
Definition at line 37 of file unix_command_config.cc.
References if(), isc_throw, Element::map, isc::data::UserContext::setContext(), and Element::string.
|
default |
Virtual destructor.
References DEFAULT_SOCKET_PATH_PERMS.
|
inline |
Returns the lock file name.
Definition at line 102 of file unix_command_config.h.
|
inline |
|
static |
Fetches the supported control socket path.
The first call to this function with no arguments will set the default path to either the value of CONTROL_SOCKET_DIR or the environment variable KEA_CONTROL_SOCKET_DIR if it is defined. Subsequent calls with no arguments will simply return this value.
reset | recalculate when true, defaults to false. |
explicit_path | set the default socket path to this value. This is for testing purposes only. |
Definition at line 101 of file unix_command_config.cc.
Referenced by validatePath().
|
static |
Fetches the required socket path permissions mask.
Definition at line 149 of file unix_command_config.cc.
References socket_path_perms_.
|
inline |
Returns socket type.
Definition at line 76 of file unix_command_config.h.
|
inline |
Sets socket name.
socket_name | The new socket name. |
Definition at line 97 of file unix_command_config.h.
|
static |
Sets the required socket path permissions mask.
This is for testing purposes only.
perms | permissions mask to use |
Definition at line 154 of file unix_command_config.cc.
References socket_path_perms_.
|
inline |
Sets socket type.
socket_type | The new socket type (should be "unix"). |
Definition at line 83 of file unix_command_config.h.
|
virtual |
Unparse a configuration object.
Implements isc::data::CfgToElement.
Definition at line 89 of file unix_command_config.cc.
References isc::data::UserContext::contextToElement(), Element::create(), and Element::createMap().
|
static |
Validates a path against the supported path for unix control sockets.
socket_path | path to validate. |
Definition at line 115 of file unix_command_config.cc.
References isc::config::command_logger, isc::config::COMMAND_UNIX_SOCKET_PATH_SECURITY_WARNING, isc::config::COMMAND_UNIX_SOCKET_PERMISSIONS_SECURITY_WARNING, getSocketPath(), isc::util::file::hasPermissions(), isc_throw, LOG_WARN, isc::util::file::PathChecker::shouldEnforceSecurity(), socket_path_perms_, and isc::Exception::what().
Referenced by isc::agent::AgentSimpleParser::parse().
|
static |
Defines the default permissions for unix socket parent directory.
Definition at line 26 of file unix_command_config.h.
Referenced by ~UnixCommandConfig().
|
static |
Stores the default permissions for unix socket parent directory.
Definition at line 29 of file unix_command_config.h.
Referenced by getSocketPathPerms(), setSocketPathPerms(), and validatePath().