view modules/apache/manifests/security/rule_link.pp @ 429:fa3093f2dc8e

Migrate NextCloud to LetsEncrypt
author IBBoard <dev@ibboard.co.uk>
date Sun, 11 Dec 2022 19:03:22 +0000
parents d9352a684e62
children b8d6ada284dd
line wrap: on
line source

# @summary
#   Links the activated_rules from `apache::mod::security` to the respective CRS rules on disk.
#
# @api private
define apache::security::rule_link () {

  $parts = split($title, '/')
  $filename = $parts[-1]

  $target = $title ? {
    /^\//   => $title,
    default => "${::apache::params::modsec_crs_path}/${title}",
  }

  file { $filename:
    ensure  => 'link',
    path    => "${::apache::mod::security::modsec_dir}/activated_rules/${filename}",
    target  => $target ,
    require => File["${::apache::mod::security::modsec_dir}/activated_rules"],
    notify  => Class['apache::service'],
  }
}