Skip to content

Commit 459d15b

Browse files
committed
Add net-snmp CPE entry to detect if package is installed.
1 parent 43223c6 commit 459d15b

18 files changed

+94
-4
lines changed

debian10/cpe/debian10-cpe-dictionary.xml

+4
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,8 @@
7676
<title xml:lang="en-us">System uses zipl</title>
7777
<check system="http://oval.mitre.org/XMLSchema/oval-definitions-5" href="filename">installed_env_has_zipl_package</check>
7878
</cpe-item>
79+
<cpe-item name="cpe:/a:net-snmp">
80+
<title xml:lang="en-us">Package net-snmp is installed</title>
81+
<check system="http://oval.mitre.org/XMLSchema/oval-definitions-5" href="filename">installed_env_has_net-snmp_package</check>
82+
</cpe-item>
7983
</cpe-list>

debian10/product.yml

+4
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@ profiles_root: "./profiles"
99
pkg_manager: "apt_get"
1010

1111
init_system: "systemd"
12+
13+
# Mapping of CPE platform to package
14+
platform_package_overrides:
15+
net-snmp: "snmp"

debian9/cpe/debian9-cpe-dictionary.xml

+4
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,8 @@
7676
<title xml:lang="en-us">System uses zipl</title>
7777
<check system="http://oval.mitre.org/XMLSchema/oval-definitions-5" href="filename">installed_env_has_zipl_package</check>
7878
</cpe-item>
79+
<cpe-item name="cpe:/a:net-snmp">
80+
<title xml:lang="en-us">Package net-snmp is installed</title>
81+
<check system="http://oval.mitre.org/XMLSchema/oval-definitions-5" href="filename">installed_env_has_net-snmp_package</check>
82+
</cpe-item>
7983
</cpe-list>

debian9/product.yml

+4
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@ profiles_root: "./profiles"
99
pkg_manager: "apt_get"
1010

1111
init_system: "systemd"
12+
13+
# Mapping of CPE platform to package
14+
platform_package_overrides:
15+
net-snmp: "snmp"

fedora/cpe/fedora-cpe-dictionary.xml

+4
Original file line numberDiff line numberDiff line change
@@ -111,4 +111,8 @@
111111
<title xml:lang="en-us">System uses zipl</title>
112112
<check system="http://oval.mitre.org/XMLSchema/oval-definitions-5" href="filename">installed_env_has_zipl_package</check>
113113
</cpe-item>
114+
<cpe-item name="cpe:/a:net-snmp">
115+
<title xml:lang="en-us">Package net-snmp is installed</title>
116+
<check system="http://oval.mitre.org/XMLSchema/oval-definitions-5" href="filename">installed_env_has_net-snmp_package</check>
117+
</cpe-item>
114118
</cpe-list>

linux_os/guide/services/snmp/snmp_configure_server/group.yml

+2
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ description: |-
1717
stations</li>
1818
<li>ensure that permissions on the <tt>snmpd.conf</tt> configuration file (by default, in <tt>/etc/snmp</tt>) are 640 or more restrictive</li>
1919
<li>ensure that any MIB files' permissions are also 640 or more restrictive</li></ul>
20+
21+
platform: net-snmp

linux_os/guide/services/snmp/snmp_configure_server/snmpd_not_default_password/ansible/shared.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
path: "/etc/snmp/snmpd.conf"
1717
regexp: 'public'
1818
replace: '{{ var_snmpd_ro_string }}'
19-
when: snmpd.stat is defined and snmpd.stat.exists
19+
when: (snmpd.stat.exists is defined and snmpd.stat.exists)
2020

2121
- name: "Replace all instances of SNMP RW strings"
2222
replace:
2323
path: "/etc/snmp/snmpd.conf"
2424
regexp: 'private'
2525
replace: '{{ var_snmpd_rw_string }}'
26-
when: snmpd.stat is defined and snmpd.stat.exists
26+
when: (snmpd.stat.exists is defined and snmpd.stat.exists)

linux_os/guide/services/snmp/snmp_configure_server/snmpd_not_default_password/oval/shared.xml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<def-group>
22
<definition class="compliance" id="snmpd_not_default_password" version="2">
33
{{{ oval_metadata("SNMP default communities must be removed.") }}}
4-
<criteria operator="OR">
5-
<extend_definition comment="SMNP installed" definition_ref="package_net-snmp_removed" />
4+
<criteria>
65
<criterion comment="SNMP communities" test_ref="test_snmp_default_communities" />
76
</criteria>
87
</definition>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
yum -y install net-snmp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
yum -y remove net-snmp

ol7/cpe/ol7-cpe-dictionary.xml

+4
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,8 @@
8080
<title xml:lang="en-us">SSSD is configured to use LDAP</title>
8181
<check system="http://oval.mitre.org/XMLSchema/oval-definitions-5" href="filename">sssd_conf_uses_ldap</check>
8282
</cpe-item>
83+
<cpe-item name="cpe:/a:net-snmp">
84+
<title xml:lang="en-us">Package net-snmp is installed</title>
85+
<check system="http://oval.mitre.org/XMLSchema/oval-definitions-5" href="filename">installed_env_has_net-snmp_package</check>
86+
</cpe-item>
8387
</cpe-list>

ol8/cpe/ol8-cpe-dictionary.xml

