-
Notifications
You must be signed in to change notification settings - Fork 710
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add new parametrized platform os_linux
add associated template together with Ansible remediation. Currently, only the OS name can be specified.
- Loading branch information
1 parent
8de4322
commit 54afd39
Showing
4 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: "cpe:/o:{arg}" | ||
title: "Operating System is {arg}" | ||
check_id: platform_os_linux_{arg} | ||
template: | ||
name: platform_os_linux | ||
args: | ||
rhel: | ||
os_name: "Red Hat Enterprise Linux" | ||
os_id: 'rhel' | ||
os_id_ansible: "RedHat" | ||
fedora: | ||
os_name: "Fedora" | ||
os_id: 'fedora' | ||
os_id_ansible: "Fedora" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{{%- set ansible_os_release_name_cond = 'ansible_distribution == "' + OS_ID_ANSIBLE + '"' -%}} | ||
{{{ ansible_os_release_name_cond.strip() }}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<def-group> | ||
<definition class="inventory" id="platform_{{{ _RULE_ID }}}" version="1"> | ||
{{{ oval_metadata("The installed operating system is " + OS_NAME, affected_platforms=["multi_platform_all"]) }}} | ||
<criteria operator="AND"> | ||
<criterion comment="The operating system installed on the system is {{{ OS_NAME }}}" | ||
test_ref="test_os_id_is_{{{ ID }}}" /> | ||
</criteria> | ||
</definition> | ||
|
||
<ind:textfilecontent54_test check="all" comment="ID in os-release is {{{ OS_ID }}}" id="test_os_id_is_{{{ ID }}}" version="1"> | ||
<ind:object object_ref="obj_os_id_is_{{{ ID }}}" /> | ||
<ind:state state_ref="state_os_id_is_{{{ ID }}}" /> | ||
</ind:textfilecontent54_test> | ||
|
||
<ind:textfilecontent54_object id="obj_os_id_is_{{{ ID }}}" version="1"> | ||
<ind:filepath>/etc/os-release</ind:filepath> | ||
<ind:pattern operation="pattern match">^ID=["']?(\w+)["']?$</ind:pattern> | ||
<ind:instance operation="greater than or equal" datatype="int">1</ind:instance> | ||
</ind:textfilecontent54_object> | ||
|
||
<ind:textfilecontent54_state id="state_os_id_is_{{{ ID }}}" version="1"> | ||
<ind:subexpression operation="pattern match">{{{ OS_ID }}}</ind:subexpression> | ||
</ind:textfilecontent54_state> | ||
|
||
</def-group> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
supported_languages: | ||
- ansible | ||
- oval |