Puppet Class: apache::mod::remoteip
- Defined in:
- manifests/mod/remoteip.pp
Summary
Installs and configures `mod_remoteip`.Overview
[View source]
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'manifests/mod/remoteip.pp', line 56
class apache::mod::remoteip (
String $header = 'X-Forwarded-For',
Optional[Array[Variant[Stdlib::Host,Stdlib::IP::Address]]] $internal_proxy = undef,
Optional[Array[Variant[Stdlib::Host,Stdlib::IP::Address]]] $proxy_ips = undef,
Optional[Stdlib::Absolutepath] $internal_proxy_list = undef,
Optional[String] $proxies_header = undef,
Boolean $proxy_protocol = false,
Optional[Array[Variant[Stdlib::Host,Stdlib::IP::Address]]] $proxy_protocol_exceptions = undef,
Optional[Array[Stdlib::Host]] $trusted_proxy = undef,
Optional[Array[Stdlib::Host]] $trusted_proxy_ips = undef,
Optional[Stdlib::Absolutepath] $trusted_proxy_list = undef,
Optional[String] $apache_version = undef,
) {
include apache
$_apache_version = pick($apache_version, $apache::apache_version)
if versioncmp($_apache_version, '2.4') < 0 {
fail('mod_remoteip is only available in Apache 2.4')
}
if $proxy_ips {
deprecation('apache::mod::remoteip::proxy_ips', 'This parameter is deprecated, please use `internal_proxy`.')
$_internal_proxy = $proxy_ips
} elsif $internal_proxy {
$_internal_proxy = $internal_proxy
} else {
$_internal_proxy = ['127.0.0.1']
}
if $trusted_proxy_ips {
deprecation('apache::mod::remoteip::trusted_proxy_ips', 'This parameter is deprecated, please use `trusted_proxy`.')
$_trusted_proxy = $trusted_proxy_ips
} else {
$_trusted_proxy = $trusted_proxy
}
::apache::mod { 'remoteip': }
$template_parameters = {
header => $header,
internal_proxy => $_internal_proxy,
internal_proxy_list => $internal_proxy_list,
proxies_header => $proxies_header,
proxy_protocol => $proxy_protocol,
proxy_protocol_exceptions => $proxy_protocol_exceptions,
trusted_proxy => $_trusted_proxy,
trusted_proxy_list => $trusted_proxy_list,
}
file { 'remoteip.conf':
ensure => file,
path => "${apache::mod_dir}/remoteip.conf",
mode => $apache::file_mode,
content => epp('apache/mod/remoteip.conf.epp', $template_parameters),
require => Exec["mkdir ${apache::mod_dir}"],
before => File[$apache::mod_dir],
notify => Class['apache::service'],
}
}
|