Skip to content

Commit c78916e

Browse files
ehelmsekohl
authored andcommitted
Disable FIPS support within JVM for Puppet
1 parent e00ed36 commit c78916e

File tree

2 files changed

+62
-18
lines changed

2 files changed

+62
-18
lines changed

manifests/server/puppetserver.pp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@
6060
# @param server_multithreaded
6161
# Configures the puppetserver to use multithreaded jruby.
6262
#
63+
# @param disable_fips
64+
# Disables FIPS support within the JVM
65+
#
6366
# @example
6467
#
6568
# # configure memory for java < 8
@@ -140,6 +143,7 @@
140143
$max_open_files = $puppet::server::max_open_files,
141144
$versioned_code_id = $puppet::server::versioned_code_id,
142145
$versioned_code_content = $puppet::server::versioned_code_content,
146+
$disable_fips = $facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '8',
143147
) {
144148
include puppet::server
145149

@@ -149,7 +153,12 @@
149153

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

152-
$jvm_cmd_arr = ["-Xms${jvm_min_heap_size}", "-Xmx${jvm_max_heap_size}", $jvm_extra_args]
156+
$jvm_heap_arr = ["-Xms${jvm_min_heap_size}", "-Xmx${jvm_max_heap_size}"]
157+
if $disable_fips {
158+
$jvm_cmd_arr = $jvm_heap_arr + ['-Dcom.redhat.fips=false', $jvm_extra_args]
159+
} else {
160+
$jvm_cmd_arr = $jvm_heap_arr + [$jvm_extra_args]
161+
}
153162
$jvm_cmd = strip(join(flatten($jvm_cmd_arr), ' '))
154163

155164
if $facts['os']['family'] == 'FreeBSD' {

spec/classes/puppet_server_puppetserver_spec.rb

Lines changed: 52 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,23 @@
5959
.with_incl('/etc/default/puppetserver')
6060
.with_lens('Shellvars.lns')
6161
}
62-
it {
63-
should contain_augeas('puppet::server::puppetserver::jvm')
64-
.with_changes(['set JAVA_ARGS \'"-Xms2G -Xmx2G"\'', 'set JAVA_BIN /usr/bin/java'])
65-
.with_context('/files/etc/default/puppetserver')
66-
.with_incl('/etc/default/puppetserver')
67-
.with_lens('Shellvars.lns')
68-
}
62+
if facts[:os]['family'] == 'RedHat' and facts[:os]['release']['major'] == '8'
63+
it {
64+
should contain_augeas('puppet::server::puppetserver::jvm')
65+
.with_changes(['set JAVA_ARGS \'"-Xms2G -Xmx2G -Dcom.redhat.fips=false"\'', 'set JAVA_BIN /usr/bin/java'])
66+
.with_context('/files/etc/default/puppetserver')
67+
.with_incl('/etc/default/puppetserver')
68+
.with_lens('Shellvars.lns')
69+
}
70+
else
71+
it {
72+
should contain_augeas('puppet::server::puppetserver::jvm')
73+
.with_changes(['set JAVA_ARGS \'"-Xms2G -Xmx2G"\'', 'set JAVA_BIN /usr/bin/java'])
74+
.with_context('/files/etc/default/puppetserver')
75+
.with_incl('/etc/default/puppetserver')
76+
.with_lens('Shellvars.lns')
77+
}
78+
end
6979
it do
7080
should contain_augeas('puppet::server::puppetserver::jruby_jar')
7181
.with_changes(['rm JRUBY_JAR'])
@@ -374,6 +384,17 @@
374384
.with_changes(['set puppetserver_java_opts \'"-Xms2G -Xmx2G -XX:foo=bar -XX:bar=foo"\''])
375385
.with_context('/files/etc/rc.conf')
376386
}
387+
elsif facts[:os]['family'] == 'RedHat' and facts[:os]['release']['major'] == '8'
388+
it {
389+
should contain_augeas('puppet::server::puppetserver::jvm')
390+
.with_changes([
391+
'set JAVA_ARGS \'"-Xms2G -Xmx2G -Dcom.redhat.fips=false -XX:foo=bar -XX:bar=foo"\'',
392+
'set JAVA_BIN /usr/bin/java'
393+
])
394+
.with_context('/files/etc/default/puppetserver')
395+
.with_incl('/etc/default/puppetserver')
396+
.with_lens('Shellvars.lns')
397+
}
377398
else
378399
it {
379400
should contain_augeas('puppet::server::puppetserver::jvm')
@@ -390,16 +411,30 @@
390411

391412
describe 'with cli_args parameter', unless: facts[:osfamily] == 'FreeBSD' do
392413
let(:params) { super().merge(server_jvm_cli_args: '-Djava.io.tmpdir=/var/puppettmp') }
393-
it do
394-
should contain_augeas('puppet::server::puppetserver::jvm')
395-
.with_changes([
396-
'set JAVA_ARGS \'"-Xms2G -Xmx2G"\'',
397-
'set JAVA_BIN /usr/bin/java',
398-
'set JAVA_ARGS_CLI \'"-Djava.io.tmpdir=/var/puppettmp"\''
399-
])
400-
.with_context('/files/etc/default/puppetserver')
401-
.with_incl('/etc/default/puppetserver')
402-
.with_lens('Shellvars.lns')
414+
if facts[:os]['family'] == 'RedHat' and facts[:os]['release']['major'] == '8'
415+
it {
416+
should contain_augeas('puppet::server::puppetserver::jvm')
417+
.with_changes([
418+
'set JAVA_ARGS \'"-Xms2G -Xmx2G -Dcom.redhat.fips=false"\'',
419+
'set JAVA_BIN /usr/bin/java',
420+
'set JAVA_ARGS_CLI \'"-Djava.io.tmpdir=/var/puppettmp"\''
421+
])
422+
.with_context('/files/etc/default/puppetserver')
423+
.with_incl('/etc/default/puppetserver')
424+
.with_lens('Shellvars.lns')
425+
}
426+
else
427+
it {
428+
should contain_augeas('puppet::server::puppetserver::jvm')
429+
.with_changes([
430+
'set JAVA_ARGS \'"-Xms2G -Xmx2G"\'',
431+
'set JAVA_BIN /usr/bin/java',
432+
'set JAVA_ARGS_CLI \'"-Djava.io.tmpdir=/var/puppettmp"\''
433+
])
434+
.with_context('/files/etc/default/puppetserver')
435+
.with_incl('/etc/default/puppetserver')
436+
.with_lens('Shellvars.lns')
437+
}
403438
end
404439
end
405440

0 commit comments

Comments
 (0)