* [ptxdist] [PATCH] rng-tools: new package for rng-tools (rngd) version 5
@ 2014-10-26 17:02 Andreas Pretzsch
2014-11-13 16:52 ` Michael Olbrich
0 siblings, 1 reply; 3+ messages in thread
From: Andreas Pretzsch @ 2014-10-26 17:02 UTC (permalink / raw)
To: ptxdist
random number generator daemon - seed kernel random from hwrng
This daemon feeds data from a random number generator to the kernel's
random number entropy pool, after first checking the data to ensure
that it is properly random.
By default, a hardware rng at /dev/hwrng is used as entropy source.
This daemon is part of the rng-tools, which can be found at
http://sourceforge.net/projects/gkernel/
git://git.kernel.org/pub/scm/utils/kernel/rng-tools/rng-tools.git
Signed-off-by: Andreas Pretzsch <apr@cn-eng.de>
---
Start script is kept as simple as possible, as this one runs rather
early and does not need much.
The link default of "S00" in rc.d is intentional. rc-once is S01 by
default and triggers things like ssh key generation. So while in
other cases I would have set rngd to something around S10, it has to
squeeze in before rc-once. As there are no udev depends (the other
S00), being a kernel provided device, this should be ok.
Placing the daemon in /sbin also follows this fact, beside its
very system-near function.
generic/etc/init.d/rngd | 40 +++++++++++++++++++++++++++++++++
rules/rng-tools-bbinit.in | 10 +++++++++
rules/rng-tools.in | 23 +++++++++++++++++++
rules/rng-tools.make | 57 +++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 130 insertions(+)
create mode 100644 generic/etc/init.d/rngd
create mode 100644 rules/rng-tools-bbinit.in
create mode 100644 rules/rng-tools.in
create mode 100644 rules/rng-tools.make
diff --git a/generic/etc/init.d/rngd b/generic/etc/init.d/rngd
new file mode 100644
index 0000000..cdae9db
--- /dev/null
+++ b/generic/etc/init.d/rngd
@@ -0,0 +1,40 @@
+#!/bin/sh
+#
+# Start/stop rngd (random number generator daemon) from rng-tools
+#
+
+# defaults are sane, normally no need to override
+OPTIONS=
+
+# pid-file created from rngd by default
+PIDFILE=/var/run/rngd.pid
+
+case $1 in
+ start)
+ if [ -e $PIDFILE ]; then
+ echo "rngd already running (found $PIDFILE)"
+ else
+ echo "starting rngd"
+ /sbin/rngd $OPTIONS
+ fi
+ ;;
+
+ stop)
+ if [ -e $PIDFILE ]; then
+ echo "stopping rngd"
+ kill -s SIGTERM `cat $PIDFILE`
+ else
+ echo "rngd not running (no $PIDFILE)"
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ $0 start
+ ;;
+
+ *)
+ echo "Usage: ${0} {start|stop|restart}"
+ exit 1
+ ;;
+esac
diff --git a/rules/rng-tools-bbinit.in b/rules/rng-tools-bbinit.in
new file mode 100644
index 0000000..7cb74aa
--- /dev/null
+++ b/rules/rng-tools-bbinit.in
@@ -0,0 +1,10 @@
+## SECTION=initmethod_bbinit
+
+config RNG_TOOLS_BBINIT_LINK
+ string
+ depends on RNG_TOOLS_STARTSCRIPT
+ prompt "rng-tools"
+ default "S00rngd"
+ help
+ Order in start sequence.
+ Note: Start before rc-once to seed random before e.g. key creation.
diff --git a/rules/rng-tools.in b/rules/rng-tools.in
new file mode 100644
index 0000000..8282b93
--- /dev/null
+++ b/rules/rng-tools.in
@@ -0,0 +1,23 @@
+## SECTION=shell_and_console
+
+config RNG_TOOLS
+ tristate
+ prompt "rng-tools rngd"
+ help
+ random number generator daemon - seed kernel random from hwrng
+
+ This daemon feeds data from a random number generator to the kernel's
+ random number entropy pool, after first checking the data to ensure
+ that it is properly random.
+
+ By default, a hardware rng at /dev/hwrng is used as entropy source.
+
+ This daemon is part of the rng-tools, which can be found at
+ http://sourceforge.net/projects/gkernel/
+ git://git.kernel.org/pub/scm/utils/kernel/rng-tools/rng-tools.git
+
+config RNG_TOOLS_STARTSCRIPT
+ bool
+ default y
+ depends on RNG_TOOLS
+ prompt "install /etc/init.d/rngd"
diff --git a/rules/rng-tools.make b/rules/rng-tools.make
new file mode 100644
index 0000000..22f26fd
--- /dev/null
+++ b/rules/rng-tools.make
@@ -0,0 +1,57 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2014 by Andreas Pretzsch <apr@cn-eng.de>
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+PACKAGES-$(PTXCONF_RNG_TOOLS) += rng-tools
+
+RNG_TOOLS_VERSION := 5
+RNG_TOOLS_MD5 := 6726cdc6fae1f5122463f24ae980dd68
+RNG_TOOLS := rng-tools-$(RNG_TOOLS_VERSION)
+RNG_TOOLS_SUFFIX := tar.gz
+RNG_TOOLS_URL := $(call ptx/mirror, SF, gkernel/$(RNG_TOOLS).$(RNG_TOOLS_SUFFIX))
+RNG_TOOLS_SOURCE := $(SRCDIR)/$(RNG_TOOLS).$(RNG_TOOLS_SUFFIX)
+RNG_TOOLS_DIR := $(BUILDDIR)/$(RNG_TOOLS)
+RNG_TOOLS_LICENSE := GPLv2
+
+# ----------------------------------------------------------------------------
+# Prepare
+# ----------------------------------------------------------------------------
+
+RNG_TOOLS_CONF_TOOL := autoconf
+RNG_TOOLS_CONF_OPT := $(CROSS_AUTOCONF_ROOT)
+
+# ----------------------------------------------------------------------------
+# Target-Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/rng-tools.targetinstall:
+ @$(call targetinfo)
+
+ @$(call install_init, rng-tools)
+ @$(call install_fixup, rng-tools,PRIORITY,optional)
+ @$(call install_fixup, rng-tools,SECTION,base)
+ @$(call install_fixup, rng-tools,AUTHOR,"Andreas Pretzsch <apr@cn-eng.de>")
+ @$(call install_fixup, rng-tools,DESCRIPTION,"random number generator daemon - seed kernel random from hwrng")
+
+ @$(call install_copy, rng-tools, 0, 0, 0755, -, /sbin/rngd)
+ifdef PTXCONF_INITMETHOD_BBINIT
+ifdef PTXCONF_RNG_TOOLS_STARTSCRIPT
+ @$(call install_alternative, rng-tools, 0, 0, 0755, /etc/init.d/rngd)
+ifneq ($(call remove_quotes,$(PTXCONF_RNG_TOOLS_BBINIT_LINK)),)
+ @$(call install_link, rng-tools, \
+ ../init.d/rngd, \
+ /etc/rc.d/$(PTXCONF_RNG_TOOLS_BBINIT_LINK))
+endif
+endif
+endif
+ @$(call install_finish, rng-tools)
+
+ @$(call touch)
+
+# vim: syntax=make
--
2.1.1
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [ptxdist] [PATCH] rng-tools: new package for rng-tools (rngd) version 5
2014-10-26 17:02 [ptxdist] [PATCH] rng-tools: new package for rng-tools (rngd) version 5 Andreas Pretzsch
@ 2014-11-13 16:52 ` Michael Olbrich
2014-11-16 15:47 ` Andreas Pretzsch
0 siblings, 1 reply; 3+ messages in thread
From: Michael Olbrich @ 2014-11-13 16:52 UTC (permalink / raw)
To: ptxdist
On Sun, Oct 26, 2014 at 06:02:04PM +0100, Andreas Pretzsch wrote:
> random number generator daemon - seed kernel random from hwrng
>
> This daemon feeds data from a random number generator to the kernel's
> random number entropy pool, after first checking the data to ensure
> that it is properly random.
>
> By default, a hardware rng at /dev/hwrng is used as entropy source.
>
> This daemon is part of the rng-tools, which can be found at
> http://sourceforge.net/projects/gkernel/
> git://git.kernel.org/pub/scm/utils/kernel/rng-tools/rng-tools.git
>
> Signed-off-by: Andreas Pretzsch <apr@cn-eng.de>
Thanks, applied. I've changed the prefix to /usr. That's what Debian is
using and I didn't see a reason not to use that as well.
Michael
> ---
>
> Start script is kept as simple as possible, as this one runs rather
> early and does not need much.
>
> The link default of "S00" in rc.d is intentional. rc-once is S01 by
> default and triggers things like ssh key generation. So while in
> other cases I would have set rngd to something around S10, it has to
> squeeze in before rc-once. As there are no udev depends (the other
> S00), being a kernel provided device, this should be ok.
>
> Placing the daemon in /sbin also follows this fact, beside its
> very system-near function.
>
> generic/etc/init.d/rngd | 40 +++++++++++++++++++++++++++++++++
> rules/rng-tools-bbinit.in | 10 +++++++++
> rules/rng-tools.in | 23 +++++++++++++++++++
> rules/rng-tools.make | 57 +++++++++++++++++++++++++++++++++++++++++++++++
> 4 files changed, 130 insertions(+)
> create mode 100644 generic/etc/init.d/rngd
> create mode 100644 rules/rng-tools-bbinit.in
> create mode 100644 rules/rng-tools.in
> create mode 100644 rules/rng-tools.make
>
> diff --git a/generic/etc/init.d/rngd b/generic/etc/init.d/rngd
> new file mode 100644
> index 0000000..cdae9db
> --- /dev/null
> +++ b/generic/etc/init.d/rngd
> @@ -0,0 +1,40 @@
> +#!/bin/sh
> +#
> +# Start/stop rngd (random number generator daemon) from rng-tools
> +#
> +
> +# defaults are sane, normally no need to override
> +OPTIONS=
> +
> +# pid-file created from rngd by default
> +PIDFILE=/var/run/rngd.pid
> +
> +case $1 in
> + start)
> + if [ -e $PIDFILE ]; then
> + echo "rngd already running (found $PIDFILE)"
> + else
> + echo "starting rngd"
> + /sbin/rngd $OPTIONS
> + fi
> + ;;
> +
> + stop)
> + if [ -e $PIDFILE ]; then
> + echo "stopping rngd"
> + kill -s SIGTERM `cat $PIDFILE`
> + else
> + echo "rngd not running (no $PIDFILE)"
> + fi
> + ;;
> +
> + restart)
> + $0 stop
> + $0 start
> + ;;
> +
> + *)
> + echo "Usage: ${0} {start|stop|restart}"
> + exit 1
> + ;;
> +esac
> diff --git a/rules/rng-tools-bbinit.in b/rules/rng-tools-bbinit.in
> new file mode 100644
> index 0000000..7cb74aa
> --- /dev/null
> +++ b/rules/rng-tools-bbinit.in
> @@ -0,0 +1,10 @@
> +## SECTION=initmethod_bbinit
> +
> +config RNG_TOOLS_BBINIT_LINK
> + string
> + depends on RNG_TOOLS_STARTSCRIPT
> + prompt "rng-tools"
> + default "S00rngd"
> + help
> + Order in start sequence.
> + Note: Start before rc-once to seed random before e.g. key creation.
> diff --git a/rules/rng-tools.in b/rules/rng-tools.in
> new file mode 100644
> index 0000000..8282b93
> --- /dev/null
> +++ b/rules/rng-tools.in
> @@ -0,0 +1,23 @@
> +## SECTION=shell_and_console
> +
> +config RNG_TOOLS
> + tristate
> + prompt "rng-tools rngd"
> + help
> + random number generator daemon - seed kernel random from hwrng
> +
> + This daemon feeds data from a random number generator to the kernel's
> + random number entropy pool, after first checking the data to ensure
> + that it is properly random.
> +
> + By default, a hardware rng at /dev/hwrng is used as entropy source.
> +
> + This daemon is part of the rng-tools, which can be found at
> + http://sourceforge.net/projects/gkernel/
> + git://git.kernel.org/pub/scm/utils/kernel/rng-tools/rng-tools.git
> +
> +config RNG_TOOLS_STARTSCRIPT
> + bool
> + default y
> + depends on RNG_TOOLS
> + prompt "install /etc/init.d/rngd"
> diff --git a/rules/rng-tools.make b/rules/rng-tools.make
> new file mode 100644
> index 0000000..22f26fd
> --- /dev/null
> +++ b/rules/rng-tools.make
> @@ -0,0 +1,57 @@
> +# -*-makefile-*-
> +#
> +# Copyright (C) 2014 by Andreas Pretzsch <apr@cn-eng.de>
> +#
> +# See CREDITS for details about who has contributed to this project.
> +#
> +# For further information about the PTXdist project and license conditions
> +# see the README file.
> +#
> +
> +PACKAGES-$(PTXCONF_RNG_TOOLS) += rng-tools
> +
> +RNG_TOOLS_VERSION := 5
> +RNG_TOOLS_MD5 := 6726cdc6fae1f5122463f24ae980dd68
> +RNG_TOOLS := rng-tools-$(RNG_TOOLS_VERSION)
> +RNG_TOOLS_SUFFIX := tar.gz
> +RNG_TOOLS_URL := $(call ptx/mirror, SF, gkernel/$(RNG_TOOLS).$(RNG_TOOLS_SUFFIX))
> +RNG_TOOLS_SOURCE := $(SRCDIR)/$(RNG_TOOLS).$(RNG_TOOLS_SUFFIX)
> +RNG_TOOLS_DIR := $(BUILDDIR)/$(RNG_TOOLS)
> +RNG_TOOLS_LICENSE := GPLv2
> +
> +# ----------------------------------------------------------------------------
> +# Prepare
> +# ----------------------------------------------------------------------------
> +
> +RNG_TOOLS_CONF_TOOL := autoconf
> +RNG_TOOLS_CONF_OPT := $(CROSS_AUTOCONF_ROOT)
> +
> +# ----------------------------------------------------------------------------
> +# Target-Install
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/rng-tools.targetinstall:
> + @$(call targetinfo)
> +
> + @$(call install_init, rng-tools)
> + @$(call install_fixup, rng-tools,PRIORITY,optional)
> + @$(call install_fixup, rng-tools,SECTION,base)
> + @$(call install_fixup, rng-tools,AUTHOR,"Andreas Pretzsch <apr@cn-eng.de>")
> + @$(call install_fixup, rng-tools,DESCRIPTION,"random number generator daemon - seed kernel random from hwrng")
> +
> + @$(call install_copy, rng-tools, 0, 0, 0755, -, /sbin/rngd)
> +ifdef PTXCONF_INITMETHOD_BBINIT
> +ifdef PTXCONF_RNG_TOOLS_STARTSCRIPT
> + @$(call install_alternative, rng-tools, 0, 0, 0755, /etc/init.d/rngd)
> +ifneq ($(call remove_quotes,$(PTXCONF_RNG_TOOLS_BBINIT_LINK)),)
> + @$(call install_link, rng-tools, \
> + ../init.d/rngd, \
> + /etc/rc.d/$(PTXCONF_RNG_TOOLS_BBINIT_LINK))
> +endif
> +endif
> +endif
> + @$(call install_finish, rng-tools)
> +
> + @$(call touch)
> +
> +# vim: syntax=make
> --
> 2.1.1
>
>
> --
> ptxdist mailing list
> ptxdist@pengutronix.de
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [ptxdist] [PATCH] rng-tools: new package for rng-tools (rngd) version 5
2014-11-13 16:52 ` Michael Olbrich
@ 2014-11-16 15:47 ` Andreas Pretzsch
0 siblings, 0 replies; 3+ messages in thread
From: Andreas Pretzsch @ 2014-11-16 15:47 UTC (permalink / raw)
To: ptxdist
On Do, 2014-11-13 at 17:52 +0100, Michael Olbrich wrote:
> On Sun, Oct 26, 2014 at 06:02:04PM +0100, Andreas Pretzsch wrote:
> > random number generator daemon - seed kernel random from hwrng
> >
> > This daemon feeds data from a random number generator to the kernel's
> > random number entropy pool, after first checking the data to ensure
> > that it is properly random.
> >
> > By default, a hardware rng at /dev/hwrng is used as entropy source.
> >
> > This daemon is part of the rng-tools, which can be found at
> > http://sourceforge.net/projects/gkernel/
> > git://git.kernel.org/pub/scm/utils/kernel/rng-tools/rng-tools.git
> >
> > Signed-off-by: Andreas Pretzsch <apr@cn-eng.de>
>
> Thanks, applied. I've changed the prefix to /usr. That's what Debian is
> using and I didn't see a reason not to use that as well.
Fine with me. Choosing /sbin was more a traditionalist thing. And as
even Debian is going with /usr/sbin, lets welcome this new epoch ;-)
Thanks for applying,
Andreas
--
carpe noctem engineering
Ingenieurbuero fuer Hard- & Software-Entwicklung Andreas Pretzsch
Dipl.-Ing. (FH) Andreas Pretzsch Tel. +49-(0)731-5521572
Hahnengasse 3 Fax: +49-(0)731-5521571
89073 Ulm, Germany email: apr@cn-eng.de
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-11-16 15:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-26 17:02 [ptxdist] [PATCH] rng-tools: new package for rng-tools (rngd) version 5 Andreas Pretzsch
2014-11-13 16:52 ` Michael Olbrich
2014-11-16 15:47 ` Andreas Pretzsch
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox