phosphor-ldap-conf: handle "InterfaceAdded" signal on the ldap cert object
When LDAP client certificate is uploaded through install method on the
cert object, Object would emit the signal "InterfaceAdded".
Upon receiving the signal, Config file would be updated with
below given info if secure ldap is enabled:
tls_cert <path client certificate file>
tls_key <path to client certificate file>
Tested By: Unit Tested
Signed-off-by: Ratan Gupta <ratagupt@linux.vnet.ibm.com>
Change-Id: I54b3e116af1b8a9057d91797d4074d39efc65bb0
diff --git a/phosphor-ldap-config/ldap_config.hpp b/phosphor-ldap-config/ldap_config.hpp
index cbd2e04..d2cc8de 100644
--- a/phosphor-ldap-config/ldap_config.hpp
+++ b/phosphor-ldap-config/ldap_config.hpp
@@ -36,6 +36,8 @@
sdbusplus::server::object::object<ConfigIface, EnableIface, MapperIface>;
using ObjectPath = sdbusplus::message::object_path;
+namespace sdbusRule = sdbusplus::bus::match::rules;
+
class ConfigMgr;
class MockConfigMgr;
@@ -59,6 +61,7 @@
* @param[in] path - The D-Bus object path to attach at.
* @param[in] filePath - LDAP configuration file.
* @param[in] caCertFile - LDAP's CA certificate file.
+ * @param[in] certFile - LDAP's client certificate file.
* @param[in] secureLDAP - Specifies whether to use SSL or not.
* @param[in] lDAPServerURI - LDAP URI of the server.
* @param[in] lDAPBindDN - distinguished name with which to bind.
@@ -78,9 +81,9 @@
*/
Config(sdbusplus::bus::bus& bus, const char* path, const char* filePath,
- const char* caCertFile, bool secureLDAP, std::string lDAPServerURI,
- std::string lDAPBindDN, std::string lDAPBaseDN,
- std::string&& lDAPBindDNPassword,
+ const char* caCertFile, const char* certFile, bool secureLDAP,
+ std::string lDAPServerURI, std::string lDAPBindDN,
+ std::string lDAPBaseDN, std::string&& lDAPBindDNPassword,
ConfigIface::SearchScope lDAPSearchScope, ConfigIface::Type lDAPType,
bool lDAPServiceEnabled, std::string groupNameAttribute,
std::string userNameAttribute, ConfigMgr& parent);
@@ -246,6 +249,7 @@
bool secureLDAP;
std::string lDAPBindPassword{};
std::string tlsCacertFile{};
+ std::string tlsCertFile{};
std::string configFilePath{};
std::string objectPath{};
std::filesystem::path configPersistPath{};
@@ -270,6 +274,12 @@
std::set<std::string> privMgr = {"priv-admin", "priv-operator", "priv-user",
"priv-callback"};
+ /** @brief React to InterfaceAdded signal
+ * @param[in] msg - sdbusplus message
+ */
+ void certificateInstalled(sdbusplus::message::message& msg);
+ sdbusplus::bus::match_t certificateInstalledSignal;
+
friend class MockConfigMgr;
};