121229
From 31116110ff0090324a568ce2aba6519a860d66b3 Mon Sep 17 00:00:00 2001
121229
From: =?UTF-8?q?Renaud=20M=C3=A9trich?= <rmetrich@redhat.com>
121229
Date: Thu, 11 Jul 2019 10:50:40 +0200
121229
Subject: [PATCH] rngd: new module running early during boot to help generating
121229
 entropy when system's default entropy sources are poor (e.g. use of SSD disks
121229
 or UEFI RNG not available)
121229
MIME-Version: 1.0
121229
Content-Type: text/plain; charset=UTF-8
121229
Content-Transfer-Encoding: 8bit
121229
121229
On systems with low entropy at boot, the boot can take up to several
121229
hours, specially when NBDE is used (e.g. clevis) which makes use of
121229
the random number generator.
121229
121229
Enabling rngd service at boot early, because dracut-initqueue runs,
121229
enables to initialize the random number generator in a couple of seconds
121229
instead of minutes or hours.
121229
121229
Signed-off-by: Renaud Métrich <rmetrich@redhat.com>
121229
(cherry picked from commit adee5b97bc5418b6e357342bb3be20568668aa55)
121229
121229
Resolves: #1726617
121229
---
121229
 modules.d/06rngd/module-setup.sh | 39 +++++++++++++++++++++++++++++++++++++++
121229
 modules.d/06rngd/rngd.service    |  7 +++++++
121229
 2 files changed, 46 insertions(+)
121229
121229
diff --git a/modules.d/06rngd/module-setup.sh b/modules.d/06rngd/module-setup.sh
121229
new file mode 100644
121229
index 00000000..43d5c2d3
121229
--- /dev/null
121229
+++ b/modules.d/06rngd/module-setup.sh
121229
@@ -0,0 +1,39 @@
121229
+#!/bin/bash
121229
+# vim: set tabstop=8 shiftwidth=4 softtabstop=4 expandtab smarttab colorcolumn=80:
121229
+#
121229
+# Copyright (c) 2019 Red Hat, Inc.
121229
+# Author: Renaud Métrich <rmetrich@redhat.com>
121229
+#
121229
+# This program is free software: you can redistribute it and/or modify
121229
+# it under the terms of the GNU General Public License as published by
121229
+# the Free Software Foundation, either version 3 of the License, or
121229
+# (at your option) any later version.
121229
+#
121229
+# This program is distributed in the hope that it will be useful,
121229
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
121229
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
121229
+# GNU General Public License for more details.
121229
+#
121229
+# You should have received a copy of the GNU General Public License
121229
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
121229
+#
121229
+
121229
+depends() {
121229
+    echo systemd
121229
+    return 0
121229
+}
121229
+
121229
+check() {
121229
+    # if there's no rngd binary, no go.
121229
+    require_binaries rngd || return 1
121229
+
121229
+    return 0
121229
+}
121229
+
121229
+install() {
121229
+    inst rngd
121229
+    inst_simple "${moddir}/rngd.service" "${systemdsystemunitdir}/rngd.service"
121229
+    mkdir -p "${initdir}${systemdsystemunitdir}/sysinit.target.wants"
121229
+    ln -rfs "${initdir}${systemdsystemunitdir}/rngd.service" \
121229
+        "${initdir}${systemdsystemunitdir}/sysinit.target.wants/rngd.service"
121229
+}
121229
diff --git a/modules.d/06rngd/rngd.service b/modules.d/06rngd/rngd.service
121229
new file mode 100644
121229
index 00000000..570fbedb
121229
--- /dev/null
121229
+++ b/modules.d/06rngd/rngd.service
121229
@@ -0,0 +1,7 @@
121229
+[Unit]
121229
+Description=Hardware RNG Entropy Gatherer Daemon
121229
+DefaultDependencies=no
121229
+Before=systemd-udevd.service
121229
+
121229
+[Service]
121229
+ExecStart=/usr/sbin/rngd -f
121229