view modules/apache/manifests/mod/ssl.pp @ 76:a11219498f19 puppet-3.6

Do it properly and put a path in our cron job
author IBBoard <dev@ibboard.co.uk>
date Mon, 26 Oct 2015 08:46:22 +0000
parents 37675581a273
children 675c1cc61eaf
line wrap: on
line source

class apache::mod::ssl (
  $ssl_compression        = false,
  $ssl_options            = [ 'StdEnvVars' ],
  $ssl_cipher             = 'HIGH:MEDIUM:!aNULL:!MD5',
  $ssl_protocol           = [ 'all', '-SSLv2', '-SSLv3' ],
  $ssl_pass_phrase_dialog = 'builtin',
  $ssl_random_seed_bytes  = '512',
  $apache_version         = $::apache::apache_version,
  $package_name           = undef,
) {
  $session_cache = $::osfamily ? {
    'debian'  => "\${APACHE_RUN_DIR}/ssl_scache(512000)",
    'redhat'  => '/var/cache/mod_ssl/scache(512000)',
    'freebsd' => '/var/run/ssl_scache(512000)',
  }

  case $::osfamily {
    'debian': {
      if versioncmp($apache_version, '2.4') >= 0 {
        $ssl_mutex = 'default'
      } elsif $::operatingsystem == 'Ubuntu' and $::operatingsystemrelease == '10.04' {
        $ssl_mutex = 'file:/var/run/apache2/ssl_mutex'
      } else {
        $ssl_mutex = "file:\${APACHE_RUN_DIR}/ssl_mutex"
      }
    }
    'redhat': {
      $ssl_mutex = 'default'
    }
    'freebsd': {
      $ssl_mutex = 'default'
    }
    default: {
      fail("Unsupported osfamily ${::osfamily}")
    }
  }

  ::apache::mod { 'ssl':
    package => $package_name,
  }

  if versioncmp($apache_version, '2.4') >= 0 {
    ::apache::mod { 'socache_shmcb': }
  }

  # Template uses
  #
  # $ssl_compression
  # $ssl_options
  # $session_cache,
  # $ssl_mutex
  # $apache_version
  #
  file { 'ssl.conf':
    ensure  => file,
    path    => "${::apache::mod_dir}/ssl.conf",
    content => template('apache/mod/ssl.conf.erb'),
    require => Exec["mkdir ${::apache::mod_dir}"],
    before  => File[$::apache::mod_dir],
    notify  => Class['apache::service'],
  }
}