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

Align networkmanager_dns_mode to the RHEL 9 STIG #11745

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

{{{ ansible_instantiate_variables("var_networkmanager_dns_mode") }}}

{{{ ansible_ini_file_set("/etc/NetworkManager/NetworkManager.conf", "main", "dns", "{{ var_networkmanager_dns_mode }}") }}}
{{{ ansible_ini_file_set("/etc/NetworkManager/NetworkManager.conf", "main", "dns", "{{ var_networkmanager_dns_mode }}", description="", ignore_spaces=true) }}}

- name: "{{{ rule_title }}} - Ensure Network Manager"
ansible.builtin.systemd:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{{{
oval_check_ini_file(
{{{ oval_check_config_file(
path="/etc/NetworkManager/NetworkManager.conf",
section="main",
prefix_regex="",
parameter="dns",
value="default|none",
missing_parameter_pass=false,
separator_regex="=",
missing_parameter_pass=False,
application="NetworkManager",
multi_value=false,
missing_config_file_fail=true
)
multi_value=true,
missing_config_file_fail=true,
section="main")
}}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
# variables = var_networkmanager_dns_mode = default
# packages = NetworkManager

cat > /etc/NetworkManager/NetworkManager.conf << EOM
[main]
dns = none
EOM
7 changes: 6 additions & 1 deletion shared/macros/10-ansible.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ The following macro remediates Audit syscall rule in :code:`/etc/audit/audit.rul
{{%- endmacro %}}


{{% macro ansible_ini_file_set(filename, section, key, value, description="") -%}}
{{% macro ansible_ini_file_set(filename, section, key, value, description="", ignore_spaces=false) -%}}
- name: "{{{ description if description else ("Set '" + key + "' to '" + value + "' in the [" + section + "] section of '" + filename + "'") }}}"
ini_file:
path: "{{{ filename }}}"
Expand All @@ -733,6 +733,11 @@ The following macro remediates Audit syscall rule in :code:`/etc/audit/audit.rul
value: "{{{ value }}}"
create: yes
mode: 0644
{{% if ignore_spaces %}}
ignore_spaces: false
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests still fail.

If we do this they should stop failing:

Suggested change
ignore_spaces: false
ignore_spaces: false
no_extra_spaces: true

no_extra_spaces: true
{{% endif %}}

{{%- endmacro %}}

{{#
Expand Down
Loading