Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rule 1.1.3 Ensure Minimum password age is set to 1 or more days #50

Open
msachikanta opened this issue Sep 3, 2024 · 0 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@msachikanta
Copy link

Describe the Issue
The when condition include win22cis_maximum_password_age instead of win22cis_minimum_password_age as shown below:

- name: "1.1.3 | PATCH | Ensure Minimum password age is set to 1 or more days"
  block:
      - name: "1.1.3 | AUDIT | Ensure Minimum password age is set to 1 or more days. | Warning check for minimum password age."
        ansible.builtin.debug:
            msg:
                - "Warning!! You have an invalid age set for win22cis_maximum_password_age please read"
                - "the notes for the variable and make the necessary change to the variable to be in compliance."
        when:
            - win22cis_maximum_password_age > 999 or
              win22cis_maximum_password_age == 0

      - name: "1.1.3 | AUDIT | Ensure Minimum password age is set to 1 or more days. | Set warning count."
        ansible.builtin.import_tasks:
            file: warning_facts.yml
        vars:
            warn_control_id: '1.1.3'
        when:
            - win22cis_maximum_password_age > 999 or
              win22cis_maximum_password_age == 0

      - name: "1.1.3 | PATCH | Ensure Minimum password age is set to 1 or more days. | Set Variable."
        community.windows.win_security_policy:
            section: System Access
            key: MinimumPasswordAge
            value: "{{ win22cis_minimum_password_age }}"
        when:
            - win22cis_maximum_password_age <= 999 or
              win22cis_maximum_password_age > 0

Expected Behavior
The when condition should include win22cis_minimum_password_age as shown below:

- name: "1.1.3 | PATCH | Ensure Minimum password age is set to 1 or more days"
  block:
      - name: "1.1.3 | AUDIT | Ensure Minimum password age is set to 1 or more days. | Warning check for minimum password age."
        ansible.builtin.debug:
            msg:
                - "Warning!! You have an invalid age set for win22cis_minimum_password_age please read"
                - "the notes for the variable and make the necessary change to the variable to be in compliance."
        when:
            - win22cis_minimum_password_age > 999 or
              win22cis_minimum_password_age == 1

      - name: "1.1.3 | AUDIT | Ensure Minimum password age is set to 1 or more days. | Set warning count."
        ansible.builtin.import_tasks:
            file: warning_facts.yml
        vars:
            warn_control_id: '1.1.3'
        when:
            - win22cis_minimum_password_age > 999 or
              win22cis_minimum_password_age == 1

      - name: "1.1.3 | PATCH | Ensure Minimum password age is set to 1 or more days. | Set Variable."
        community.windows.win_security_policy:
            section: System Access
            key: MinimumPasswordAge
            value: "{{ win22cis_minimum_password_age }}"
        when:
            - win22cis_minimum_password_age <= 999 or
              win22cis_minimum_password_age > 1

Environment (please complete the following information):

  • branch being used: devel

Additional Notes
If this issue can be fixed at earliest, that will be really great.

Possible Solution
Possible solution:

- name: "1.1.3 | PATCH | Ensure Minimum password age is set to 1 or more days"
  block:
      - name: "1.1.3 | AUDIT | Ensure Minimum password age is set to 1 or more days. | Warning check for minimum password age."
        ansible.builtin.debug:
            msg:
                - "Warning!! You have an invalid age set for win22cis_minimum_password_age please read"
                - "the notes for the variable and make the necessary change to the variable to be in compliance."
        when:
            - win22cis_minimum_password_age > 999 or
              win22cis_minimum_password_age == 1

      - name: "1.1.3 | AUDIT | Ensure Minimum password age is set to 1 or more days. | Set warning count."
        ansible.builtin.import_tasks:
            file: warning_facts.yml
        vars:
            warn_control_id: '1.1.3'
        when:
            - win22cis_minimum_password_age > 999 or
              win22cis_minimum_password_age == 1

      - name: "1.1.3 | PATCH | Ensure Minimum password age is set to 1 or more days. | Set Variable."
        community.windows.win_security_policy:
            section: System Access
            key: MinimumPasswordAge
            value: "{{ win22cis_minimum_password_age }}"
        when:
            - win22cis_minimum_password_age <= 999 or
              win22cis_minimum_password_age > 1
@msachikanta msachikanta added the bug Something isn't working label Sep 3, 2024
@MrSteve81 MrSteve81 self-assigned this Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants