|
|
05062e |
From e0f1e2096d0f33fa94e3f78a5038e929b0039c32 Mon Sep 17 00:00:00 2001
|
|
|
05062e |
From: =?UTF-8?q?Mat=C4=9Bj=20T=C3=BD=C4=8D?= <matyc@redhat.com>
|
|
|
05062e |
Date: Mon, 27 Jan 2020 11:51:53 +0100
|
|
|
05062e |
Subject: [PATCH 1/6] Add a rule for the openssl strong entropy wrapper.
|
|
|
05062e |
|
|
|
05062e |
---
|
|
|
05062e |
.../openssl_use_strong_entropy/rule.yml | 65 +++++++++++++++++++
|
|
|
05062e |
rhel8/profiles/ospp.profile | 1 +
|
|
|
05062e |
shared/references/cce-redhat-avail.txt | 1 -
|
|
|
05062e |
3 files changed, 66 insertions(+), 1 deletion(-)
|
|
|
05062e |
create mode 100644 linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/rule.yml
|
|
|
05062e |
|
|
|
05062e |
diff --git a/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/rule.yml b/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/rule.yml
|
|
|
05062e |
new file mode 100644
|
|
|
05062e |
index 0000000000..e9ea8ed338
|
|
|
05062e |
--- /dev/null
|
|
|
05062e |
+++ b/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/rule.yml
|
|
|
05062e |
@@ -0,0 +1,65 @@
|
|
|
05062e |
+documentation_complete: true
|
|
|
05062e |
+
|
|
|
05062e |
+# TODO: The plan is not to need this for RHEL>=8.4
|
|
|
05062e |
+prodtype: rhel8
|
|
|
05062e |
+
|
|
|
05062e |
+title: 'OpenSSL uses strong entropy source'
|
|
|
05062e |
+
|
|
|
05062e |
+description: |-
|
|
|
05062e |
+ To set up an <tt>openssl</tt> wrapper that adds a <tt>-rand /dev/random</tt> option to the <tt>openssl</tt> invocation,
|
|
|
05062e |
+ save the following shell snippet to the <tt>/etc/profile.d/cc-config.sh</tt>:
|
|
|
05062e |
+
|
|
|
05062e |
+ # provide a default -rand /dev/random option to openssl commands that
|
|
|
05062e |
+ # support it
|
|
|
05062e |
+
|
|
|
05062e |
+ # written inefficiently for maximum shell compatibility
|
|
|
05062e |
+ openssl()
|
|
|
05062e |
+ (
|
|
|
05062e |
+ openssl_bin=/usr/bin/openssl
|
|
|
05062e |
+
|
|
|
05062e |
+ case "$*" in
|
|
|
05062e |
+ # if user specified -rand, honor it
|
|
|
05062e |
+ *\ -rand\ *|*\ -help*) exec $openssl_bin "$@" ;;
|
|
|
05062e |
+ esac
|
|
|
05062e |
+
|
|
|
05062e |
+ cmds=`$openssl_bin list -digest-commands -cipher-commands | tr '\n' ' '`
|
|
|
05062e |
+ for i in `$openssl_bin list -commands`; do
|
|
|
05062e |
+ if $openssl_bin list -options "$i" | grep -q '^rand '; then
|
|
|
05062e |
+ cmds=" $i $cmds"
|
|
|
05062e |
+ fi
|
|
|
05062e |
+ done
|
|
|
05062e |
+
|
|
|
05062e |
+ case "$cmds" in
|
|
|
05062e |
+ *\ "$1"\ *)
|
|
|
05062e |
+ cmd="$1"; shift
|
|
|
05062e |
+ exec $openssl_bin "$cmd" -rand /dev/random "$@" ;;
|
|
|
05062e |
+ esac
|
|
|
05062e |
+
|
|
|
05062e |
+ exec $openssl_bin "$@"
|
|
|
05062e |
+ )
|
|
|
05062e |
+
|
|
|
05062e |
+
|
|
|
05062e |
+rationale: |-
|
|
|
05062e |
+ The <tt>openssl</tt> default configuration uses less robust entropy sources for seeding.
|
|
|
05062e |
+ The referenced script is sourced to every login shell, and it transparently adds an option
|
|
|
05062e |
+ that enforces strong entropy to every <tt>openssl</tt> invocation,
|
|
|
05062e |
+ which makes <tt>openssl</tt> more secure by default.
|
|
|
05062e |
+
|
|
|
05062e |
+severity: medium
|
|
|
05062e |
+
|
|
|
05062e |
+identifiers:
|
|
|
05062e |
+ cce@rhel8: 82721-2
|
|
|
05062e |
+
|
|
|
05062e |
+references:
|
|
|
05062e |
+ ospp: FIA_AFL.1
|
|
|
05062e |
+
|
|
|
05062e |
+ocil: |-
|
|
|
05062e |
+ To determine whether the <tt>openssl</tt> wrapper is configured correcrlty,
|
|
|
05062e |
+ make sure that the <tt>/etc/profile.d/cc-config.sh</tt> file contains contents
|
|
|
05062e |
+ that are included in the rule's description.
|
|
|
05062e |
+
|
|
|
05062e |
+ocil_clause: |-
|
|
|
05062e |
+ there is no <tt>/etc/profile.d/cc-config.sh</tt> file, or its contents don't match those in the description
|
|
|
05062e |
+
|
|
|
05062e |
+warnings:
|
|
|
05062e |
+ - general: "This setting can cause problems on computers without the hardware random generator, because insufficient entropy blocks the program until enough entropy is available."
|
|
|
05062e |
diff --git a/rhel8/profiles/ospp.profile b/rhel8/profiles/ospp.profile
|
|
|
05062e |
index 63aea526b7..ef3ced5010 100644
|
|
|
05062e |
--- a/rhel8/profiles/ospp.profile
|
|
|
05062e |
+++ b/rhel8/profiles/ospp.profile
|
|
|
05062e |
@@ -59,6 +59,7 @@ selections:
|
|
|
05062e |
- sshd_enable_warning_banner
|
|
|
05062e |
- sshd_rekey_limit
|
|
|
05062e |
- sshd_use_strong_rng
|
|
|
05062e |
+ - openssl_use_strong_entropy
|
|
|
05062e |
|
|
|
05062e |
# Time Server
|
|
|
05062e |
- chronyd_client_only
|
|
|
05062e |
diff --git a/shared/references/cce-redhat-avail.txt b/shared/references/cce-redhat-avail.txt
|
|
|
05062e |
index 4cb08794f4..1733872dfa 100644
|
|
|
05062e |
--- a/shared/references/cce-redhat-avail.txt
|
|
|
05062e |
+++ b/shared/references/cce-redhat-avail.txt
|
|
|
05062e |
@@ -248,6 +248,5 @@
|
|
|
05062e |
CCE-82719-6
|
|
|
05062e |
CCE-82720-4
|
|
|
05062e |
-CCE-82721-2
|
|
|
05062e |
CCE-82722-0
|
|
|
05062e |
CCE-82723-8
|
|
|
05062e |
CCE-82724-6
|
|
|
05062e |
|
|
|
05062e |
From bbd0f8b1234858a4abeece07d7d188bb07d3d077 Mon Sep 17 00:00:00 2001
|
|
|
05062e |
From: Vojtech Polasek <vpolasek@redhat.com>
|
|
|
05062e |
Date: Mon, 27 Jan 2020 19:35:06 +0100
|
|
|
05062e |
Subject: [PATCH 2/6] create checks, remediations,
|
|
|
05062e |
|
|
|
05062e |
---
|
|
|
05062e |
.../ansible/shared.yml | 12 +++++++
|
|
|
05062e |
.../openssl_use_strong_entropy/bash/shared.sh | 5 +++
|
|
|
05062e |
.../oval/shared.xml | 34 +++++++++++++++++++
|
|
|
05062e |
.../openssl_use_strong_entropy/rule.yml | 29 +---------------
|
|
|
05062e |
shared/macros.jinja | 34 ++++++++++++++++++-
|
|
|
05062e |
5 files changed, 85 insertions(+), 29 deletions(-)
|
|
|
05062e |
create mode 100644 linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/ansible/shared.yml
|
|
|
05062e |
create mode 100644 linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/bash/shared.sh
|
|
|
05062e |
create mode 100644 linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/oval/shared.xml
|
|
|
05062e |
|
|
|
05062e |
diff --git a/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/ansible/shared.yml b/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/ansible/shared.yml
|
|
|
05062e |
new file mode 100644
|
|
|
05062e |
index 0000000000..3ce26d6525
|
|
|
05062e |
--- /dev/null
|
|
|
05062e |
+++ b/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/ansible/shared.yml
|
|
|
05062e |
@@ -0,0 +1,12 @@
|
|
|
05062e |
+# platform = multi_platform_all
|
|
|
05062e |
+# reboot = false
|
|
|
05062e |
+# strategy = restrict
|
|
|
05062e |
+# complexity = low
|
|
|
05062e |
+# disruption = low
|
|
|
05062e |
+
|
|
|
05062e |
+- name: "copy a file with shell snippet to configure openssl strong entropy"
|
|
|
05062e |
+ copy:
|
|
|
05062e |
+ dest: /etc/profile.d/cc-config.sh
|
|
|
05062e |
+ content: |+
|
|
|
05062e |
+ {{{ openssl_strong_entropy_config_file()|indent(8,blank=True) }}}
|
|
|
05062e |
+
|
|
|
05062e |
diff --git a/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/bash/shared.sh b/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/bash/shared.sh
|
|
|
05062e |
new file mode 100644
|
|
|
05062e |
index 0000000000..db5c331ce7
|
|
|
05062e |
--- /dev/null
|
|
|
05062e |
+++ b/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/bash/shared.sh
|
|
|
05062e |
@@ -0,0 +1,5 @@
|
|
|
05062e |
+# platform = Red Hat Enterprise Linux 8
|
|
|
05062e |
+
|
|
|
05062e |
+cat > /etc/profile.d/cc-config.sh <<- 'EOM'
|
|
|
05062e |
+{{{ openssl_strong_entropy_config_file() }}}
|
|
|
05062e |
+EOM
|
|
|
05062e |
diff --git a/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/oval/shared.xml b/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/oval/shared.xml
|
|
|
05062e |
new file mode 100644
|
|
|
05062e |
index 0000000000..b441b7ae6e
|
|
|
05062e |
--- /dev/null
|
|
|
05062e |
+++ b/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/oval/shared.xml
|
|
|
05062e |
@@ -0,0 +1,34 @@
|
|
|
05062e |
+<def-group>
|
|
|
05062e |
+ <definition class="compliance" id="openssl_use_strong_entropy" version="1">
|
|
|
05062e |
+ <metadata>
|
|
|
05062e |
+ <title>Configure Openssl to use strong entropy</title>
|
|
|
05062e |
+ <affected family="unix">
|
|
|
05062e |
+ <platform>Red Hat Enterprise Linux 8</platform>
|
|
|
05062e |
+ <platform>multi_platform_fedora</platform>
|
|
|
05062e |
+ </affected>
|
|
|
05062e |
+ <description>OpenSSL should be configured to generate random data with strong entropy.</description>
|
|
|
05062e |
+ </metadata>
|
|
|
05062e |
+ <criteria>
|
|
|
05062e |
+
|
|
|
05062e |
+ comment="Check that the OpenSSL is configured to generate random data with strong entropy." />
|
|
|
05062e |
+ </criteria>
|
|
|
05062e |
+ </definition>
|
|
|
05062e |
+
|
|
|
05062e |
+
|
|
|
05062e |
+ comment="Test if openssl is configured to generate random data with strong entropy" version="1"
|
|
|
05062e |
+ check="all" check_existence="all_exist">
|
|
|
05062e |
+ <ind:object object_ref="object_openssl_strong_entropy"/>
|
|
|
05062e |
+ <ind:state state_ref="state_openssl_strong_entropy"/>
|
|
|
05062e |
+ </ind:filehash58_test>
|
|
|
05062e |
+
|
|
|
05062e |
+ <ind:filehash58_object id="object_openssl_strong_entropy" version="1">
|
|
|
05062e |
+ <ind:filepath>/etc/profile.d/cc-config.sh</ind:filepath>
|
|
|
05062e |
+ <ind:hash_type>SHA-256</ind:hash_type>
|
|
|
05062e |
+ </ind:filehash58_object>
|
|
|
05062e |
+
|
|
|
05062e |
+ <ind:filehash58_state id="state_openssl_strong_entropy" version="1">
|
|
|
05062e |
+ <ind:filepath>/etc/profile.d/cc-config.sh</ind:filepath>
|
|
|
05062e |
+ <ind:hash_type>SHA-256</ind:hash_type>
|
|
|
05062e |
+ <ind:hash>6488c757642cd493da09dd78ee27f039711a1ad79039900970553772fd2106af</ind:hash>
|
|
|
05062e |
+ </ind:filehash58_state>
|
|
|
05062e |
+</def-group>
|
|
|
05062e |
diff --git a/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/rule.yml b/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/rule.yml
|
|
|
05062e |
index e9ea8ed338..3b01da01af 100644
|
|
|
05062e |
--- a/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/rule.yml
|
|
|
05062e |
+++ b/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/rule.yml
|
|
|
05062e |
@@ -9,34 +9,7 @@ description: |-
|
|
|
05062e |
To set up an <tt>openssl</tt> wrapper that adds a <tt>-rand /dev/random</tt> option to the <tt>openssl</tt> invocation,
|
|
|
05062e |
save the following shell snippet to the <tt>/etc/profile.d/cc-config.sh</tt>:
|
|
|
05062e |
|
|
|
05062e |
- # provide a default -rand /dev/random option to openssl commands that
|
|
|
05062e |
- # support it
|
|
|
05062e |
-
|
|
|
05062e |
- # written inefficiently for maximum shell compatibility
|
|
|
05062e |
- openssl()
|
|
|
05062e |
- (
|
|
|
05062e |
- openssl_bin=/usr/bin/openssl
|
|
|
05062e |
-
|
|
|
05062e |
- case "$*" in
|
|
|
05062e |
- # if user specified -rand, honor it
|
|
|
05062e |
- *\ -rand\ *|*\ -help*) exec $openssl_bin "$@" ;;
|
|
|
05062e |
- esac
|
|
|
05062e |
-
|
|
|
05062e |
- cmds=`$openssl_bin list -digest-commands -cipher-commands | tr '\n' ' '`
|
|
|
05062e |
- for i in `$openssl_bin list -commands`; do
|
|
|
05062e |
- if $openssl_bin list -options "$i" | grep -q '^rand '; then
|
|
|
05062e |
- cmds=" $i $cmds"
|
|
|
05062e |
- fi
|
|
|
05062e |
- done
|
|
|
05062e |
-
|
|
|
05062e |
- case "$cmds" in
|
|
|
05062e |
- *\ "$1"\ *)
|
|
|
05062e |
- cmd="$1"; shift
|
|
|
05062e |
- exec $openssl_bin "$cmd" -rand /dev/random "$@" ;;
|
|
|
05062e |
- esac
|
|
|
05062e |
-
|
|
|
05062e |
- exec $openssl_bin "$@"
|
|
|
05062e |
- )
|
|
|
05062e |
+ {{{ openssl_strong_entropy_config_file() | indent(4) }}}
|
|
|
05062e |
|
|
|
05062e |
|
|
|
05062e |
rationale: |-
|
|
|
05062e |
diff --git a/shared/macros.jinja b/shared/macros.jinja
|
|
|
05062e |
index 77f8eb31c7..8a25acc937 100644
|
|
|
05062e |
--- a/shared/macros.jinja
|
|
|
05062e |
+++ b/shared/macros.jinja
|
|
|
05062e |
@@ -618,10 +618,42 @@ ocil_clause: "the correct value is not returned"
|
|
|
05062e |
|
|
|
05062e |
|
|
|
05062e |
{{% macro body_of_warning_about_dependent_rule(rule_id, why) -%}}
|
|
|
05062e |
- When selecting this rule in a profile,
|
|
|
05062e |
+ When selecting this rule in a profile,
|
|
|
05062e |
{{%- if why %}}
|
|
|
05062e |
make sure that rule with ID {{{ rule_id }}} is selected as well: {{{ why }}}
|
|
|
05062e |
{{%- else %}}
|
|
|
05062e |
rule {{{ rule_id }}} has to be selected as well.
|
|
|
05062e |
{{%- endif %}}
|
|
|
05062e |
{{% endmacro %}}
|
|
|
05062e |
+
|
|
|
05062e |
+{{% macro openssl_strong_entropy_config_file() -%}}
|
|
|
05062e |
+# provide a default -rand /dev/random option to openssl commands that
|
|
|
05062e |
+# support it
|
|
|
05062e |
+
|
|
|
05062e |
+# written inefficiently for maximum shell compatibility
|
|
|
05062e |
+openssl()
|
|
|
05062e |
+(
|
|
|
05062e |
+ openssl_bin=/usr/bin/openssl
|
|
|
05062e |
+
|
|
|
05062e |
+ case "$*" in
|
|
|
05062e |
+ # if user specified -rand, honor it
|
|
|
05062e |
+ *\ -rand\ *|*\ -help*) exec $openssl_bin "$@" ;;
|
|
|
05062e |
+ esac
|
|
|
05062e |
+
|
|
|
05062e |
+ cmds=`$openssl_bin list -digest-commands -cipher-commands | tr '\n' ' '`
|
|
|
05062e |
+ for i in `$openssl_bin list -commands`; do
|
|
|
05062e |
+ if $openssl_bin list -options "$i" | grep -q '^rand '; then
|
|
|
05062e |
+ cmds=" $i $cmds"
|
|
|
05062e |
+ fi
|
|
|
05062e |
+ done
|
|
|
05062e |
+
|
|
|
05062e |
+ case "$cmds" in
|
|
|
05062e |
+ *\ "$1"\ *)
|
|
|
05062e |
+ cmd="$1"; shift
|
|
|
05062e |
+ exec $openssl_bin "$cmd" -rand /dev/random "$@" ;;
|
|
|
05062e |
+ esac
|
|
|
05062e |
+
|
|
|
05062e |
+ exec $openssl_bin "$@"
|
|
|
05062e |
+)
|
|
|
05062e |
+
|
|
|
05062e |
+{{%- endmacro %}}
|
|
|
05062e |
|
|
|
05062e |
From efaa2c9cbbe09af6b319f487ec05f646290a05a1 Mon Sep 17 00:00:00 2001
|
|
|
05062e |
From: Vojtech Polasek <vpolasek@redhat.com>
|
|
|
05062e |
Date: Tue, 28 Jan 2020 13:42:40 +0100
|
|
|
05062e |
Subject: [PATCH 3/6] add tests
|
|
|
05062e |
|
|
|
05062e |
---
|
|
|
05062e |
.../tests/correct.pass.sh | 34 +++++++++++++++++++
|
|
|
05062e |
.../tests/file_missing.fail.sh | 5 +++
|
|
|
05062e |
.../tests/file_modified.fail.sh | 5 +++
|
|
|
05062e |
3 files changed, 44 insertions(+)
|
|
|
05062e |
create mode 100644 linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/tests/correct.pass.sh
|
|
|
05062e |
create mode 100644 linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/tests/file_missing.fail.sh
|
|
|
05062e |
create mode 100644 linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/tests/file_modified.fail.sh
|
|
|
05062e |
|
|
|
05062e |
diff --git a/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/tests/correct.pass.sh b/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/tests/correct.pass.sh
|
|
|
05062e |
new file mode 100644
|
|
|
05062e |
index 0000000000..0bffab3c81
|
|
|
05062e |
--- /dev/null
|
|
|
05062e |
+++ b/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/tests/correct.pass.sh
|
|
|
05062e |
@@ -0,0 +1,34 @@
|
|
|
05062e |
+#!/bin/bash
|
|
|
05062e |
+# platform = Red Hat Enterprise Linux 8
|
|
|
05062e |
+# profiles = xccdf_org.ssgproject.content_profile_ospp
|
|
|
05062e |
+
|
|
|
05062e |
+cat > /etc/profile.d/cc-config.sh <<- 'EOM'
|
|
|
05062e |
+# provide a default -rand /dev/random option to openssl commands that
|
|
|
05062e |
+# support it
|
|
|
05062e |
+
|
|
|
05062e |
+# written inefficiently for maximum shell compatibility
|
|
|
05062e |
+openssl()
|
|
|
05062e |
+(
|
|
|
05062e |
+ openssl_bin=/usr/bin/openssl
|
|
|
05062e |
+
|
|
|
05062e |
+ case "$*" in
|
|
|
05062e |
+ # if user specified -rand, honor it
|
|
|
05062e |
+ *\ -rand\ *|*\ -help*) exec $openssl_bin "$@" ;;
|
|
|
05062e |
+ esac
|
|
|
05062e |
+
|
|
|
05062e |
+ cmds=`$openssl_bin list -digest-commands -cipher-commands | tr '\n' ' '`
|
|
|
05062e |
+ for i in `$openssl_bin list -commands`; do
|
|
|
05062e |
+ if $openssl_bin list -options "$i" | grep -q '^rand '; then
|
|
|
05062e |
+ cmds=" $i $cmds"
|
|
|
05062e |
+ fi
|
|
|
05062e |
+ done
|
|
|
05062e |
+
|
|
|
05062e |
+ case "$cmds" in
|
|
|
05062e |
+ *\ "$1"\ *)
|
|
|
05062e |
+ cmd="$1"; shift
|
|
|
05062e |
+ exec $openssl_bin "$cmd" -rand /dev/random "$@" ;;
|
|
|
05062e |
+ esac
|
|
|
05062e |
+
|
|
|
05062e |
+ exec $openssl_bin "$@"
|
|
|
05062e |
+)
|
|
|
05062e |
+EOM
|
|
|
05062e |
diff --git a/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/tests/file_missing.fail.sh b/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/tests/file_missing.fail.sh
|
|
|
05062e |
new file mode 100644
|
|
|
05062e |
index 0000000000..c1d526902c
|
|
|
05062e |
--- /dev/null
|
|
|
05062e |
+++ b/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/tests/file_missing.fail.sh
|
|
|
05062e |
@@ -0,0 +1,5 @@
|
|
|
05062e |
+#!/bin/bash
|
|
|
05062e |
+# platform = Red Hat Enterprise Linux 8
|
|
|
05062e |
+# profiles = xccdf_org.ssgproject.content_profile_ospp
|
|
|
05062e |
+
|
|
|
05062e |
+rm -f /etc/profile.d/cc-config.sh
|
|
|
05062e |
diff --git a/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/tests/file_modified.fail.sh b/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/tests/file_modified.fail.sh
|
|
|
05062e |
new file mode 100644
|
|
|
05062e |
index 0000000000..313d14a37f
|
|
|
05062e |
--- /dev/null
|
|
|
05062e |
+++ b/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/tests/file_modified.fail.sh
|
|
|
05062e |
@@ -0,0 +1,5 @@
|
|
|
05062e |
+#!/bin/bash
|
|
|
05062e |
+# platform = Red Hat Enterprise Linux 8
|
|
|
05062e |
+# profiles = xccdf_org.ssgproject.content_profile_ospp
|
|
|
05062e |
+
|
|
|
05062e |
+echo "wrong data" > /etc/profile.d/cc-config.sh
|
|
|
05062e |
|
|
|
05062e |
From 223194744d54d0400ab1d2981761166580a4f017 Mon Sep 17 00:00:00 2001
|
|
|
05062e |
From: Vojtech Polasek <vpolasek@redhat.com>
|
|
|
05062e |
Date: Wed, 29 Jan 2020 11:12:46 +0100
|
|
|
05062e |
Subject: [PATCH 4/6] remove blank=true from jinja macro as rhel6 and rhel7 do
|
|
|
05062e |
not support it
|
|
|
05062e |
|
|
|
05062e |
---
|
|
|
05062e |
.../crypto/openssl_use_strong_entropy/ansible/shared.yml | 2 +-
|
|
|
05062e |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
05062e |
|
|
|
05062e |
diff --git a/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/ansible/shared.yml b/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/ansible/shared.yml
|
|
|
05062e |
index 3ce26d6525..bdc530f9f5 100644
|
|
|
05062e |
--- a/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/ansible/shared.yml
|
|
|
05062e |
+++ b/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/ansible/shared.yml
|
|
|
05062e |
@@ -8,5 +8,5 @@
|
|
|
05062e |
copy:
|
|
|
05062e |
dest: /etc/profile.d/cc-config.sh
|
|
|
05062e |
content: |+
|
|
|
05062e |
- {{{ openssl_strong_entropy_config_file()|indent(8,blank=True) }}}
|
|
|
05062e |
+ {{{ openssl_strong_entropy_config_file()|indent(8) }}}
|
|
|
05062e |
|
|
|
05062e |
|
|
|
05062e |
From bd41dcc77b326ed4bc352fe15d083ca6b144855f Mon Sep 17 00:00:00 2001
|
|
|
05062e |
From: Vojtech Polasek <vpolasek@redhat.com>
|
|
|
05062e |
Date: Thu, 30 Jan 2020 14:25:31 +0100
|
|
|
05062e |
Subject: [PATCH 5/6] reword rationale, change file name
|
|
|
05062e |
|
|
|
05062e |
from cc-config.sh to openssl-rand.sh
|
|
|
05062e |
change title of oval
|
|
|
05062e |
---
|
|
|
05062e |
.../openssl_use_strong_entropy/ansible/shared.yml | 2 +-
|
|
|
05062e |
.../openssl_use_strong_entropy/bash/shared.sh | 2 +-
|
|
|
05062e |
.../openssl_use_strong_entropy/oval/shared.xml | 11 ++++-------
|
|
|
05062e |
.../crypto/openssl_use_strong_entropy/rule.yml | 14 +++++---------
|
|
|
05062e |
.../tests/correct.pass.sh | 2 +-
|
|
|
05062e |
.../tests/file_missing.fail.sh | 2 +-
|
|
|
05062e |
.../tests/file_modified.fail.sh | 2 +-
|
|
|
05062e |
7 files changed, 14 insertions(+), 21 deletions(-)
|
|
|
05062e |
|
|
|
05062e |
diff --git a/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/ansible/shared.yml b/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/ansible/shared.yml
|
|
|
05062e |
index bdc530f9f5..6ee232892d 100644
|
|
|
05062e |
--- a/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/ansible/shared.yml
|
|
|
05062e |
+++ b/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/ansible/shared.yml
|
|
|
05062e |
@@ -6,7 +6,7 @@
|
|
|
05062e |
|
|
|
05062e |
- name: "copy a file with shell snippet to configure openssl strong entropy"
|
|
|
05062e |
copy:
|
|
|
05062e |
- dest: /etc/profile.d/cc-config.sh
|
|
|
05062e |
+ dest: /etc/profile.d/openssl-rand.sh
|
|
|
05062e |
content: |+
|
|
|
05062e |
{{{ openssl_strong_entropy_config_file()|indent(8) }}}
|
|
|
05062e |
|
|
|
05062e |
diff --git a/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/bash/shared.sh b/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/bash/shared.sh
|
|
|
05062e |
index db5c331ce7..d8c9935005 100644
|
|
|
05062e |
--- a/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/bash/shared.sh
|
|
|
05062e |
+++ b/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/bash/shared.sh
|
|
|
05062e |
@@ -1,5 +1,5 @@
|
|
|
05062e |
# platform = Red Hat Enterprise Linux 8
|
|
|
05062e |
|
|
|
05062e |
-cat > /etc/profile.d/cc-config.sh <<- 'EOM'
|
|
|
05062e |
+cat > /etc/profile.d/openssl-rand.sh <<- 'EOM'
|
|
|
05062e |
{{{ openssl_strong_entropy_config_file() }}}
|
|
|
05062e |
EOM
|
|
|
05062e |
diff --git a/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/oval/shared.xml b/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/oval/shared.xml
|
|
|
05062e |
index b441b7ae6e..847754f36d 100644
|
|
|
05062e |
--- a/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/oval/shared.xml
|
|
|
05062e |
+++ b/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/oval/shared.xml
|
|
|
05062e |
@@ -1,11 +1,8 @@
|
|
|
05062e |
<def-group>
|
|
|
05062e |
<definition class="compliance" id="openssl_use_strong_entropy" version="1">
|
|
|
05062e |
<metadata>
|
|
|
05062e |
- <title>Configure Openssl to use strong entropy</title>
|
|
|
05062e |
- <affected family="unix">
|
|
|
05062e |
- <platform>Red Hat Enterprise Linux 8</platform>
|
|
|
05062e |
- <platform>multi_platform_fedora</platform>
|
|
|
05062e |
- </affected>
|
|
|
05062e |
+ <title>Configure OpenSSL to use strong entropy</title>
|
|
|
05062e |
+ {{{- oval_affected(products) }}}
|
|
|
05062e |
<description>OpenSSL should be configured to generate random data with strong entropy.</description>
|
|
|
05062e |
</metadata>
|
|
|
05062e |
<criteria>
|
|
|
05062e |
@@ -22,12 +19,12 @@
|
|
|
05062e |
</ind:filehash58_test>
|
|
|
05062e |
|
|
|
05062e |
<ind:filehash58_object id="object_openssl_strong_entropy" version="1">
|
|
|
05062e |
- <ind:filepath>/etc/profile.d/cc-config.sh</ind:filepath>
|
|
|
05062e |
+ <ind:filepath>/etc/profile.d/openssl-rand.sh</ind:filepath>
|
|
|
05062e |
<ind:hash_type>SHA-256</ind:hash_type>
|
|
|
05062e |
</ind:filehash58_object>
|
|
|
05062e |
|
|
|
05062e |
<ind:filehash58_state id="state_openssl_strong_entropy" version="1">
|
|
|
05062e |
- <ind:filepath>/etc/profile.d/cc-config.sh</ind:filepath>
|
|
|
05062e |
+ <ind:filepath>/etc/profile.d/openssl-rand.sh</ind:filepath>
|
|
|
05062e |
<ind:hash_type>SHA-256</ind:hash_type>
|
|
|
05062e |
<ind:hash>6488c757642cd493da09dd78ee27f039711a1ad79039900970553772fd2106af</ind:hash>
|
|
|
05062e |
</ind:filehash58_state>
|
|
|
05062e |
diff --git a/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/rule.yml b/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/rule.yml
|
|
|
05062e |
index 3b01da01af..dd82336532 100644
|
|
|
05062e |
--- a/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/rule.yml
|
|
|
05062e |
+++ b/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/rule.yml
|
|
|
05062e |
@@ -7,19 +7,15 @@ title: 'OpenSSL uses strong entropy source'
|
|
|
05062e |
|
|
|
05062e |
description: |-
|
|
|
05062e |
To set up an <tt>openssl</tt> wrapper that adds a <tt>-rand /dev/random</tt> option to the <tt>openssl</tt> invocation,
|
|
|
05062e |
- save the following shell snippet to the <tt>/etc/profile.d/cc-config.sh</tt>:
|
|
|
05062e |
+ save the following shell snippet to the <tt>/etc/profile.d/openssl-rand.sh</tt>:
|
|
|
05062e |
|
|
|
05062e |
{{{ openssl_strong_entropy_config_file() | indent(4) }}}
|
|
|
05062e |
|
|
|
05062e |
|
|
|
05062e |
rationale: |-
|
|
|
05062e |
- The <tt>openssl</tt> default configuration uses less robust entropy sources for seeding.
|
|
|
05062e |
- The referenced script is sourced to every login shell, and it transparently adds an option
|
|
|
05062e |
- that enforces strong entropy to every <tt>openssl</tt> invocation,
|
|
|
05062e |
- which makes <tt>openssl</tt> more secure by default.
|
|
|
05062e |
+ This rule ensures that <tt>openssl</tt> always uses SP800-90A compliant random number generator.
|
|
|
05062e |
|
|
|
05062e |
severity: medium
|
|
|
05062e |
-
|
|
|
05062e |
identifiers:
|
|
|
05062e |
cce@rhel8: 82721-2
|
|
|
05062e |
|
|
|
05062e |
@@ -27,12 +23,12 @@ references:
|
|
|
05062e |
ospp: FIA_AFL.1
|
|
|
05062e |
|
|
|
05062e |
ocil: |-
|
|
|
05062e |
- To determine whether the <tt>openssl</tt> wrapper is configured correcrlty,
|
|
|
05062e |
- make sure that the <tt>/etc/profile.d/cc-config.sh</tt> file contains contents
|
|
|
05062e |
+ To determine whether the <tt>openssl</tt> wrapper is configured correctly,
|
|
|
05062e |
+ make sure that the <tt>/etc/profile.d/openssl-rand.sh</tt> file contains contents
|
|
|
05062e |
that are included in the rule's description.
|
|
|
05062e |
|
|
|
05062e |
ocil_clause: |-
|
|
|
05062e |
- there is no <tt>/etc/profile.d/cc-config.sh</tt> file, or its contents don't match those in the description
|
|
|
05062e |
+ there is no <tt>/etc/profile.d/openssl-rand.sh</tt> file, or its contents don't match those in the description
|
|
|
05062e |
|
|
|
05062e |
warnings:
|
|
|
05062e |
- general: "This setting can cause problems on computers without the hardware random generator, because insufficient entropy blocks the program until enough entropy is available."
|
|
|
05062e |
diff --git a/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/tests/correct.pass.sh b/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/tests/correct.pass.sh
|
|
|
05062e |
index 0bffab3c81..d7f3ce8c87 100644
|
|
|
05062e |
--- a/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/tests/correct.pass.sh
|
|
|
05062e |
+++ b/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/tests/correct.pass.sh
|
|
|
05062e |
@@ -2,7 +2,7 @@
|
|
|
05062e |
# platform = Red Hat Enterprise Linux 8
|
|
|
05062e |
# profiles = xccdf_org.ssgproject.content_profile_ospp
|
|
|
05062e |
|
|
|
05062e |
-cat > /etc/profile.d/cc-config.sh <<- 'EOM'
|
|
|
05062e |
+cat > /etc/profile.d/openssl-rand.sh <<- 'EOM'
|
|
|
05062e |
# provide a default -rand /dev/random option to openssl commands that
|
|
|
05062e |
# support it
|
|
|
05062e |
|
|
|
05062e |
diff --git a/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/tests/file_missing.fail.sh b/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/tests/file_missing.fail.sh
|
|
|
05062e |
index c1d526902c..64a580da91 100644
|
|
|
05062e |
--- a/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/tests/file_missing.fail.sh
|
|
|
05062e |
+++ b/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/tests/file_missing.fail.sh
|
|
|
05062e |
@@ -2,4 +2,4 @@
|
|
|
05062e |
# platform = Red Hat Enterprise Linux 8
|
|
|
05062e |
# profiles = xccdf_org.ssgproject.content_profile_ospp
|
|
|
05062e |
|
|
|
05062e |
-rm -f /etc/profile.d/cc-config.sh
|
|
|
05062e |
+rm -f /etc/profile.d/openssl-rand.sh
|
|
|
05062e |
diff --git a/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/tests/file_modified.fail.sh b/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/tests/file_modified.fail.sh
|
|
|
05062e |
index 313d14a37f..2c812e874b 100644
|
|
|
05062e |
--- a/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/tests/file_modified.fail.sh
|
|
|
05062e |
+++ b/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/tests/file_modified.fail.sh
|
|
|
05062e |
@@ -2,4 +2,4 @@
|
|
|
05062e |
# platform = Red Hat Enterprise Linux 8
|
|
|
05062e |
# profiles = xccdf_org.ssgproject.content_profile_ospp
|
|
|
05062e |
|
|
|
05062e |
-echo "wrong data" > /etc/profile.d/cc-config.sh
|
|
|
05062e |
+echo "wrong data" > /etc/profile.d/openssl-rand.sh
|
|
|
05062e |
|
|
|
05062e |
From 679bd9cd08f962b3a88197817c199bd90a47f8d7 Mon Sep 17 00:00:00 2001
|
|
|
05062e |
From: =?UTF-8?q?Mat=C4=9Bj=20T=C3=BD=C4=8D?= <matyc@redhat.com>
|
|
|
05062e |
Date: Fri, 31 Jan 2020 16:34:48 +0100
|
|
|
05062e |
Subject: [PATCH 6/6] Rule and remediation wording improvements.
|
|
|
05062e |
|
|
|
05062e |
---
|
|
|
05062e |
.../openssl_use_strong_entropy/ansible/shared.yml | 3 +--
|
|
|
05062e |
.../crypto/openssl_use_strong_entropy/rule.yml | 15 ++++++++++-----
|
|
|
05062e |
2 files changed, 11 insertions(+), 7 deletions(-)
|
|
|
05062e |
|
|
|
05062e |
diff --git a/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/ansible/shared.yml b/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/ansible/shared.yml
|
|
|
05062e |
index 6ee232892d..25afb8e27f 100644
|
|
|
05062e |
--- a/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/ansible/shared.yml
|
|
|
05062e |
+++ b/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/ansible/shared.yml
|
|
|
05062e |
@@ -4,9 +4,8 @@
|
|
|
05062e |
# complexity = low
|
|
|
05062e |
# disruption = low
|
|
|
05062e |
|
|
|
05062e |
-- name: "copy a file with shell snippet to configure openssl strong entropy"
|
|
|
05062e |
+- name: "Put a file with shell wrapper to configure OpenSSL to always use strong entropy"
|
|
|
05062e |
copy:
|
|
|
05062e |
dest: /etc/profile.d/openssl-rand.sh
|
|
|
05062e |
content: |+
|
|
|
05062e |
{{{ openssl_strong_entropy_config_file()|indent(8) }}}
|
|
|
05062e |
-
|
|
|
05062e |
diff --git a/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/rule.yml b/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/rule.yml
|
|
|
05062e |
index dd82336532..8a958e93b0 100644
|
|
|
05062e |
--- a/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/rule.yml
|
|
|
05062e |
+++ b/linux_os/guide/system/software/integrity/crypto/openssl_use_strong_entropy/rule.yml
|
|
|
05062e |
@@ -6,14 +6,18 @@ prodtype: rhel8
|
|
|
05062e |
title: 'OpenSSL uses strong entropy source'
|
|
|
05062e |
|
|
|
05062e |
description: |-
|
|
|
05062e |
- To set up an <tt>openssl</tt> wrapper that adds a <tt>-rand /dev/random</tt> option to the <tt>openssl</tt> invocation,
|
|
|
05062e |
- save the following shell snippet to the <tt>/etc/profile.d/openssl-rand.sh</tt>:
|
|
|
05062e |
+ By default, OpenSSL doesn't always use a SP800-90A compliant random number generator.
|
|
|
05062e |
+ A way to configure OpenSSL to always use a strong source is to setup a wrapper that
|
|
|
05062e |
+ defines a shell function that shadows the actual <tt>openssl</tt> binary,
|
|
|
05062e |
+ and that ensures that the <tt>-rand /dev/random</tt> option is added to every <tt>openssl</tt> invocation.
|
|
|
05062e |
+
|
|
|
05062e |
+ To do so, place the following shell snippet exactly as-is to <tt>/etc/profile.d/openssl-rand.sh</tt>:
|
|
|
05062e |
|
|
|
05062e |
{{{ openssl_strong_entropy_config_file() | indent(4) }}}
|
|
|
05062e |
|
|
|
05062e |
|
|
|
05062e |
rationale: |-
|
|
|
05062e |
- This rule ensures that <tt>openssl</tt> always uses SP800-90A compliant random number generator.
|
|
|
05062e |
+ This rule ensures that <tt>openssl</tt> invocations always uses SP800-90A compliant random number generator as a default behavior.
|
|
|
05062e |
|
|
|
05062e |
severity: medium
|
|
|
05062e |
identifiers:
|
|
|
05062e |
@@ -23,8 +27,9 @@ references:
|
|
|
05062e |
ospp: FIA_AFL.1
|
|
|
05062e |
|
|
|
05062e |
ocil: |-
|
|
|
05062e |
- To determine whether the <tt>openssl</tt> wrapper is configured correctly,
|
|
|
05062e |
- make sure that the <tt>/etc/profile.d/openssl-rand.sh</tt> file contains contents
|
|
|
05062e |
+ To determine whether OpenSSL is wrapped by a shell function that ensures that every invocation
|
|
|
05062e |
+ uses a SP800-90A compliant entropy source,
|
|
|
05062e |
+ make sure that the <tt>/etc/profile.d/openssl-rand.sh</tt> file contents exactly match those
|
|
|
05062e |
that are included in the rule's description.
|
|
|
05062e |
|
|
|
05062e |
ocil_clause: |-
|