Skip to content

Commit a7630b6

Browse files
authored
Merge pull request zstackio#340 from MatheMatrix/bug/1523
Only allow user uses legal characters in password of vyos
2 parents 8e1d379 + 75cc51f commit a7630b6

File tree

1 file changed

+2
-2
lines changed
  • plugin/virtualRouterProvider/src/main/java/org/zstack/network/service/virtualrouter/vyos

1 file changed

+2
-2
lines changed

plugin/virtualRouterProvider/src/main/java/org/zstack/network/service/virtualrouter/vyos/VyosVmFactory.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,8 @@ public boolean start() {
171171
VirtualRouterGlobalConfig.VYOS_PASSWORD.installValidateExtension(new GlobalConfigValidatorExtensionPoint() {
172172
@Override
173173
public void validateGlobalConfig(String category, String name, String oldValue, String newValue) throws GlobalConfigException {
174-
if (newValue.isEmpty()) {
175-
throw new GlobalConfigException("the vyos password cannot be an empty string");
174+
if (!newValue.matches("[A-Za-z0-9-$@!%*#?&_]{1,}")) {
175+
throw new GlobalConfigException("the vrouter password can only contain alphabet, number and these special character: -$@!%*#?&_");
176176
}
177177
}
178178
});

0 commit comments

Comments
 (0)