diff --git a/manifests/config.pp b/manifests/config.pp index 7d615f3..006bc91 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -1,58 +1,58 @@ # == Class hitch::config # # This class is called from hitch for service config. # class hitch::config { validate_absolute_path($::hitch::config_root) validate_absolute_path($::hitch::config_file) validate_absolute_path($::hitch::dhparams_file) - if $::hitch::dhparams { - validate_re($::hitch::dhparams, 'BEGIN DH PARAMETERS') + if $::hitch::dhparams_content { + validate_re($::hitch::dhparams_content, 'BEGIN DH PARAMETERS') } file { $::hitch::config_root: ensure => directory, recurse => true, purge => $::hitch::purge_config_root, owner => $::hitch::file_owner, group => $::hitch::group, mode => '0750', } concat { $::hitch::config_file: ensure => present, } - if $::hitch::dhparams { + if $::hitch::dhparams_content { file { $::hitch::dhparams_file: ensure => present, owner => $::hitch::file_owner, group => $::hitch::group, mode => '0640', - content => $::hitch::dhparams, + content => $::hitch::dhparams_content, } } else { file { $::hitch::dhparams_file: ensure => present, owner => $::hitch::file_owner, group => $::hitch::group, mode => '0640', } -> exec { "${title} generate dhparams": path => '/usr/local/bin:/usr/bin:/bin', command => "openssl dhparam 2048 -out ${::hitch::dhparams_file}", creates => $::hitch::dhparams_file, } } concat::fragment { "${title} config": content => template('hitch/hitch.conf.erb'), target => $::hitch::config_file, } create_resources('hitch::domain', $::hitch::domains) } diff --git a/manifests/init.pp b/manifests/init.pp index 0629ac8..bec37a2 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,42 +1,42 @@ # Class: hitch # =========================== # # Full description of class hitch here. # # Parameters # ---------- # # * `package_name` # Package name for installing hitch # # * `service_name` # Service name for the hitch service # # * `config_file` # Configuration file. Default: /etc/hitch/hitch.conf # # * `config_root` # Configuration root directory. Default: /etc/hitch/ class hitch ( $package_name = $::hitch::params::package_name, $service_name = $::hitch::params::service_name, $file_owner = $::hitch::params::file_owner, $config_file = $::hitch::params::config_file, $dhparams_file = $::hitch::params::dhparams_file, - $dhparams = $::hitch::params::dhparams, + $dhparams_content = $::hitch::params::dhparams, $config_root = $::hitch::params::config_root, $purge_config_root = $::hitch::params::purge_config_root, $frontend = $::hitch::params::frontend, $backend = $::hitch::params::backend, $write_proxy_v2 = $::hitch::params::write_proxy_v2, $ciphers = $::hitch::params::ciphers, $domains = $::hitch::params::domains, ) inherits ::hitch::params { # validate parameters here class { '::hitch::install': } -> class { '::hitch::config': } ~> class { '::hitch::service': } -> Class['::hitch'] } diff --git a/manifests/params.pp b/manifests/params.pp index 7dabfc1..193e73f 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -1,39 +1,39 @@ # == Class hitch::params # # This class is meant to be called from hitch. # It sets variables according to platform. # class hitch::params { $config_root = '/etc/hitch' $config_file = '/etc/hitch/hitch.conf' $dhparams_file = '/etc/hitch/dhparams.pem' - $dhparams = undef + $dhparams_content = undef $purge_config_root = false $file_owner = 'root' $frontend = '[*]:443' $backend = '[::1]:80' $write_proxy_v2 = 'off' $ciphers = 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH' $prefer_server_ciphers = 'on' $domains = {} case $::osfamily { 'Debian': { $package_name = 'hitch' $service_name = 'hitch' $user = '_hitch' $group = '_hitch' } 'RedHat', 'Amazon': { $package_name = 'hitch' $service_name = 'hitch' $user = 'hitch' $group = 'hitch' } default: { fail("${::operatingsystem} not supported") } } }