Tuesday, June 21, 2011

Entropy Key to work with Fedora

If you don't know what this device is, it is a small USB key that is inexpensive TRNG (True Random Number Generator) device. If you decide to get one of these things and you are not computer, programmer, linux savvy you may have a little trouble getting it up and running without some clear guidance, so I have put together some reproducible steps for installing:

1) I didn't bother trying the provided RPM packages since none were packages specific to fedora

2) Lua is already installed on most systems but you will also need lua-socket, an add on for lua that provides sockets support. You can't just install the lua-socket from yum- you have to make small changes to lua-socket and install manually. The changes required will (a) install lua to the correct place for fedora, (b) add configuration for UNIX domain sockets for lua, which are not enabled in the fedora package.

I did a google search to find the changes I needed (google: lua socket unix diff). The result I found was for FreeBSD but it works the same:
[1] on freebsd-8 (CURRENT):
0  # hg diff
diff --git a/config b/config
--- a/config
+++ b/config
@@ -51,7 +51,7 @@
# Compiler and linker settings
# for Linux
CFLAGS= $(LUAINC) $(DEF) -pedantic -Wall -O2 -fpic
LDFLAGS=-O -shared -fpic
diff --git a/makefile b/makefile
--- a/makefile
+++ b/makefile
@@ -10,6 +10,8 @@

all clean:
      cd src; $(MAKE) $@
@@ -45,6 +47,8 @@
      cd src; mkdir -p $(INSTALL_MIME_LIB)
      cd src; $(INSTALL_EXEC) $(MIME_SO) $(INSTALL_MIME_LIB)/core.$(EXT)
+       cd src; mkdir -p $(INSTALL_UNIX_LIB)

# End of makefile
diff --git a/src/makefile b/src/makefile
--- a/src/makefile
+++ b/src/makefile
@@ -47,7 +47,7 @@
      usocket.o \

-all: $(SOCKET_SO) $(MIME_SO)
+all: $(SOCKET_SO) $(MIME_SO) ${UNIX_SO}

      $(LD) $(LDFLAGS) -o $@ $(SOCKET_OBJS)

3) Install the patched lua-socket (command: make && make install )

4) Follow the rest of the original instructions for generating a key and running the provided daemon.

To test that your key is working you can run one of the stat tools or just cat /dev/random..

No comments: