You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by "weizhouapache (via GitHub)" <gi...@apache.org> on 2025/09/15 10:46:23 UTC

[PR] CKS: generate a strong random password for CKS user [cloudstack]

weizhouapache opened a new pull request, #11637:
URL: https://github.com/apache/cloudstack/pull/11637

   ### Description
   
   This PR fixes #11626
   
   <!--- Describe your changes in DETAIL - And how has behaviour functionally changed. -->
   
   <!-- For new features, provide link to FS, dev ML discussion etc. -->
   <!-- In case of bug fix, the expected and actual behaviours, steps to reproduce. -->
   
   <!-- When "Fixes: #<id>" is specified, the issue/PR will automatically be closed when this PR gets merged -->
   <!-- For addressing multiple issues/PRs, use multiple "Fixes: #<id>" -->
   <!-- Fixes: # -->
   
   <!--- ******************************************************************************* -->
   <!--- NOTE: AUTOMATION USES THE DESCRIPTIONS TO SET LABELS AND PRODUCE DOCUMENTATION. -->
   <!--- PLEASE PUT AN 'X' in only **ONE** box -->
   <!--- ******************************************************************************* -->
   
   ### Types of changes
   
   - [ ] Breaking change (fix or feature that would cause existing functionality to change)
   - [ ] New feature (non-breaking change which adds functionality)
   - [x] Bug fix (non-breaking change which fixes an issue)
   - [ ] Enhancement (improves an existing feature and functionality)
   - [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
   - [ ] build/CI
   - [ ] test (unit or integration test code)
   
   ### Feature/Enhancement Scale or Bug Severity
   
   #### Feature/Enhancement Scale
   
   - [ ] Major
   - [ ] Minor
   
   #### Bug Severity
   
   - [ ] BLOCKER
   - [ ] Critical
   - [ ] Major
   - [ ] Minor
   - [ ] Trivial
   
   ### Screenshots (if appropriate):
   
   ### How Has This Been Tested?
   
   <!-- Please describe in detail how you tested your changes. -->
   <!-- Include details of your testing environment, and the tests you ran to -->
   
   #### How did you try to break this feature and the system with this change?
   
   <!-- see how your change affects other areas of the code, etc. -->
   
   <!-- Please read the [CONTRIBUTING](https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md) document -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CKS: generate a strong random password for CKS user [cloudstack]

Posted by "weizhouapache (via GitHub)" <gi...@apache.org>.
weizhouapache commented on code in PR #11637:
URL: https://github.com/apache/cloudstack/pull/11637#discussion_r2348653386


##########
plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/KubernetesClusterManagerImpl.java:
##########
@@ -1499,6 +1502,14 @@ protected String[] createUserApiKeyAndSecretKey(long userId) {
         }
     }
 
