0

我想通过将以下行添加到使用 puppetlaps apache 模块的单个服务器上的 httpd.conf 文件中,将 Apache 的标头 X-Frame-Options 设置为“拒绝”。

Header set X-Frame-Options "DENY"

我在 ../environments/data/node/server1.yaml 中有服务器的 YAML 文件,我可以编辑此文件以仅在此服务器上应用配置,但我不知道该放入什么。

如何调用 apache 模块,以便将上面的行添加到配置文件中?

我尝试了以下但没有奏效:

apache::header::x-frame-options: 'DENY'

更新:遵循以下建议,但仍然无法在我的环境中工作,我找不到其他方法。

4

1 回答 1

0

在 Puppet 中,标头设置在已apache::vhost定义类型的实例中。

https://forge.puppet.com/modules/puppetlabs/apache/7.0.0/reference#headers

您要么需要apache::vhost在清单中创建

apache::vhost { 'example.com':
 [...]
 headers => 'set X-Frame-Options "DENY"',
 [...]
}

或者使用apache::vhosts便利类在 Hiera 中做同样的事情

classes:
  - apache::vhosts

apache::vhosts::vhosts:
  'example.com':
    [...]
    headers: 'set X-Frame-Options "DENY"'
    [...]
于 2021-11-17T13:18:56.730 回答