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