+    protected String generateRandomUserPassword(Long domainId) {
+        Integer passwordPolicyMinimumLength = PasswordPolicy.PasswordPolicyMinimumLength.valueIn(domainId);
+        if (passwordPolicyMinimumLength == null || passwordPolicyMinimumLength < CKS_USER_MIN_PASSWORD_LENGTH) {
+            passwordPolicyMinimumLength = CKS_USER_MIN_PASSWORD_LENGTH;

Review Comment:
   @sureshanaparti 
   I do not understand your concern
   this is used to generate a strong random password for CKS user (the password is unknown for every one)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CKS: generate a strong random password for CKS user [cloudstack]

Posted by "weizhouapache (via GitHub)" <gi...@apache.org>.
weizhouapache commented on PR #11637:
URL: https://github.com/apache/cloudstack/pull/11637#issuecomment-3291826000

   closed this ticket, let's revisit later


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CKS: generate a strong random password for CKS user [cloudstack]

Posted by "sureshanaparti (via GitHub)" <gi...@apache.org>.
sureshanaparti commented on code in PR #11637:
URL: https://github.com/apache/cloudstack/pull/11637#discussion_r2348674326


##########
plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/KubernetesClusterManagerImpl.java:
##########
@@ -1499,6 +1502,14 @@ protected String[] createUserApiKeyAndSecretKey(long userId) {
         }
     }
 
+    protected String generateRandomUserPassword(Long domainId) {
+        Integer passwordPolicyMinimumLength = PasswordPolicy.PasswordPolicyMinimumLength.valueIn(domainId);
+        if (passwordPolicyMinimumLength == null || passwordPolicyMinimumLength < CKS_USER_MIN_PASSWORD_LENGTH) {
+            passwordPolicyMinimumLength = CKS_USER_MIN_PASSWORD_LENGTH;

Review Comment:
   @weizhouapache not the password, the minimum length considered for generating it (as the config setting is overridden if it set between 1 and 11)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CKS: generate a strong random password for CKS user [cloudstack]

Posted by "weizhouapache (via GitHub)" <gi...@apache.org>.
weizhouapache commented on PR #11637:
URL: https://github.com/apache/cloudstack/pull/11637#issuecomment-3291891494

   > Got closed too soon! Code looks good to me. Thanks @weizhouapache for the fix If possible, this can be included in 4.20.2
   
   thanks @shwstppr  :smile: 
   
   This could still be improved. I created a simple PR #11639 for quick fix


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CKS: generate a strong random password for CKS user [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11637:
URL: https://github.com/apache/cloudstack/pull/11637#issuecomment-3291955207

   Packaging result [SF]: ✖️ el8 ✖️ el9  ✔️ debian ✖️ suse15. SL-JID 15009


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CKS: generate a strong random password for CKS user [cloudstack]

Posted by "weizhouapache (via GitHub)" <gi...@apache.org>.
weizhouapache closed pull request #11637: CKS: generate a strong random password for CKS user
URL: https://github.com/apache/cloudstack/pull/11637


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CKS: generate a strong random password for CKS user [cloudstack]

Posted by "weizhouapache (via GitHub)" <gi...@apache.org>.
weizhouapache commented on code in PR #11637:
URL: https://github.com/apache/cloudstack/pull/11637#discussion_r2348738815


##########
plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/KubernetesClusterManagerImpl.java:
##########
@@ -1499,6 +1502,14 @@ protected String[] createUserApiKeyAndSecretKey(long userId) {
         }
     }
 
+    protected String generateRandomUserPassword(Long domainId) {
+        Integer passwordPolicyMinimumLength = PasswordPolicy.PasswordPolicyMinimumLength.valueIn(domainId);
+        if (passwordPolicyMinimumLength == null || passwordPolicyMinimumLength < CKS_USER_MIN_PASSWORD_LENGTH) {
+            passwordPolicyMinimumLength = CKS_USER_MIN_PASSWORD_LENGTH;

Review Comment:
   actually CKS user password policy check is ignored, that's the main change of this PR
   
   ```
           if (!User.Source.CKS.equals(source)) {
               passwordPolicy.verifyIfPasswordCompliesWithPasswordPolicies(password, userName, getAccount(accountId).getDomainId());
           }
   ```
   
   the password policy check has several checks (regex, username, min length, min uppcase, min lowercase, min digits)
   ideally there should be a method to generate a random password which matches all the password requirements, it looks difficult so far.
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CKS: generate a strong random password for CKS user [cloudstack]

Posted by "sureshanaparti (via GitHub)" <gi...@apache.org>.
sureshanaparti commented on code in PR #11637:
URL: https://github.com/apache/cloudstack/pull/11637#discussion_r2348624668


##########
plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/KubernetesClusterManagerImpl.java:
##########
@@ -1499,6 +1502,14 @@ protected String[] createUserApiKeyAndSecretKey(long userId) {
         }
     }
 
+    protected String generateRandomUserPassword(Long domainId) {
+        Integer passwordPolicyMinimumLength = PasswordPolicy.PasswordPolicyMinimumLength.valueIn(domainId);
+        if (passwordPolicyMinimumLength == null || passwordPolicyMinimumLength < CKS_USER_MIN_PASSWORD_LENGTH) {
+            passwordPolicyMinimumLength = CKS_USER_MIN_PASSWORD_LENGTH;

Review Comment:
   operator doesn't know that the min length is implicitly set here if it's configured between 1 and 11. Update the config description that min 12 length is considered for CKS users, or better we restrict the min length to be >= 12  for all (to be strong for all cases). 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CKS: generate a strong random password for CKS user [cloudstack]

Posted by "weizhouapache (via GitHub)" <gi...@apache.org>.
weizhouapache commented on code in PR #11637:
URL: https://github.com/apache/cloudstack/pull/11637#discussion_r2348691838


##########
plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/KubernetesClusterManagerImpl.java:
##########
@@ -1499,6 +1502,14 @@ protected String[] createUserApiKeyAndSecretKey(long userId) {
         }
     }
 
+    protected String generateRandomUserPassword(Long domainId) {
+        Integer passwordPolicyMinimumLength = PasswordPolicy.PasswordPolicyMinimumLength.valueIn(domainId);
+        if (passwordPolicyMinimumLength == null || passwordPolicyMinimumLength < CKS_USER_MIN_PASSWORD_LENGTH) {
+            passwordPolicyMinimumLength = CKS_USER_MIN_PASSWORD_LENGTH;

Review Comment:
   I think nobody will care about the length of password of CKS user, as nobody knows and uses the password.
   
   12 is good enough in my opinion. But if user wants to have user passwords with more length, just respect it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CKS: generate a strong random password for CKS user [cloudstack]

Posted by "sureshanaparti (via GitHub)" <gi...@apache.org>.
sureshanaparti commented on code in PR #11637:
URL: https://github.com/apache/cloudstack/pull/11637#discussion_r2348717216


##########
plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/KubernetesClusterManagerImpl.java:
##########
@@ -1499,6 +1502,14 @@ protected String[] createUserApiKeyAndSecretKey(long userId) {
         }
     }
 
+    protected String generateRandomUserPassword(Long domainId) {
+        Integer passwordPolicyMinimumLength = PasswordPolicy.PasswordPolicyMinimumLength.valueIn(domainId);
+        if (passwordPolicyMinimumLength == null || passwordPolicyMinimumLength < CKS_USER_MIN_PASSWORD_LENGTH) {
+            passwordPolicyMinimumLength = CKS_USER_MIN_PASSWORD_LENGTH;

Review Comment:
   as you are addressing it, better not allow less than 10 as minimum length for passwords (if not in 4.20.2, we can address in 4.22, need to add a check for config)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CKS: generate a strong random password for CKS user [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11637:
URL: https://github.com/apache/cloudstack/pull/11637#issuecomment-3291542527

   @weizhouapache a [SL] Jenkins job has been kicked to build packages. It will be bundled with  KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CKS: generate a strong random password for CKS user [cloudstack]

Posted by "weizhouapache (via GitHub)" <gi...@apache.org>.
weizhouapache commented on PR #11637:
URL: https://github.com/apache/cloudstack/pull/11637#issuecomment-3291538282

   @blueorangutan package


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CKS: generate a strong random password for CKS user [cloudstack]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #11637:
URL: https://github.com/apache/cloudstack/pull/11637#issuecomment-3291567987

   ## [Codecov](https://app.codecov.io/gh/apache/cloudstack/pull/11637?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 4.00%. Comparing base ([`1948f90`](https://app.codecov.io/gh/apache/cloudstack/commit/1948f90c2c7bfcb62d3eccc3b3aa86a522777eb4?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`4427ef0`](https://app.codecov.io/gh/apache/cloudstack/commit/4427ef0cfc2979ab45f48620ffb926be356a86ea?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   > :exclamation:  There is a different number of reports uploaded between BASE (1948f90) and HEAD (4427ef0). Click for more details.
   > 
   > <details><summary>HEAD has 1 upload less than BASE</summary>
   >
   >| Flag | BASE (1948f90) | HEAD (4427ef0) |
   >|------|------|------|
   >|unittests|1|0|
   ></details>
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@              Coverage Diff              @@
   ##               4.20   #11637       +/-   ##
   =============================================
   - Coverage     16.17%    4.00%   -12.17%     
   =============================================
     Files          5656      402     -5254     
     Lines        498151    32649   -465502     
     Branches      60441     5804    -54637     
   =============================================
   - Hits          80589     1309    -79280     
   + Misses       408591    31187   -377404     
   + Partials       8971      153     -8818     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/cloudstack/pull/11637/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [uitests](https://app.codecov.io/gh/apache/cloudstack/pull/11637/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `4.00% <ø> (ø)` | |
   | [unittests](https://app.codecov.io/gh/apache/cloudstack/pull/11637/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/cloudstack/pull/11637?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org