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

New applicability platform to check IPv6 state #10830

Merged
merged 3 commits into from
Jul 12, 2023
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 @@ -9,3 +9,5 @@ description: |-
perspective, manually configuring important configuration
information is preferable to accepting it from the network
in an unauthenticated fashion.

platform: ipv6[enabled]
11 changes: 11 additions & 0 deletions shared/applicability/ipv6.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: "cpe:/a:ipv6-{arg}"
title: "IPv6 is {arg} on system"
template:
name: platform_ipv6_state
args:
enabled:
state: enabled
ipv6_disable_value: 0
disabled:
state: disabled
ipv6_disable_value: 1
38 changes: 38 additions & 0 deletions shared/templates/platform_ipv6_state/cpe-oval.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<def-group>
<definition class="inventory" id="{{{ _RULE_ID }}}" version="1">
{{{ oval_metadata("", title="IPv6 is " + STATE + " on system", affected_platforms=[full_name]) }}}
<criteria operator="OR">
<criterion test_ref="test_grub2_ipv6_disable_is_correct"
comment="check if ipv6.disable argument is correct in GRUB_CMDLINE_LINUX"/>
{{%- if STATE == "enabled" -%}}
<criterion test_ref="test_grub2_ipv6_disable_is_absent"
comment="check if ipv6.disable parameter is defined in /etc/default/grub"/>
{{%- endif -%}}
</criteria>
</definition>

<ind:textfilecontent54_test id="test_grub2_ipv6_disable_is_correct" version="1"
check="all" check_existence="all_exist"
comment="check GRUB_CMDLINE_LINUX parameters in /etc/default/grub">
<ind:object object_ref="object_grub2_ipv6_disable_parameter"/>
<ind:state state_ref="state_grub2_ipv6_disable_argument"/>
</ind:textfilecontent54_test>

<ind:textfilecontent54_object id="object_grub2_ipv6_disable_parameter" version="1">
<ind:filepath>/etc/default/grub</ind:filepath>
<ind:pattern operation="pattern match">^\s*GRUB_CMDLINE_LINUX=".*ipv6\.disable=(\d).*$</ind:pattern>
<ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
</ind:textfilecontent54_object>

<ind:textfilecontent54_state id="state_grub2_ipv6_disable_argument" version="1">
<ind:subexpression datatype="int" operation="equals">{{{ IPV6_DISABLE_VALUE }}}</ind:subexpression>
</ind:textfilecontent54_state>

{{%- if STATE == "enabled" -%}}
<ind:textfilecontent54_test id="test_grub2_ipv6_disable_is_absent" version="1"
check="all" check_existence="none_exist"
comment="ipv6.disable is not defined in /etc/default/grub">
<ind:object object_ref="object_grub2_ipv6_disable_parameter"/>
</ind:textfilecontent54_test>
{{%- endif -%}}
</def-group>
2 changes: 2 additions & 0 deletions shared/templates/platform_ipv6_state/template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
supported_languages:
- cpe-oval
Loading