Skip to content

Commit 14e4ba2

Browse files
author
Carlos Matos
committed
Added JRE update and clean prev version controls
1 parent eb47bac commit 14e4ba2

File tree

9 files changed

+98
-3
lines changed

9 files changed

+98
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# platform = Java Runtime Environment
2+
# reboot = false
3+
# strategy = restrict
4+
# complexity = low
5+
# disruption = low
6+
- name: "Ensure YUM Removes Previous Package Versions"
7+
lineinfile:
8+
dest: /etc/yum.conf
9+
regexp: ^#?clean_requirements_on_remove
10+
line: clean_requirements_on_remove=1
11+
insertafter: '\[main\]'
12+
create: yes
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# platform = Java Runtime Environment
2+
3+
if grep --silent ^clean_requirements_on_remove /etc/yum.conf ; then
4+
sed -i "s/^clean_requirements_on_remove.*/clean_requirements_on_remove=1/g" /etc/yum.conf
5+
else
6+
echo -e "\n# Set clean_requirements_on_remove to 1 per security requirements" >> /etc/yum.conf
7+
echo "clean_requirements_on_remove=1" >> /etc/yum.conf
8+
fi
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<def-group oval_version="5.10">
2+
<definition class="compliance" id="java_jre_clean_previous_version" version="1">
3+
{{{ oval_metadata("The clean_requirements_on_remove option should be used to ensure that old
4+
versions of software components are removed after updating.") }}}
5+
<criteria>
6+
<criterion comment="check value of clean_requirements_on_remove in /etc/yum.conf" test_ref="test_yum_java_jre_clean_previous_version" />
7+
</criteria>
8+
</definition>
9+
<ind:textfilecontent54_test check="all" check_existence="all_exist" comment="check value of clean_requirements_on_remove in /etc/yum.conf" id="test_yum_java_jre_clean_previous_version" version="1">
10+
<ind:object object_ref="object_yum_java_jre_clean_previous_version" />
11+
</ind:textfilecontent54_test>
12+
<ind:textfilecontent54_object id="object_yum_java_jre_clean_previous_version" comment="clean_requirements_on_remove set in /etc/yum.conf" version="1">
13+
<ind:filepath>/etc/yum.conf</ind:filepath>
14+
<ind:pattern operation="pattern match">^\s*clean_requirements_on_remove\s*=\s*(1|True|yes)\s*$</ind:pattern>
15+
<ind:instance datatype="int" operation="equals">1</ind:instance>
16+
</ind:textfilecontent54_object>
17+
18+
</def-group>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
documentation_complete: true
2+
3+
title: 'Ensure {{{ pkg_manager }}} Removes Previous Package Versions'
4+
5+
description: |-
6+
<tt>{{{ pkg_manager }}}</tt> should be configured to remove previous versions of Java after
7+
new versions have been installed. To configure <tt>{{{ pkg_manager }}}</tt> to remove the
8+
previous versions of Java after updating, set the <tt>clean_requirements_on_remove</tt>
9+
to <tt>1</tt> in <tt>{{{ pkg_manager_config_file }}}</tt>.
10+
11+
rationale: |-
12+
Previous versions of software components that are not removed from the information
13+
system after updates have been installed may be exploited by some adversaries.
14+
15+
severity: medium
16+
17+
references:
18+
srg: SRG-APP-000454
19+
disa: CCI-002617
20+
stigid: JRE8-UX-000190
21+
nist: SI-2(6)
22+
23+
ocil_clause: 'clean_requirements_on_remove is not enabled or configured correctly'
24+
25+
ocil: |-
26+
To verify that <tt>clean_requirements_on_remove</tt> is configured properly, run the
27+
following command:
28+
<pre>$ grep clean_requirements_on_remove {{{ pkg_manager_config_file }}}</pre>
29+
The output should return something similar to:
30+
<pre>clean_requirements_on_remove=1</pre>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# platform = Java Runtime Environment
2+
# reboot = true
3+
# strategy = patch
4+
# complexity = low
5+
# disruption = high
6+
- name: "Security patches are up to date"
7+
package:
8+
name: "*"
9+
state: "latest"
10+
tags:
11+
- skip_ansible_lint # [ANSIBLE0010] Skipping lint because ANSIBLE0010 is a bad security practice
12+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# platform = Java Runtime Environment
2+
3+
{{% if pkg_manager == "zypper" %}}
4+
zypper patch -g security -y
5+
{{% else %}}
6+
yum -y update
7+
{{% endif %}}

jre/guide/java/java_jre_updated/rule.yml

+8-3
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,21 @@ description: |-
88
<pre>$ sudo yum update</pre>
99
If the system is not configured to use one of these sources, updates (in the form of RPM packages)
1010
can be manually downloaded and installed using <tt>rpm</tt>.
11+
<br /><br />
12+
NOTE: U.S. Defense systems are required to be patched within 30 days or sooner as local policy
13+
dictates.
1114
1215
rationale: |-
1316
Running an older version of the JRE can introduce security
1417
vulnerabilities to the system.
1518
16-
severity: medium
19+
severity: low
1720

1821
references:
19-
nist: DCBP-1
20-
stigid: JRE0090-UX
22+
srg: SRG-APP-000456
23+
disa: CCI-002605
24+
stigid: JRE8-UX-000180
25+
nist: SI-2(c)
2126

2227
ocil_clause: 'it is not updated'
2328

jre/product.yml

+2
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ type: product
55
benchmark_root: "./guide"
66

77
profiles_root: "./profiles"
8+
9+
pkg_manager: "yum"

jre/profiles/stig.profile

+1
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,5 @@ selections:
3636
- java_jre_validation_crl_locked
3737
- java_jre_validation_ocsp
3838
- java_jre_validation_ocsp_locked
39+
- java_jre_clean_previous_version
3940
- java_jre_updated

0 commit comments

Comments
 (0)