|
393 | 393 | $apache_listen_port = $apache_listenport |
394 | 394 | } |
395 | 395 |
|
396 | | - # Apache >= 2.4 |
397 | | - $directory_allow = { 'require' => 'all granted', } |
398 | | - $directory_deny = { 'require' => 'all denied', } |
| 396 | + if versioncmp($apache::apache_version, '2.4') < 0 { |
| 397 | + fail('Only apache >= 2.4 is supported') |
| 398 | + } |
399 | 399 |
|
400 | 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 | | - } |
| 401 | + undef => 'all granted', |
| 402 | + default => $zabbix_api_access.map |$host| { "host ${host}" }, |
407 | 403 | } |
408 | 404 |
|
409 | 405 | apache::vhost { $zabbix_url: |
|
413 | 409 | default_vhost => $default_vhost, |
414 | 410 | add_listen => true, |
415 | 411 | directories => [ |
416 | | - merge( |
417 | | - merge({ |
418 | | - path => '/usr/share/zabbix', |
419 | | - provider => 'directory', |
420 | | - }, $directory_allow), |
421 | | - $fcgi_filematch |
422 | | - ), |
423 | 412 | merge({ |
424 | | - path => '/usr/share/zabbix/conf', |
| 413 | + path => '/usr/share/zabbix', |
425 | 414 | provider => 'directory', |
426 | | - }, $directory_deny), |
427 | | - merge({ |
428 | | - path => '/usr/share/zabbix/api', |
429 | | - provider => 'directory', |
430 | | - }, $directory_deny), |
431 | | - merge({ |
432 | | - path => '/usr/share/zabbix/include', |
433 | | - provider => 'directory', |
434 | | - }, $directory_deny), |
435 | | - merge({ |
436 | | - path => '/usr/share/zabbix/include/classes', |
437 | | - provider => 'directory', |
438 | | - }, $directory_deny), |
439 | | - merge({ |
440 | | - path => '/api_jsonrpc.php', |
441 | | - provider => 'location', |
442 | | - }, $location_api_access), |
| 415 | + require => 'all granted', |
| 416 | + }, $fcgi_filematch |
| 417 | + ), |
| 418 | + { |
| 419 | + path => '/usr/share/zabbix/conf', |
| 420 | + provider => 'directory', |
| 421 | + require => 'all denied', |
| 422 | + }, |
| 423 | + { |
| 424 | + path => '/usr/share/zabbix/api', |
| 425 | + provider => 'directory', |
| 426 | + require => 'all denied', |
| 427 | + }, |
| 428 | + { |
| 429 | + path => '/usr/share/zabbix/include', |
| 430 | + provider => 'directory', |
| 431 | + require => 'all denied', |
| 432 | + }, |
| 433 | + { |
| 434 | + path => '/usr/share/zabbix/include/classes', |
| 435 | + provider => 'directory', |
| 436 | + require => 'all denied', |
| 437 | + }, |
| 438 | + { |
| 439 | + path => '/api_jsonrpc.php', |
| 440 | + provider => 'location', |
| 441 | + require => $location_api_access, |
| 442 | + }, |
443 | 443 | ], |
444 | 444 | custom_fragment => $apache_vhost_custom_fragment, |
445 | 445 | rewrites => [ |
|
0 commit comments