mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-8868: change the default vm.password.length to 10
also moved it to ConfigDepot
This commit is contained in:
parent
97a5d6bd20
commit
f53188192f
@ -899,14 +899,6 @@ public enum Config {
|
||||
"0",
|
||||
"Default disk I/O read rate in requests per second allowed in User vm's disk.",
|
||||
null),
|
||||
VmPasswordLength(
|
||||
"Advanced",
|
||||
ManagementServer.class,
|
||||
Integer.class,
|
||||
"vm.password.length",
|
||||
"6",
|
||||
"Specifies the length of a randomly generated password",
|
||||
null),
|
||||
VmDiskThrottlingIopsWriteRate(
|
||||
"Advanced",
|
||||
ManagementServer.class,
|
||||
|
||||
@ -770,7 +770,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
||||
throw new InvalidParameterValueException("Please enter a positive value for the configuration parameter:" + name);
|
||||
}
|
||||
//TODO - better validation for all password pamameters
|
||||
if ("vm.password.length".equalsIgnoreCase(name) && val < 6) {
|
||||
if ("vm.password.length".equalsIgnoreCase(name) && val < 10) {
|
||||
throw new InvalidParameterValueException("Please enter a value greater than 6 for the configuration parameter:" + name);
|
||||
}
|
||||
} catch (final NumberFormatException e) {
|
||||
|
||||
@ -504,6 +504,7 @@ import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
|
||||
import org.apache.cloudstack.framework.config.ConfigDepot;
|
||||
import org.apache.cloudstack.framework.config.ConfigKey;
|
||||
import org.apache.cloudstack.framework.config.Configurable;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.framework.config.impl.ConfigurationVO;
|
||||
import org.apache.cloudstack.framework.security.keystore.KeystoreManager;
|
||||
@ -671,9 +672,11 @@ import com.cloud.vm.dao.SecondaryStorageVmDao;
|
||||
import com.cloud.vm.dao.UserVmDao;
|
||||
import com.cloud.vm.dao.VMInstanceDao;
|
||||
|
||||
public class ManagementServerImpl extends ManagerBase implements ManagementServer {
|
||||
public class ManagementServerImpl extends ManagerBase implements ManagementServer, Configurable {
|
||||
public static final Logger s_logger = Logger.getLogger(ManagementServerImpl.class.getName());
|
||||
|
||||
static final ConfigKey<Integer> vmPasswordLength = new ConfigKey<Integer>("Advanced", Integer.class, "vm.password.length", "10",
|
||||
"Specifies the length of a randomly generated password", false);
|
||||
@Inject
|
||||
public AccountManager _accountMgr;
|
||||
@Inject
|
||||
@ -905,7 +908,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
||||
|
||||
@Override
|
||||
public String generateRandomPassword() {
|
||||
final Integer passwordLength = Integer.parseInt(_configDao.getValue("vm.password.length"));
|
||||
final Integer passwordLength = vmPasswordLength.value();
|
||||
return PasswordGenerator.generateRandomPassword(passwordLength);
|
||||
}
|
||||
|
||||
@ -3021,6 +3024,16 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
||||
return cmdList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getConfigComponentName() {
|
||||
return ManagementServer.class.getSimpleName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigKey<?>[] getConfigKeys() {
|
||||
return new ConfigKey<?>[] {vmPasswordLength};
|
||||
}
|
||||
|
||||
protected class EventPurgeTask extends ManagedContextRunnable {
|
||||
@Override
|
||||
protected void runInContext() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user