From 49d6b734a816b9ef1c92b034c2850bff24d68e37 Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 24 Sep 2010 13:02:37 +0200 Subject: init release of ekeyd module --- lib/facter/ekeyd.rb | 7 +++++++ manifests/base.pp | 18 ++++++++++++++++++ manifests/init.pp | 7 +++++++ 3 files changed, 32 insertions(+) create mode 100644 lib/facter/ekeyd.rb create mode 100644 manifests/base.pp create mode 100644 manifests/init.pp diff --git a/lib/facter/ekeyd.rb b/lib/facter/ekeyd.rb new file mode 100644 index 0000000..a201e7f --- /dev/null +++ b/lib/facter/ekeyd.rb @@ -0,0 +1,7 @@ +Facter.add('ekeyd_key_present') do + confine :kernel => %w{Linux} + setcode do + FileTest.exists?('/proc/bus/usb/devices') && \ + !(File.read('/proc/bus/usb/devices') =~ /Product=Entropy Key/).nil? + end +end diff --git a/manifests/base.pp b/manifests/base.pp new file mode 100644 index 0000000..e4d572d --- /dev/null +++ b/manifests/base.pp @@ -0,0 +1,18 @@ +class ekeyd::base { + + package{'ekeyd': + ensure => installed, + } + + service{'ekeyd': + ensure => running, + enable => true, + require => Package['ekeyd'], + } + + exec{'configure_ekey_key': + command => "ekey-rekey `ekeydctl list | grep \"/dev/entropykey\" | awk -F, '{ print \$5}'` ${ekey_masterkey}", + unless => "ekeydctl list | grep -q 'Running OK'", + require => Service['ekeyd'], + } +} diff --git a/manifests/init.pp b/manifests/init.pp new file mode 100644 index 0000000..7ccad90 --- /dev/null +++ b/manifests/init.pp @@ -0,0 +1,7 @@ +class ekeyd { + + if $ekey_key_present != 'true' { fail("Can't find an ekey key plugged into usb on ${fqdn}") } + if !$ekey_masterkey { fail("You need to define \$ekey_masterkey for ${fqdn}") } + + include ekeyd::base +} -- cgit v1.2.3