# wls::urandomfix # # On Linux low entropy can cause certain operations to be very slow. # Encryption operations need entropy to ensure randomness. Entropy is # generated by the OS when you use the keyboard, the mouse or the disk. # # If an encryption operation is missing entropy it will wait until # enough is generated. # # three options # use rngd service (this class) # set java.security in JDK ( jre/lib/security ) # set -Djava.security.egd=file:/dev/./urandom param # class wls::urandomfix() { case $operatingsystem { CentOS, RedHat, OracleLinux, Ubuntu, Debian, SLES: { $path = '/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:' } default: { fail("Unrecognized operating system") } } package { "rng-tools": ensure => present, } case $operatingsystem { CentOS, RedHat, OracleLinux: { exec { "set urandom /etc/sysconfig/rngd": command => "sed -i -e's/EXTRAOPTIONS=\"\"/EXTRAOPTIONS=\"-r \\/dev\\/urandom -o \\/dev\\/random -b\"/g' /etc/sysconfig/rngd", unless => "/bin/grep '^EXTRAOPTIONS=\"-r /dev/urandom -o /dev/random -b\"' /etc/sysconfig/rngd", require => Package["rng-tools"], user => 'root', path => $path, } service { "start rngd service": name => "rngd", enable => true, ensure => true, require => Exec ["set urandom /etc/sysconfig/rngd"], } exec { "chkconfig rngd": command => "chkconfig --add rngd", require => Service["start rngd service"], user => 'root', unless => "chkconfig | /bin/grep 'rngd'", path => $path, } } Ubuntu, Debian, SLES:{ exec { "set urandom /etc/default/rng-tools": command => "sed -i -e's/#HRNGDEVICE=\\/dev\\/null/HRNGDEVICE=\\/dev\\/urandom/g' /etc/default/rng-tools", unless => "/bin/grep '^HRNGDEVICE=/dev/urandom' /etc/default/rng-tools", require => Package["rng-tools"], user => 'root', path => $path, } service { "start rng-tools service": name => "rng-tools", enable => true, ensure => true, require => Exec ["set urandom /etc/default/rng-tools"], } } } }