xen: support both entropy from dom0 and our weak fallback#8
Conversation
There was a problem hiding this comment.
doesn't this need to fallback to weak if the xentropyd isnt listening?
There was a problem hiding this comment.
That's why I thought I'd better phrase is as an RFC-- it seems to me that
if you really care about generating good keys, you would rather fail/block
than fall back, otherwise if xentropyd falls over you might not notice the
problem until it's too late. However there are lots of cases where you
won't have a xentropyd (like AWS) where there's no real choice.
Perhaps the app writer should choose some kind of policy?
- strict
- dontcare
- tryabitboforegivingup
?
On Sun, Dec 21, 2014 at 9:06 PM, Anil Madhavapeddy <notifications@github.com
wrote:
In xen/entropy_xen.ml
#8 (diff)
:let connect () =
- Random.self_init ();
- print_endline "Entropy_xen_weak: using a weak entropy source seeded only from time.";
- return (`Ok { handler = None })
- Printf.printf "Entropy_xen: attempting to connect to Xen entropy source %s\n%!" console_name;
- Console_xen.connect console_name
doesn't this need to fallback to weak if the xentropyd isnt listening?
—
Reply to this email directly or view it on GitHub
https://github.com/mirage/mirage-entropy/pull/8/files#r22150306.
Dave Scott
There was a problem hiding this comment.
I think the default 'weak' isn't that weak though -- we can implement a decent subset of what Amazon VMs already do to mix in entropy -- inter-ring packet times, etc.
There was a problem hiding this comment.
+1 for letting the app writer specify a policy, and make the default strict. baking in a weaker default for something that could be as critical as this seems a bad idea. cf what i understood were a number of the issues with the client api to openssl
|
I get: (where XXX is random stuff I can't paste into GitHub comments) |
|
Hm, 2 possibilities spring to mind:
|
|
I don't really see how it's supposed to work. It calls |
|
ha, yes there is that too :) |
We now support 2 types of Xen entropy device:
`FromHost: connect to an entropy server running over a console channel.
This will require running xentropyd in dom0
`Weak: use Random.self_init which gets entropy only from time.
This is not suitable for production use.
In future we will hopefully support gathering entropy from system timing
events and from hardware extensions like RDSEED.
Limitations:
- we read exactly one block of entropy data. Should we read as much
as the backend will offer? Note the xentropyd implementation has a
rate limiter to avoid starving dom0.
Signed-off-by: David Scott <dave.scott@citrix.com>
It's now a fatal error to fail to read the host entropy device, if one has been configured. Signed-off-by: David Scott <dave.scott@eu.citrix.com>
This allows us to read the exact number of bytes that we want, and cache any extra we might receive (since the backend xentropyd might be more generous than we need). This also allows us to read the handshake message even if it is returned in the same buffer as the first chunk of entropy. Signed-off-by: David Scott <dave.scott@eu.citrix.com>
The Unix version is unfunctorised and uses Lwt_engine. Unfortunately
we don't have Lwt_engine ("Lwt unix main loop engine") so we fall
back to refeeding unconditionally every <period> (600s).
Signed-off-by: David Scott <dave.scott@eu.citrix.com>
|
OK, the buffered reader should fix the (embarrassing) problem with the handshake message. |
|
I've tested the following via mirage-skeleton/entropy:
|
|
I'm not a fan of retaining a distinction between Thanks! |
|
Thanks -- hopefully we can remove the On Wed, Feb 4, 2015 at 1:49 AM, David Kaloper notifications@github.com
Dave Scott |
Support 2 kinds of entropy source:
FromHost: we receive entropy over a console from domain 0 (or whichever other privileged domain has the entropy). This should be strong, but it requires an entropy server i.e.xentropydWeak: we useRandom.self_initand get entropy from the clock. This is weak but will work anywhere.In future we should support
RDSEED#9 and possibly entropy from interrupt timing #10Depends on [mirage/mirage#359]
Signed-off-by: David Scott dave.scott@citrix.com