+4
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,8 @@
7575
<title xml:lang="en-us">SSSD is configured to use LDAP</title>
7676
<check system="http://oval.mitre.org/XMLSchema/oval-definitions-5" href="filename">sssd_conf_uses_ldap</check>
7777
</cpe-item>
78+
<cpe-item name="cpe:/a:net-snmp">
79+
<title xml:lang="en-us">Package net-snmp is installed</title>
80+
<check system="http://oval.mitre.org/XMLSchema/oval-definitions-5" href="filename">installed_env_has_net-snmp_package</check>
81+
</cpe-item>
7882
</cpe-list>

rhel6/cpe/rhel6-cpe-dictionary.xml

+4
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,8 @@
9696
<title xml:lang="en-us">System uses zipl</title>
9797
<check system="http://oval.mitre.org/XMLSchema/oval-definitions-5" href="filename">installed_env_has_zipl_package</check>
9898
</cpe-item>
99+
<cpe-item name="cpe:/a:net-snmp">
100+
<title xml:lang="en-us">Package net-snmp is installed</title>
101+
<check system="http://oval.mitre.org/XMLSchema/oval-definitions-5" href="filename">installed_env_has_net-snmp_package</check>
102+
</cpe-item>
99103
</cpe-list>

rhel7/cpe/rhel7-cpe-dictionary.xml

+4
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,8 @@
110110
<title xml:lang="en-us">SSSD is configured to use LDAP</title>
111111
<check system="http://oval.mitre.org/XMLSchema/oval-definitions-5" href="filename">sssd_conf_uses_ldap</check>
112112
</cpe-item>
113+
<cpe-item name="cpe:/a:net-snmp">
114+
<title xml:lang="en-us">Package net-snmp is installed</title>
115+
<check system="http://oval.mitre.org/XMLSchema/oval-definitions-5" href="filename">installed_env_has_net-snmp_package</check>
116+
</cpe-item>
113117
</cpe-list>

rhel8/cpe/rhel8-cpe-dictionary.xml

+4
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,8 @@
8080
<title xml:lang="en-us">SSSD is configured to use LDAP</title>
8181
<check system="http://oval.mitre.org/XMLSchema/oval-definitions-5" href="filename">sssd_conf_uses_ldap</check>
8282
</cpe-item>
83+
<cpe-item name="cpe:/a:net-snmp">
84+
<title xml:lang="en-us">Package net-snmp is installed</title>
85+
<check system="http://oval.mitre.org/XMLSchema/oval-definitions-5" href="filename">installed_env_has_net-snmp_package</check>
86+
</cpe-item>
8387
</cpe-list>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<def-group>
2+
<definition class="inventory"
3+
id="installed_env_has_net-snmp_package" version="1">
4+
<metadata>
5+
<title>Package net-snmp is installed</title>
6+
<affected family="unix">
7+
<platform>multi_platform_all</platform>
8+
</affected>
9+
<description>Checks if package net-snmp is installed.</description>
10+
<reference ref_id="cpe:/a:net-snmp" source="CPE" />
11+
</metadata>
12+
<criteria>
13+
<criterion comment="Package net-snmp is installed" test_ref="test_env_has_net-snmp_installed" />
14+
</criteria>
15+
</definition>
16+
17+
{{% if pkg_system == "rpm" %}}
18+
<linux:rpminfo_test check="all" check_existence="at_least_one_exists"
19+
id="test_env_has_net-snmp_installed" version="1"
20+
comment="system has package net-snmp installed">
21+
<linux:object object_ref="obj_env_has_net-snmp_installed" />
22+
</linux:rpminfo_test>
23+
<linux:rpminfo_object id="obj_env_has_net-snmp_installed" version="1">
24+
<linux:name>net-snmp</linux:name>
25+
</linux:rpminfo_object>
26+
{{% elif pkg_system == "dpkg" %}}
27+
<linux:dpkginfo_test check="all" check_existence="all_exist"
28+
id="test_env_has_net-snmp_installed" version="1"
29+
comment="system has package net-snmp installed">
30+
<linux:object object_ref="obj_env_has_net-snmp_installed" />
31+
</linux:dpkginfo_test>
32+
<linux:dpkginfo_object id="obj_env_has_net-snmp_installed" version="1">
33+
<!-- dpkg systems differ in the package name -->
34+
<linux:name>snmp</linux:name>
35+
</linux:dpkginfo_object>
36+
{{% endif %}}
37+
38+
</def-group>

ssg/constants.py

+1
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,7 @@
500500
"systemd": "cpe:/a:systemd",
501501
"yum": "cpe:/a:yum",
502502
"zipl": "cpe:/a:zipl",
503+
"net-snmp": "cpe:/a:net-snmp",
503504
}
504505

505506
# Default platform to package mapping

wrlinux1019/cpe/wrlinux1019-cpe-dictionary.xml

+4
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,8 @@
7979
<title xml:lang="en-us">SSSD is configured to use LDAP</title>
8080
<check system="http://oval.mitre.org/XMLSchema/oval-definitions-5" href="filename">sssd_conf_uses_ldap</check>
8181
</cpe-item>
82+
<cpe-item name="cpe:/a:net-snmp">
83+
<title xml:lang="en-us">Package net-snmp is installed</title>
84+
<check system="http://oval.mitre.org/XMLSchema/oval-definitions-5" href="filename">installed_env_has_net-snmp_package</check>
85+
</cpe-item>
8286
</cpe-list>

0 commit comments

Comments
 (0)