Skip to content

Commit 6857750

Browse files
author
Abhi
committed
bug CS-14593, CS-14541: fixed encryption issue
1 parent d6e185a commit 6857750

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

server/src/com/cloud/configuration/ConfigurationManagerImpl.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,44 +1262,44 @@ public boolean updateLDAP(LDAPConfigCmd cmd) {
12621262
if (cvo == null) {
12631263
cvo = new ConfigurationVO("Hidden", "DEFAULT", "management-server", LDAPParams.hostname.toString(), null, "Hostname or ip address of the ldap server eg: my.ldap.com");
12641264
}
1265-
cvo.setValue(hostname);
1265+
cvo.setValue(DBEncryptionUtil.encrypt(hostname));
12661266
_configDao.persist(cvo);
12671267

12681268
cvo = _configDao.findByName(LDAPParams.port.toString());
12691269
if (cvo == null) {
12701270
cvo = new ConfigurationVO("Hidden", "DEFAULT", "management-server", LDAPParams.port.toString(), null, "Specify the LDAP port if required, default is 389");
12711271
}
1272-
cvo.setValue(port.toString());
1272+
cvo.setValue(DBEncryptionUtil.encrypt(port.toString()));
12731273
_configDao.persist(cvo);
12741274

12751275
cvo = _configDao.findByName(LDAPParams.queryfilter.toString());
12761276
if (cvo == null) {
12771277
cvo = new ConfigurationVO("Hidden", "DEFAULT", "management-server", LDAPParams.queryfilter.toString(), null,
12781278
"You specify a query filter here, which narrows down the users, who can be part of this domain");
12791279
}
1280-
cvo.setValue(queryFilter);
1280+
cvo.setValue(DBEncryptionUtil.encrypt(queryFilter));
12811281
_configDao.persist(cvo);
12821282

12831283
cvo = _configDao.findByName(LDAPParams.searchbase.toString());
12841284
if (cvo == null) {
12851285
cvo = new ConfigurationVO("Hidden", "DEFAULT", "management-server", LDAPParams.searchbase.toString(), null,
12861286
"The search base defines the starting point for the search in the directory tree Example: dc=cloud,dc=com.");
12871287
}
1288-
cvo.setValue(searchBase);
1288+
cvo.setValue(DBEncryptionUtil.encrypt(searchBase));
12891289
_configDao.persist(cvo);
12901290

12911291
cvo = _configDao.findByName(LDAPParams.usessl.toString());
12921292
if (cvo == null) {
12931293
cvo = new ConfigurationVO("Hidden", "DEFAULT", "management-server", LDAPParams.usessl.toString(), null, "Check Use SSL if the external LDAP server is configured for LDAP over SSL.");
12941294
}
1295-
cvo.setValue(useSSL.toString());
1295+
cvo.setValue(DBEncryptionUtil.encrypt(useSSL.toString()));
12961296
_configDao.persist(cvo);
12971297

12981298
cvo = _configDao.findByName(LDAPParams.dn.toString());
12991299
if (cvo == null) {
13001300
cvo = new ConfigurationVO("Hidden", "DEFAULT", "management-server", LDAPParams.dn.toString(), null, "Specify the distinguished name of a user with the search permission on the directory");
13011301
}
1302-
cvo.setValue(bindDN);
1302+
cvo.setValue(DBEncryptionUtil.encrypt(bindDN));
13031303
_configDao.persist(cvo);
13041304

13051305
cvo = _configDao.findByName(LDAPParams.passwd.toString());
@@ -1313,7 +1313,7 @@ public boolean updateLDAP(LDAPConfigCmd cmd) {
13131313
if (cvo == null) {
13141314
cvo = new ConfigurationVO("Hidden", "DEFAULT", "management-server", LDAPParams.truststore.toString(), null, "Enter the path to trusted keystore");
13151315
}
1316-
cvo.setValue(trustStore);
1316+
cvo.setValue(DBEncryptionUtil.encrypt(trustStore));
13171317
_configDao.persist(cvo);
13181318

13191319
cvo = _configDao.findByName(LDAPParams.truststorepass.toString());

server/src/com/cloud/server/auth/LDAPUserAuthenticator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ public boolean authenticate(String username, String password, Long domainId, Map
6767
String searchBase = _configDao.getValue(LDAPParams.searchbase.toString());
6868
String useSSL = _configDao.getValue(LDAPParams.usessl.toString());
6969
String bindDN = _configDao.getValue(LDAPParams.dn.toString());
70-
String bindPasswd = DBEncryptionUtil.decrypt(_configDao.getValue(LDAPParams.passwd.toString()));
70+
String bindPasswd = _configDao.getValue(LDAPParams.passwd.toString());
7171
String trustStore = _configDao.getValue(LDAPParams.truststore.toString());
72-
String trustStorePassword = DBEncryptionUtil.decrypt(_configDao.getValue(LDAPParams.truststorepass.toString()));
72+
String trustStorePassword = _configDao.getValue(LDAPParams.truststorepass.toString());
7373

7474
try {
7575
// get all params

0 commit comments

Comments
 (0)