Resolves: bz 1490632
This commit is contained in:
parent
ba78ef966c
commit
7a42c5f5a4
10
check-rng-entropy
Executable file
10
check-rng-entropy
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
rngd --list > /dev/null 2>&1
|
||||
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
systemctl enable rngd.service
|
||||
systemctl start rngd.service
|
||||
fi
|
||||
|
||||
exit 0
|
||||
17
entropy-check.service
Normal file
17
entropy-check.service
Normal file
@ -0,0 +1,17 @@
|
||||
[Unit]
|
||||
Description=Checker to look for entropy sources and enable rngd
|
||||
DefaultDependencies=no
|
||||
Conflicts=shutdown.target
|
||||
After=systemd-remount-fs.service
|
||||
Before=systemd-sysusers.service sysinit.target shutdown.target
|
||||
ConditionFirstBoot=yes
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/bin/check-rng-entropy
|
||||
StandardOutput=null
|
||||
StandardError=null
|
||||
|
||||
[Install]
|
||||
WantedBy=sysinit.target
|
||||
|
||||
@ -4,12 +4,14 @@
|
||||
Summary: Random number generator related utilities
|
||||
Name: rng-tools
|
||||
Version: 6.1
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
Group: System Environment/Base
|
||||
License: GPLv2+
|
||||
URL: https://github.com/nhorman/rng-tools
|
||||
Source0: https://github.com/nhorman/rng-tools/archive/rng-tools-%{version}.tar.gz
|
||||
Source1: rngd.service
|
||||
Source2: check-rng-entropy
|
||||
Source3: entropy-check.service
|
||||
|
||||
# https://sourceforge.net/p/gkernel/patches/111/
|
||||
|
||||
@ -42,15 +44,19 @@ Hardware random number generation tools.
|
||||
|
||||
# install systemd unit file
|
||||
install -Dt %{buildroot}%{_unitdir} -m0644 %{SOURCE1}
|
||||
|
||||
install -Dt %{buildroot}%{_unitdir} -m0644 %{SOURCE2}
|
||||
install -Dt %{buildroot}%{_bindir} -m0755 %{SOURCE3}
|
||||
%post
|
||||
%systemd_post rngd.service
|
||||
%systemd_post entropy-check.service
|
||||
|
||||
%preun
|
||||
%systemd_preun rngd.service
|
||||
%systemd_preun entropy-check.service
|
||||
|
||||
%postun
|
||||
%systemd_postun_with_restart rngd.service
|
||||
%systemd_postun_with_restart entropy-check.service
|
||||
|
||||
%files
|
||||
%{!?_licensedir:%global license %%doc}
|
||||
@ -63,6 +69,9 @@ install -Dt %{buildroot}%{_unitdir} -m0644 %{SOURCE1}
|
||||
%attr(0644,root,root) %{_unitdir}/rngd.service
|
||||
|
||||
%changelog
|
||||
* Fri Oct 26 2017 Neil Horman <nhorman@redhat.com> - 6.1-2
|
||||
- Conditionally enable rngd on entropy src availability (bz 1490632)
|
||||
|
||||
* Tue Oct 10 2017 Neil Horman <nhorman@redhat.com> - 6.1-1
|
||||
- update to latest upstream
|
||||
|
||||
|
||||
21
rngd-exit-code-for-list.patch
Normal file
21
rngd-exit-code-for-list.patch
Normal file
@ -0,0 +1,21 @@
|
||||
diff -up ./rngd.c.orig ./rngd.c
|
||||
--- ./rngd.c.orig 2017-10-27 14:18:52.617286574 -0400
|
||||
+++ ./rngd.c 2017-10-27 14:19:34.189456107 -0400
|
||||
@@ -423,12 +423,15 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (arguments->list) {
|
||||
+ int rc = 1;
|
||||
msg_squash = false;
|
||||
printf("Available entropy sources:\n");
|
||||
for (i=0; i < ENT_MAX; i++)
|
||||
- if (entropy_sources[i].init && entropy_sources[i].disabled == false)
|
||||
+ if (entropy_sources[i].init && entropy_sources[i].disabled == false) {
|
||||
+ rc = 0;
|
||||
printf("%d: %s\n", i, entropy_sources[i].rng_name);
|
||||
- return 1;
|
||||
+ }
|
||||
+ return rc;
|
||||
}
|
||||
|
||||
if (!ent_sources) {
|
||||
@ -3,7 +3,6 @@ Description=Hardware RNG Entropy Gatherer Daemon
|
||||
|
||||
[Service]
|
||||
ExecStart=/sbin/rngd -f
|
||||
SuccessExitStatus=66
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
Loading…
Reference in New Issue
Block a user