Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable FIPS support within JVM for Puppet #828

Merged
merged 1 commit into from
Mar 17, 2022
Merged
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
11 changes: 10 additions & 1 deletion manifests/server/puppetserver.pp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@
# @param server_multithreaded
# Configures the puppetserver to use multithreaded jruby.
#
# @param disable_fips
# Disables FIPS support within the JVM
#
# @example
#
# # configure memory for java < 8
Expand Down Expand Up @@ -140,6 +143,7 @@
$max_open_files = $puppet::server::max_open_files,
$versioned_code_id = $puppet::server::versioned_code_id,
$versioned_code_content = $puppet::server::versioned_code_content,
$disable_fips = $facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '8',
) {
include puppet::server

Expand All @@ -149,7 +153,12 @@

$puppetserver_package = pick($puppet::server::package, 'puppetserver')

$jvm_cmd_arr = ["-Xms${jvm_min_heap_size}", "-Xmx${jvm_max_heap_size}", $jvm_extra_args]
$jvm_heap_arr = ["-Xms${jvm_min_heap_size}", "-Xmx${jvm_max_heap_size}"]
if $disable_fips {
$jvm_cmd_arr = $jvm_heap_arr + ['-Dcom.redhat.fips=false', $jvm_extra_args]
} else {
$jvm_cmd_arr = $jvm_heap_arr + [$jvm_extra_args]
}
$jvm_cmd = strip(join(flatten($jvm_cmd_arr), ' '))

if $facts['os']['family'] == 'FreeBSD' {
Expand Down
69 changes: 52 additions & 17 deletions spec/classes/puppet_server_puppetserver_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,23 @@
.with_incl('/etc/default/puppetserver')
.with_lens('Shellvars.lns')
}
it {
should contain_augeas('puppet::server::puppetserver::jvm')
.with_changes(['set JAVA_ARGS \'"-Xms2G -Xmx2G"\'', 'set JAVA_BIN /usr/bin/java'])
.with_context('/files/etc/default/puppetserver')
.with_incl('/etc/default/puppetserver')
.with_lens('Shellvars.lns')
}
if facts[:os]['family'] == 'RedHat' and facts[:os]['release']['major'] == '8'
it {
should contain_augeas('puppet::server::puppetserver::jvm')
.with_changes(['set JAVA_ARGS \'"-Xms2G -Xmx2G -Dcom.redhat.fips=false"\'', 'set JAVA_BIN /usr/bin/java'])
.with_context('/files/etc/default/puppetserver')
.with_incl('/etc/default/puppetserver')
.with_lens('Shellvars.lns')
}
else
it {
should contain_augeas('puppet::server::puppetserver::jvm')
.with_changes(['set JAVA_ARGS \'"-Xms2G -Xmx2G"\'', 'set JAVA_BIN /usr/bin/java'])
.with_context('/files/etc/default/puppetserver')
.with_incl('/etc/default/puppetserver')
.with_lens('Shellvars.lns')
}
end
it do
should contain_augeas('puppet::server::puppetserver::jruby_jar')
.with_changes(['rm JRUBY_JAR'])
Expand Down Expand Up @@ -374,6 +384,17 @@
.with_changes(['set puppetserver_java_opts \'"-Xms2G -Xmx2G -XX:foo=bar -XX:bar=foo"\''])
.with_context('/files/etc/rc.conf')
}
elsif facts[:os]['family'] == 'RedHat' and facts[:os]['release']['major'] == '8'
it {
should contain_augeas('puppet::server::puppetserver::jvm')
.with_changes([
'set JAVA_ARGS \'"-Xms2G -Xmx2G -Dcom.redhat.fips=false -XX:foo=bar -XX:bar=foo"\'',
'set JAVA_BIN /usr/bin/java'
])
.with_context('/files/etc/default/puppetserver')
.with_incl('/etc/default/puppetserver')
.with_lens('Shellvars.lns')
}
else
it {
should contain_augeas('puppet::server::puppetserver::jvm')
Expand All @@ -390,16 +411,30 @@

describe 'with cli_args parameter', unless: facts[:osfamily] == 'FreeBSD' do
let(:params) { super().merge(server_jvm_cli_args: '-Djava.io.tmpdir=/var/puppettmp') }
it do
should contain_augeas('puppet::server::puppetserver::jvm')
.with_changes([
'set JAVA_ARGS \'"-Xms2G -Xmx2G"\'',
'set JAVA_BIN /usr/bin/java',
'set JAVA_ARGS_CLI \'"-Djava.io.tmpdir=/var/puppettmp"\''
])
.with_context('/files/etc/default/puppetserver')
.with_incl('/etc/default/puppetserver')
.with_lens('Shellvars.lns')
if facts[:os]['family'] == 'RedHat' and facts[:os]['release']['major'] == '8'
it {
should contain_augeas('puppet::server::puppetserver::jvm')
.with_changes([
'set JAVA_ARGS \'"-Xms2G -Xmx2G -Dcom.redhat.fips=false"\'',
'set JAVA_BIN /usr/bin/java',
'set JAVA_ARGS_CLI \'"-Djava.io.tmpdir=/var/puppettmp"\''
])
.with_context('/files/etc/default/puppetserver')
.with_incl('/etc/default/puppetserver')
.with_lens('Shellvars.lns')
}
else
it {
should contain_augeas('puppet::server::puppetserver::jvm')
.with_changes([
'set JAVA_ARGS \'"-Xms2G -Xmx2G"\'',
'set JAVA_BIN /usr/bin/java',
'set JAVA_ARGS_CLI \'"-Djava.io.tmpdir=/var/puppettmp"\''
])
.with_context('/files/etc/default/puppetserver')
.with_incl('/etc/default/puppetserver')
.with_lens('Shellvars.lns')
}
end
end

Expand Down