|
4933 | 4933 | register: rule_2_3_11_12_results |
4934 | 4934 |
|
4935 | 4935 | - name: "2.3.11.13 | GPO | Ensure Network security: Restrict NTLM: Outgoing NTLM traffic to remote servers is set to Audit all or higher" |
4936 | | - when: |
4937 | | - - win22cis_rule_2_3_11_13 |
4938 | | - - "'(Skipped)' not in item" |
| 4936 | + when: win22cis_rule_2_3_11_13 |
4939 | 4937 | tags: |
4940 | 4938 | - level1-domaincontroller |
4941 | 4939 | - level1-memberserver |
|
4954 | 4952 | - NIST800-53R5_AU-3_1 |
4955 | 4953 | - NIST800-53R5_AU-7 |
4956 | 4954 | - NIST800-53R5_AU-12 |
4957 | | - ansible.windows.win_shell: | |
4958 | | - $gpoName = "{{ item }}" |
4959 | | - $registryKeyPath = "HKLM\SYSTEM\Currentcontrolset\Control\Lsa\MSV1_0" |
4960 | | - $registryValueName = "RestrictSendingNTLMTraffic" |
4961 | | - $type = "DWORD" |
4962 | | - $desiredValue = 2 |
| 4955 | + block: |
| 4956 | + - name: "2.3.11.13 | AUDIT | Ensure Network security: Restrict NTLM: Outgoing NTLM traffic to remote servers is set to Audit all or higher. | Set GPO Value.." |
| 4957 | + when: |
| 4958 | + - "'(Skipped)' not in item" |
| 4959 | + - win22cis_restrict_sending_ntlm_traffic == 1 or |
| 4960 | + win22cis_restrict_sending_ntlm_traffic == 2 |
| 4961 | + ansible.windows.win_shell: | |
| 4962 | + $gpoName = "{{ item }}" |
| 4963 | + $registryKeyPath = "HKLM\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0" |
| 4964 | + $registryValueName = "RestrictSendingNTLMTraffic" |
| 4965 | + $type = "DWORD" |
| 4966 | + $desiredValue = {{ win22cis_restrict_sending_ntlm_traffic }} |
4963 | 4967 |
|
4964 | | - # Get the current value of the registry key in the GPO |
4965 | | - $currentValue = (Get-GPRegistryValue -Name $gpoName -Key $registryKeyPath -ValueName $registryValueName -ErrorAction SilentlyContinue).Value |
| 4968 | + # Get the current value of the registry key in the GPO |
| 4969 | + $currentValue = (Get-GPRegistryValue -Name $gpoName -Key $registryKeyPath -ValueName $registryValueName -ErrorAction SilentlyContinue).Value |
4966 | 4970 |
|
4967 | | - # Check if the current value is equal to the desired value |
4968 | | - if ($currentValue -ne $desiredValue) { |
4969 | | - # If not, set the registry value to the desired value |
4970 | | - Set-GPRegistryValue -Name $gpoName -Key $registryKeyPath -ValueName $registryValueName -Type $type -Value $desiredValue |
4971 | | - Write-Output "Patched" |
4972 | | - } else { |
4973 | | - Write-Output "No Change Needed" |
4974 | | - } |
4975 | | - loop: |
4976 | | - - "{{ win22cis_l1_dc_gpo_name ~ ( '(Skipped)' if not win22cis_l1_dc_gpo else '' ) }}" |
4977 | | - - "{{ win22cis_l1_ms_gpo_name ~ ( '(Skipped)' if not win22cis_l1_ms_gpo else '' ) }}" |
4978 | | - loop_control: |
4979 | | - label: "{{ item }}" |
4980 | | - changed_when: '"Patched" in rule_2_3_11_13_results.stdout' |
4981 | | - register: rule_2_3_11_13_results |
| 4971 | + # Check if the current value is equal to the desired value |
| 4972 | + if ($currentValue -ne $desiredValue) { |
| 4973 | + # If not, set the registry value to the desired value |
| 4974 | + Set-GPRegistryValue -Name $gpoName -Key $registryKeyPath -ValueName $registryValueName -Type $type -Value $desiredValue |
| 4975 | + Write-Output "Patched" |
| 4976 | + } else { |
| 4977 | + Write-Output "No Change Needed" |
| 4978 | + } |
| 4979 | + loop: |
| 4980 | + - "{{ win22cis_l1_dc_gpo_name ~ ( '(Skipped)' if not win22cis_l1_dc_gpo else '' ) }}" |
| 4981 | + - "{{ win22cis_l1_ms_gpo_name ~ ( '(Skipped)' if not win22cis_l1_ms_gpo else '' ) }}" |
| 4982 | + loop_control: |
| 4983 | + label: "{{ item }}" |
| 4984 | + changed_when: '"Patched" in rule_2_3_11_13_results.stdout' |
| 4985 | + register: rule_2_3_11_13_results |
| 4986 | + |
| 4987 | + - name: "2.3.11.13 | AUDIT | Ensure Network security: Restrict NTLM: Outgoing NTLM traffic to remote servers is set to Audit all or higher. | Warning Check For Variable." |
| 4988 | + ansible.builtin.debug: |
| 4989 | + msg: |
| 4990 | + - "Warning!! You have an invalid variable set for win22cis_restrict_sending_ntlm_traffic. Please read" |
| 4991 | + - "the notes for the variable and make the necessary change to the variable to be in compliance." |
| 4992 | + when: |
| 4993 | + - win22cis_restrict_sending_ntlm_traffic == 0 or |
| 4994 | + win22cis_restrict_sending_ntlm_traffic > 2 |
| 4995 | + |
| 4996 | + - name: "2.3.11.13 | AUDIT | Ensure Network security: Restrict NTLM: Outgoing NTLM traffic to remote servers is set to Audit all or higher. | Warn Count." |
| 4997 | + ansible.builtin.import_tasks: |
| 4998 | + file: warning_facts.yml |
| 4999 | + vars: |
| 5000 | + warn_control_id: '2.3.11.13' |
| 5001 | + when: |
| 5002 | + - win22cis_restrict_sending_ntlm_traffic == 0 or |
| 5003 | + win22cis_restrict_sending_ntlm_traffic > 2 |
4982 | 5004 |
|
4983 | 5005 | - name: "2.3.13.1 | GPO | Ensure Shutdown Allow system to be shut down without having to log on is set to Disabled" |
4984 | 5006 | when: |
|
0 commit comments