Skip to content

Commit b7b751f

Browse files
author
abhi
committed
bug 14151,14153: configuration variables are now hidden; added ldapRemove command
1 parent df51744 commit b7b751f

3 files changed

Lines changed: 29 additions & 9 deletions

File tree

api/src/com/cloud/configuration/ConfigurationService.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import com.cloud.api.commands.DeleteVlanIpRangeCmd;
3535
import com.cloud.api.commands.DeleteZoneCmd;
3636
import com.cloud.api.commands.LDAPConfigCmd;
37+
import com.cloud.api.commands.LDAPRemoveCmd;
3738
import com.cloud.api.commands.ListNetworkOfferingsCmd;
3839
import com.cloud.api.commands.UpdateCfgCmd;
3940
import com.cloud.api.commands.UpdateDiskOfferingCmd;
@@ -248,4 +249,6 @@ public interface ConfigurationService {
248249
DiskOffering getDiskOffering(long diskOfferingId);
249250

250251
boolean updateLDAP(LDAPConfigCmd cmd) throws NamingException;
252+
253+
boolean removeLDAP(LDAPRemoveCmd cmd);
251254
}

client/tomcatconf/commands.properties.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ migrateSystemVm=com.cloud.api.commands.MigrateSystemVMCmd;1
154154
updateConfiguration=com.cloud.api.commands.UpdateCfgCmd;1
155155
listConfigurations=com.cloud.api.commands.ListCfgsByCmd;1
156156
ldapConfig=com.cloud.api.commands.LDAPConfigCmd;1
157+
ldapRemove=com.cloud.api.commands.LDAPRemoveCmd;1
157158
listCapabilities=com.cloud.api.commands.ListCapabilitiesCmd;15
158159

159160
#### pod commands

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

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
import com.cloud.api.commands.DeleteVlanIpRangeCmd;
5656
import com.cloud.api.commands.DeleteZoneCmd;
5757
import com.cloud.api.commands.LDAPConfigCmd;
58+
import com.cloud.api.commands.LDAPRemoveCmd;
5859
import com.cloud.api.commands.ListNetworkOfferingsCmd;
5960
import com.cloud.api.commands.UpdateCfgCmd;
6061
import com.cloud.api.commands.UpdateDiskOfferingCmd;
@@ -1239,6 +1240,21 @@ public boolean deleteZone(DeleteZoneCmd cmd) {
12391240

12401241
}
12411242

