# jdk7::instal7 # # 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 # define jdk7::install7 ( $version = '7u51', $fullVersion = 'jdk1.7.0_51', $javaHomes = '/usr/java', $x64 = true, $alternativesPriority = 17065, $downloadDir = '/install', $cryptographyExtensionFile = undef, $urandomJavaFix = true, $rsakeySizeFix = false, # set true for weblogic 12.1.1 and jdk 1.7 > version 40 $sourcePath = "puppet:///modules/jdk7/", ) { if ( $x64 == true ) { $type = 'x64' } else { $type = 'i586' } case $::kernel { 'Linux': { $installVersion = 'linux' $installExtension = '.tar.gz' $path = '/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:' $user = 'root' $group = 'root' } default: { fail("Unrecognized operating system ${::kernel}, please use it on a Linux host") } } $jdkfile = "jdk-${version}-${installVersion}-${type}${installExtension}" # set the defaults for Exec Exec { path => $path, user => $user, } # set the defaults for File File { replace => false, owner => $user, group => $group, mode => 0777, } exec { "create ${$downloadDir} directory": command => "mkdir -p ${$downloadDir}", unless => "test -d ${$downloadDir}", } # check install folder if !defined(File[$downloadDir]) { file { $downloadDir: ensure => directory, require => Exec["create ${$downloadDir} directory"], } } # download jdk to client file { "${downloadDir}/${jdkfile}": ensure => file, source => "${sourcePath}/${jdkfile}", require => File[$downloadDir], } if ( $cryptographyExtensionFile != undef ) { file { "${downloadDir}/${cryptographyExtensionFile}": ensure => file, source => "${sourcePath}/${cryptographyExtensionFile}", require => File[$downloadDir], before => File["${downloadDir}/${jdkfile}"], } } # install on client jdk7::javaexec { "jdkexec ${title} ${version}": path => $downloadDir, fullVersion => $fullVersion, javaHomes => $javaHomes, jdkfile => $jdkfile, cryptographyExtensionFile => $cryptographyExtensionFile, alternativesPriority => $alternativesPriority, user => $user, group => $group, require => File["${downloadDir}/${jdkfile}"], } if ($urandomJavaFix == true) { exec { "set urandom ${fullVersion}": command => "sed -i -e's/securerandom.source=file:\\/dev\\/urandom/securerandom.source=file:\\/dev\\/.\\/urandom/g' ${javaHomes}/${fullVersion}/jre/lib/security/java.security", unless => "grep '^securerandom.source=file:/dev/./urandom' ${javaHomes}/${fullVersion}/jre/lib/security/java.security", require => Javaexec["jdkexec ${title} ${version}"], } } if ($rsakeySizeFix == true) { exec { "sleep 3 sec for urandomJavaFix ${fullVersion}": command => "/bin/sleep 3", unless => "grep 'RSA keySize < 512' ${javaHomes}/${fullVersion}/jre/lib/security/java.security", require => Javaexec["jdkexec ${title} ${version}"], } exec { "set RSA keySize ${fullVersion}": command => "sed -i -e's/RSA keySize < 1024/RSA keySize < 512/g' ${javaHomes}/${fullVersion}/jre/lib/security/java.security", unless => "grep 'RSA keySize < 512' ${javaHomes}/${fullVersion}/jre/lib/security/java.security", subscribe => Exec["sleep 3 sec for urandomJavaFix ${fullVersion}"], refreshonly => true, } } }