Skip to content

Commit c30a257

Browse files
weizhouapachedhslove
authored andcommitted
CKS: generate a random UUID as password of CKS user in project (apache#11639)
1 parent e506273 commit c30a257

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/KubernetesClusterManagerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1870,7 +1870,7 @@ protected Account createProjectKubernetesAccount(final Project project, final St
18701870
try {
18711871
Role role = getProjectKubernetesAccountRole();
18721872
UserAccount userAccount = accountService.createUserAccount(accountName,
1873-
UuidUtils.first(UUID.randomUUID().toString()), PROJECT_KUBERNETES_ACCOUNT_FIRST_NAME,
1873+
UUID.randomUUID().toString(), PROJECT_KUBERNETES_ACCOUNT_FIRST_NAME,
18741874
PROJECT_KUBERNETES_ACCOUNT_LAST_NAME, null, null, accountName, Account.Type.NORMAL, role.getId(),
18751875
project.getDomainId(), null, null, null, null, User.Source.NATIVE);
18761876
projectManager.assignAccountToProject(project, userAccount.getAccountId(), ProjectAccount.Role.Regular,

server/src/main/java/com/cloud/user/AccountManagerImpl.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2786,7 +2786,10 @@ protected UserVO createUser(long accountId, String userName, String password, St
27862786
logger.debug("Creating user: " + userName + ", accountId: " + accountId + " timezone:" + timezone);
27872787
}
27882788

2789-
passwordPolicy.verifyIfPasswordCompliesWithPasswordPolicies(password, userName, getAccount(accountId).getDomainId());
2789+
Account callingAccount = getCurrentCallingAccount();
2790+
if (callingAccount.getId() != Account.ACCOUNT_ID_SYSTEM) {
2791+
passwordPolicy.verifyIfPasswordCompliesWithPasswordPolicies(password, userName, getAccount(accountId).getDomainId());
2792+
}
27902793

27912794
String encodedPassword = null;
27922795
for (UserAuthenticator authenticator : _userPasswordEncoders) {

0 commit comments

Comments
 (0)