Posts Tagged ‘#cl’

Raspberry Pi Entropy server

Thursday, August 23rd, 2012

The Raspberry Pi project is one of the more popular projects the Computer Lab is involved with at the moment and all the incoming freshers are getting one.

One of the things I have been working on as a Research Assistant in the Digital Technology Group is on improving the infrastructure we use for research and my current efforts include using puppet to automate the configuration of our servers.

We have a number of servers which are VMs and hence can be a little short of entropy. One solution to having a shortage of entropy is an ‘entropy key‘ which is a little USB device which uses reverse biased diodes to generate randomness and has a little ARM chip (ARM is something the CL is rather proud of) which does a pile of crypto and analysis to ensure that it is good randomness. As has been done before (with pretty graphs) this can then be fed to VMs providing them with the randomness they want.

My solution to the need for some physical hardware to host the entropy key was a Raspberry Pi because I don’t need very much compute power and dedicated hardware means that it is less likely to get randomly reinstalled. A rPi can be thought of as the hardware equivalent of a small VM.

Unboxed Raspberry Pi with entropy key

I got the rPi from Rob Mullins by taking a short walk down the corridor on the condition that there be photos. One of the interesting things about using rPis for servers is that the cost of the hardware is negligible in comparison with the cost of connecting that hardware to the network and configuring it.

The Raspberry Pi with entropy key temporarily installed in a wiring closet

The rPi is now happily serving entropy to various VMs from the back of a shelf in one of the racks in a server room (not the one shown, we had to move it elsewhere).

Initially it was serving entropy in the clear via the EGD protocol over TCP. Clearly this is rather bad as observable entropy doesn’t really gain you anything (and might lose you everything). Hence it was necessary to use crypto to protect the transport from the rPi to the VMs.
This is managed by the dtg::entropy, dtg::entropy::host and dtg::entropy::client classes which generate the relevant config for egd-linux and stunnel.

This generates an egd-client.conf which looks like this:

; This stunnel config is managed by Puppet.

sslVersion = TLSv1
client = yes

setuid = egd-client
setgid = egd-client
pid = /egd-client.pid
chroot = /var/lib/stunnel4/egd-client

socket = l:TCP_NODELAY=1
socket = r:TCP_NODELAY=1
TIMEOUTclose = 0

debug = 0
output = /egd-client.log

verify = 3

CAfile = /usr/local/share/ssl/cafile

[egd-client]
accept = 7777
connect = entropy.dtg.cl.cam.ac.uk:7776

And a host config like:

; This stunnel config is managed by Puppet.

sslVersion = TLSv1

setuid = egd-host
setgid = egd-host
pid = /egd-host.pid
chroot = /var/lib/stunnel4/egd-host

socket = l:TCP_NODELAY=1
socket = r:TCP_NODELAY=1
TIMEOUTclose = 0

debug = 0
output = /egd-host.log

cert = /root/puppet/ssl/stunnel.pem
key = /root/puppet/ssl/stunnel.pem
CAfile = /usr/local/share/ssl/cafile

[egd-host]
accept = 7776
connect = 777
cert = /root/puppet/ssl/stunnel.pem
key = /root/puppet/ssl/stunnel.pem
CAfile = /usr/local/share/ssl/cafile

Getting that right was somewhat tedious due to defaults not working well together.
openssl s_client -connect entropy.dtg.cl.cam.ac.uk:7776
and a python egd client were useful for debugging. In the version of debian in rasperian the stunnel binary points to an stunnel3 compatibility script around the actual stunnel4 binary which resulted in much confusion when trying to run stunnel manually.

Having sensible discussions

Monday, January 3rd, 2011

Recently I have been thinking quite a lot about how people who have different points of view on a particular issue can have a proper discussion about that issue. So often we don’t actually engage with each other or even really try to but instead go from the position “I know I am right and the other person is wrong” to the position “I know I am right and the other person is wrong because of X, Y and Z” but at the same time something similar is happening for the other person for possibly different Xs Ys and Zs.

In reality people don’t generally hold views which they consider to be wrong and don’t do things that they think are evil (at least not and then support them afterwards – I regularly do things that I think are wrong). So in a sensible discussion what we want to find out is what the underlying facts, assumptions and beliefs are and what the relative importance of each of those things. Then hopefully it will be possible to see how these fit together to form a worldview in which the opposite point of view is in fact the correct view.

Unfortunately this is frequently rather difficult partly because it is all to easy to reject things outright and so not actually examine these underlying issues and partly because all these things tend to be interconnected in a rather complex manner. So it may be necessary to talk about a very wide range of underlying issues which are all mutually dependant resulting in it taking a rather long time. Very few people will be prepared to put in that kind of time and even with those who are it is still difficult as there are fundamental restrictions on the number of hours in a day.

Recently I have been having sensible discussions with some of my Christian friends who are inclined to the ‘right’ while I myself generally consider myself inclined towards the ‘left’. In this situation it is possible to have really quite interesting discussions by virtue of the fact that we both already agree on a wide range of very important issues and have worldviews which are on a deep level very close indeed. At the same time outward political views can end up at opposite ends of the spectrum. It is also rather helpful that we already love each other a lot and so it is easier not to get angry or to consider them a bad person because of views that I might find objectionable because I already know that since they love all the people who are affected by implementations of policy based on those views they must have good reasons for them.

In this I have found that it is surprising how big a difference in policy subtle differences in the priority given to different underlying good principles can have. Having had the whole of Christmas to allow these thoughts to mature in the absence of such discussion I appear to have lost my recollection of good examples of this and since some of these thoughts stretch back to April or earlier that is not completely surprising.

So in summary: If both sides in a discussion are willing to put real effort into having a sensible discussion and looking carefully at the underlying issues then it is possible to get rather more out of if than one might expect. (This is also far more interesting than discussing the weather etc. and I should put more effort into making it happen).

Relatedly I had a ‘fairly’ sensible discussion about religion on #cl (It didn’t descend to a flamewar though IRC isn’t really a good place for going into detail on complex issues) this must be some kind of miracle. :-)