[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: random translator



Hi!

On Fri, 2011-08-19 at 02:00:57 +0200, Samuel Thibault wrote:
> There are couple other solutions on
> 
> https://www.gnu.org/software/hurd/hurd/translator/random.html
> 
> and notably Marcus' random translator, which does already work, and
> avoids the perl dependency completely since it's pure C. It would also
> avoid a separate daemon, which looks like a good thing to me.
> 
> The advantage of egd is that it already has some rules to gather entropy
> from e.g. vmstat, w, df, etc. But that could easily be added to Marcus'
> random translator later.
> 
> What do people think about it?  I've attached a tested migration patch.

As I mentioned on IRC some time ago, it might make more sense to use
alternatives to manage the /dev/{u,}random devices? It would allow to
easily use Marcus' random implementation or the egd based one. If the
random-egd got a higher alternative priority then it would switch to
it automatically when installed. Something to also consider is if we'd
want to expose the /dev/random-hurd and /dev/random-egd translators
under /dev or if they should be placed somewhere else.

I'm attaching a patch I cooked some time ago, but which needs actual
upgrade testing. A similar patch would be needed for random-egd.

thanks,
guillem
diff --git a/debian/hurd.postinst b/debian/hurd.postinst
index 4c3fc2c..24eda10 100644
--- a/debian/hurd.postinst
+++ b/debian/hurd.postinst
@@ -64,5 +64,7 @@ if [ "$1" = configure ] && [ "$2" ]; then
 		settrans -g /dev/urandom
 	fi
 	/usr/lib/hurd/setup-translators -K
+	update-alternative --install /dev/random random /dev/random-hurd 10 \
+	                   --slave /dev/urandom urandom /dev/urandom-hurd
 fi
 
diff --git a/debian/hurd.prerm b/debian/hurd.prerm
new file mode 100644
index 0000000..517c420
--- /dev/null
+++ b/debian/hurd.prerm
@@ -0,0 +1,8 @@
+#!/bin/sh
+set -e
+
+if [ "$1" = remove ]; then
+	update-alternatives --remove random /dev/random-hurd
+fi
+
+#DEBHELPER#
diff --git a/debian/local/setup-translators b/debian/local/setup-translators
index f568465..3ce0f99 100755
--- a/debian/local/setup-translators
+++ b/debian/local/setup-translators
@@ -145,8 +145,8 @@ else
 	md ptyq
 	md lprX 0123
 	md comX 0123
-	st random 'random --seed-file /var/run/random-seed --fast' random
-	st urandom 'random --seed-file /var/run/random-seed --fast' urandom
+	st random-hurd 'random --seed-file /var/run/random-seed --fast' random
+	st urandom-hurd 'random --seed-file /var/run/random-seed --fast' urandom
 fi
 
 st kbd 'symlink cons/kbd' kbd

Reply to: