Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,8 @@
# $server_jolokia_metrics_allowlist:: The allowlist of clients that
# can query the jolokia /metrics/v2 endpoint
#
# $server_jolokia_metrics_policy:: The content of the jolokia-access.xml file for the jolokia metrics endpoint
#
# === Usage:
#
# * Simple usage:
Expand Down Expand Up @@ -753,6 +755,7 @@
Optional[Stdlib::Absolutepath] $server_versioned_code_content = undef,
Array[String[1]] $server_jolokia_metrics_allowlist = [],
Stdlib::Filemode $puppetconf_mode = $puppet::params::puppetconf_mode,
Optional[String] $server_jolokia_metrics_policy = undef,
) inherits puppet::params {
contain puppet::config

Expand Down
3 changes: 3 additions & 0 deletions manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,8 @@
#
# $jolokia_metrics_allowlist:: The allowlist of clients that
# can query the jolokia /metrics/v2 endpoint
#
# $jolokia_metrics_policy:: The content of the jolokia-access.xml file for the jolokia metrics endpoint
class puppet::server (
Variant[Boolean, Stdlib::Absolutepath] $autosign = $puppet::autosign,
Array[String] $autosign_entries = $puppet::autosign_entries,
Expand Down Expand Up @@ -458,6 +460,7 @@
Optional[Stdlib::Absolutepath] $versioned_code_id = $puppet::server_versioned_code_id,
Optional[Stdlib::Absolutepath] $versioned_code_content = $puppet::server_versioned_code_content,
Array[String[1]] $jolokia_metrics_allowlist = $puppet::server_jolokia_metrics_allowlist,
Optional[String] $jolokia_metrics_policy = $puppet::server_jolokia_metrics_policy,
) {
$cadir = "${puppetserver_dir}/ca"

Expand Down
8 changes: 8 additions & 0 deletions manifests/server/puppetserver.pp
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
Optional[Stdlib::Absolutepath] $versioned_code_content = $puppet::server::versioned_code_content,
Boolean $disable_fips = $facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '8',
Array[String[1]] $jolokia_metrics_allowlist = $puppet::server::jolokia_metrics_allowlist,
Optional[String] $jolokia_metrics_policy = $puppet::server::jolokia_metrics_policy,
) {
include puppet::server

Expand Down Expand Up @@ -271,4 +272,11 @@
ensure => 'file',
content => template('puppet/server/puppetserver/conf.d/metrics.conf.erb'),
}

if $jolokia_metrics_policy != undef {
file { '/etc/puppetlabs/puppetserver/jolokia-access.xml' :
ensure => file,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to ensure it's absent when $jolokia_metrics_policy is undef?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the super late reply, but I'd argue the absence of $jolokia_metrics_policy should not dictate enforcing the absence of the file.

I could see ensuring jolokia-access.xml as absent if $jolokia_metrics_policy == absent, but not undef.

source => $jolokia_metrics_policy,
}
}
}
4 changes: 4 additions & 0 deletions templates/server/puppetserver/conf.d/metrics.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ metrics: {
servlet-init-params: {
# Specify a custom security policy:
# https://jolokia.org/reference/html/security.html
<% if @jolokia_metrics_policy -%>
policyLocation: "file:///etc/puppetlabs/puppetserver/jolokia-access.xml"
<%- else -%>
# policyLocation: "file:///etc/puppetlabs/puppetserver/jolokia-access.xml"
<% end -%>
}
}
}
Expand Down