|
42 | 42 | # @param apache_listenport_ssl The port for the apache SSL vhost. |
43 | 43 | # @param zabbix_api_user Name of the user which the api should connect to. Default: Admin |
44 | 44 | # @param zabbix_api_pass Password of the user which connects to the api. Default: zabbix |
| 45 | +# @param zabbix_api_access Which host has access to the api. Default: no restriction |
45 | 46 | # @param database_host Database host name. |
46 | 47 | # @param database_name Database name. |
47 | 48 | # @param database_schema Schema name. used for ibm db2. |
|
114 | 115 | Variant[Array[Stdlib::Port], Stdlib::Port] $apache_listenport_ssl = $zabbix::params::apache_listenport_ssl, |
115 | 116 | $zabbix_api_user = $zabbix::params::server_api_user, |
116 | 117 | $zabbix_api_pass = $zabbix::params::server_api_pass, |
| 118 | + Optional[Array[Stdlib::Fqdn]] $zabbix_api_access = $zabbix::params::server_api_access, |
117 | 119 | $database_host = $zabbix::params::server_database_host, |
118 | 120 | $database_name = $zabbix::params::server_database_name, |
119 | 121 | $database_schema = $zabbix::params::server_database_schema, |
|
395 | 397 | $directory_allow = { 'require' => 'all granted', } |
396 | 398 | $directory_deny = { 'require' => 'all denied', } |
397 | 399 |
|
| 400 | + $location_api_access = $zabbix_api_access ? { |
| 401 | + undef => $directory_allow, |
| 402 | + default => if versioncmp($apache::apache_version, '2.4') >= 0 { |
| 403 | + { 'require' => $zabbix_api_access.map |$host| { "host ${host}" }, } |
| 404 | + } else { |
| 405 | + { 'allow' => $zabbix_api_access, 'order' => 'Allow,Deny' } |
| 406 | + } |
| 407 | + } |
| 408 | + |
398 | 409 | apache::vhost { $zabbix_url: |
399 | 410 | docroot => '/usr/share/zabbix', |
400 | 411 | ip => $apache_listen_ip, |
|
425 | 436 | path => '/usr/share/zabbix/include/classes', |
426 | 437 | provider => 'directory', |
427 | 438 | }, $directory_deny), |
| 439 | + merge({ |
| 440 | + path => '/api_jsonrpc.php', |
| 441 | + provider => 'location', |
| 442 | + }, $location_api_access), |
428 | 443 | ], |
429 | 444 | custom_fragment => $apache_vhost_custom_fragment, |
430 | 445 | rewrites => [ |
|
0 commit comments