1243+
@Override
1244+
@DB
1245+
public boolean removeLDAP(LDAPRemoveCmd cmd) {
1246+
_configDao.expunge(LDAPParams.hostname.toString());
1247+
_configDao.expunge(LDAPParams.port.toString());
1248+
_configDao.expunge(LDAPParams.queryfilter.toString());
1249+
_configDao.expunge(LDAPParams.searchbase.toString());
1250+
_configDao.expunge(LDAPParams.usessl.toString());
1251+
_configDao.expunge(LDAPParams.dn.toString());
1252+
_configDao.expunge(LDAPParams.passwd.toString());
1253+
_configDao.expunge(LDAPParams.truststore.toString());
1254+
_configDao.expunge(LDAPParams.truststorepass.toString());
1255+
return true;
1256+
}
1257+
12421258
@Override
12431259
@DB
12441260
public boolean updateLDAP(LDAPConfigCmd cmd) {
@@ -1284,65 +1300,65 @@ public boolean updateLDAP(LDAPConfigCmd cmd) {
12841300
// store the result in DB COnfiguration
12851301
ConfigurationVO cvo = _configDao.findByName(LDAPParams.hostname.toString());
12861302
if (cvo == null) {
1287-
cvo = new ConfigurationVO("Advanced", "DEFAULT", "management-server", LDAPParams.hostname.toString(), null, "Hostname or ip address of the ldap server eg: my.ldap.com");
1303+
cvo = new ConfigurationVO("Hidden", "DEFAULT", "management-server", LDAPParams.hostname.toString(), null, "Hostname or ip address of the ldap server eg: my.ldap.com");
12881304
}
12891305
cvo.setValue(hostname);
12901306
_configDao.persist(cvo);
12911307

12921308
cvo = _configDao.findByName(LDAPParams.port.toString());
12931309
if (cvo == null) {
1294-
cvo = new ConfigurationVO("Advanced", "DEFAULT", "management-server", LDAPParams.port.toString(), null, "Specify the LDAP port if required, default is 389");
1310+
cvo = new ConfigurationVO("Hidden", "DEFAULT", "management-server", LDAPParams.port.toString(), null, "Specify the LDAP port if required, default is 389");
12951311
}
12961312
cvo.setValue(port.toString());
12971313
_configDao.persist(cvo);
12981314

12991315
cvo = _configDao.findByName(LDAPParams.queryfilter.toString());
13001316
if (cvo == null) {
1301-
cvo = new ConfigurationVO("Advanced", "DEFAULT", "management-server", LDAPParams.queryfilter.toString(), null,
1317+
cvo = new ConfigurationVO("Hidden", "DEFAULT", "management-server", LDAPParams.queryfilter.toString(), null,
13021318
"You specify a query filter here, which narrows down the users, who can be part of this domain");
13031319
}
13041320
cvo.setValue(queryFilter);
13051321
_configDao.persist(cvo);
13061322

13071323
cvo = _configDao.findByName(LDAPParams.searchbase.toString());
13081324
if (cvo == null) {
1309-
cvo = new ConfigurationVO("Advanced", "DEFAULT", "management-server", LDAPParams.searchbase.toString(), null,
1325+
cvo = new ConfigurationVO("Hidden", "DEFAULT", "management-server", LDAPParams.searchbase.toString(), null,
13101326
"The search base defines the starting point for the search in the directory tree Example: dc=cloud,dc=com.");
13111327
}
13121328
cvo.setValue(searchBase);
13131329
_configDao.persist(cvo);
13141330

13151331
cvo = _configDao.findByName(LDAPParams.usessl.toString());
13161332
if (cvo == null) {
1317-
cvo = new ConfigurationVO("Advanced", "DEFAULT", "management-server", LDAPParams.usessl.toString(), null, "Check Use SSL if the external LDAP server is configured for LDAP over SSL.");
1333+
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.");
13181334
}
13191335
cvo.setValue(useSSL.toString());
13201336
_configDao.persist(cvo);
13211337

13221338
cvo = _configDao.findByName(LDAPParams.dn.toString());
13231339
if (cvo == null) {
1324-
cvo = new ConfigurationVO("Advanced", "DEFAULT", "management-server", LDAPParams.dn.toString(), null, "Specify the distinguished name of a user with the search permission on the directory");
1340+
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");
13251341
}
13261342
cvo.setValue(bindDN);
13271343
_configDao.persist(cvo);
13281344

13291345
cvo = _configDao.findByName(LDAPParams.passwd.toString());
13301346
if (cvo == null) {
1331-
cvo = new ConfigurationVO("Advanced", "DEFAULT", "management-server", LDAPParams.passwd.toString(), null, "Enter the password");
1347+
cvo = new ConfigurationVO("Hidden", "DEFAULT", "management-server", LDAPParams.passwd.toString(), null, "Enter the password");
13321348
}
13331349
cvo.setValue(DBEncryptionUtil.encrypt(bindPasswd));
13341350
_configDao.persist(cvo);
13351351

13361352
cvo = _configDao.findByName(LDAPParams.truststore.toString());
13371353
if (cvo == null) {
1338-
cvo = new ConfigurationVO("Advanced", "DEFAULT", "management-server", LDAPParams.truststore.toString(), null, "Enter the path to trusted keystore");
1354+
cvo = new ConfigurationVO("Hidden", "DEFAULT", "management-server", LDAPParams.truststore.toString(), null, "Enter the path to trusted keystore");
13391355
}
13401356
cvo.setValue(trustStore);
13411357
_configDao.persist(cvo);
13421358

13431359
cvo = _configDao.findByName(LDAPParams.truststorepass.toString());
13441360
if (cvo == null) {
1345-
cvo = new ConfigurationVO("Advanced", "DEFAULT", "management-server", LDAPParams.truststorepass.toString(), null, "Enter the password for trusted keystore");
1361+
cvo = new ConfigurationVO("Hidden", "DEFAULT", "management-server", LDAPParams.truststorepass.toString(), null, "Enter the password for trusted keystore");
13461362
}
13471363
cvo.setValue(DBEncryptionUtil.encrypt(trustStorePassword));
13481364
_configDao.persist(cvo);

0 commit comments

Comments
 (0)