Skip to content

Commit

Permalink
Allow more special characters as the VM password [FIXED JENKINS-43243]
Browse files Browse the repository at this point in the history
  • Loading branch information
clguiman committed Apr 4, 2017
1 parent 6dd8a28 commit 957d2b2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/main/java/com/microsoft/azure/vmagent/util/AzureUtil.java
Expand Up @@ -44,9 +44,10 @@ public class AzureUtil {

public static final String VAL_UPPER_CASE_REGEX = "(?=.*[A-Z]).{1,}";

public static final String VAL_SPECIAL_CHAR_REGEX = "(?=.*[!@#$%^&*.]).{1,}";

public static final String VAL_PASSWORD_REGEX = "([0-9a-zA-Z!@#\\$%\\^&\\*\\.]*{8,123})";
public static final String VAL_SPECIAL_CHAR_REGEX = "(?=.*[@#\\$%\\^&\\*-_!+=\\[\\]{}|\\\\:`,\\.\\?/~\"\\(\\);\']).{1,}";

public static final String VAL_PASSWORD_REGEX = "([0-9a-zA-Z@#\\$%\\^&\\*-_!+=\\[\\]{}|\\\\:`,\\.\\?/~\"\\(\\);\']*{8,123})";

public static final String VAL_ADMIN_USERNAME = "([a-zA-Z0-9_-]{3,15})";

Expand Down
Expand Up @@ -43,7 +43,7 @@ Azure_GC_Template_ImageURI_Not_In_Same_Account=The image URI is not located in t
Azure_GC_Template_JNLP_Not_Supported=The JNLP launch method is supported only for Windows.
Azure_GC_Template_UN_Null_Or_Empty=Missing admin user name.
Azure_GC_Template_PWD_Null_Or_Empty=Missing admin password.
Azure_GC_Template_PWD_Not_Valid=Required: Not a valid password. The password length must be between 8 and 123 characters. It also needs to have at least one digit, one lowercase and one uppercase letter.
Azure_GC_Template_PWD_Not_Valid=Required: Not a valid password. The password length must be between 8 and 123 characters. It also needs to have at least one digit, one lowercase, one uppercase letter and one special character ( @#$%^&*-_!+=[]'{}'|\\:`,.?/~\"();\' ).
Azure_GC_Template_VirtualNetwork_Null_Or_Empty=Missing virtual network name.
Azure_GC_Template_VirtualNetwork_NotFound=The virtual network {0} does not exist in this subscription.
Azure_GC_Template_subnet_NotFound=The subnet {0} does not belong to the specified virtual network.
Expand Down
Expand Up @@ -237,7 +237,7 @@ protected AzureVMDeploymentInfo createDefaultDeployment(final int numberOfAgents
final String initScript = "echo \"" + UUID.randomUUID().toString() + "\"";
final String launchMethod = Constants.LAUNCH_METHOD_SSH;
final String vmUser = "tstVmUser";
final Secret vmPassword = Secret.fromString(UUID.randomUUID().toString());
final Secret vmPassword = Secret.fromString(TestEnvironment.GenerateRandomString(16) + "AA@@12345@#$%^&*-_!+=[]{}|\\:`,.?/~\\\"();\'");

StandardUsernamePasswordCredentials vmCredentials = mock(StandardUsernamePasswordCredentials.class);
when(vmCredentials.getUsername()).thenReturn(vmUser);
Expand Down Expand Up @@ -332,7 +332,7 @@ protected VirtualMachine createAzureVM(final String vmName, final String tagName
.withoutPrimaryPublicIpAddress()
.withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_14_04_LTS)
.withRootUsername(TestEnvironment.GenerateRandomString(8))
.withRootPassword(TestEnvironment.GenerateRandomString(16) + "AA@@12345") //don't try this at home
.withRootPassword(TestEnvironment.GenerateRandomString(16) + "AA@@12345@#$%^&*-_!+=[]{}|\\:`,.?/~\\\"();\'") //don't try this at home
.withUnmanagedDisks()
.withTag(Constants.AZURE_JENKINS_TAG_NAME, Constants.AZURE_JENKINS_TAG_VALUE)
.withTag(tagName, tagValue)
Expand Down

0 comments on commit 957d2b2

Please sign in to comment.