Skip to content

Commit 63c654b

Browse files
authored
Merge pull request #247 from selyx/master
add option to customize cipher suites in jetty
2 parents 4e81a61 + e4dec2e commit 63c654b

6 files changed

Lines changed: 42 additions & 0 deletions

File tree

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,11 @@ If true, open the `ssl_listen_port` on the firewall. Defaults to `undef`.
371371

372372
Specify the supported SSL protocols for PuppetDB (e.g. TLSv1, TLSv1.1, TLSv1.2.)
373373

374+
####`cipher_suites`
375+
376+
Configure jetty's supported `cipher-suites` (e.g. `SSL_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384`).
377+
Defaults to `undef`.
378+
374379
###`manage_dbserver`
375380

376381
If true, the PostgreSQL server will be managed by this module. Defaults to `true`.

manifests/init.pp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
$ssl_cert = $puppetdb::params::ssl_cert,
2020
$ssl_ca_cert = $puppetdb::params::ssl_ca_cert,
2121
$ssl_protocols = $puppetdb::params::ssl_protocols,
22+
$cipher_suites = $puppetdb::params::cipher_suites,
2223
$manage_dbserver = $puppetdb::params::manage_dbserver,
2324
$manage_package_repo = $puppetdb::params::manage_pg_repo,
2425
$postgres_version = $puppetdb::params::postgres_version,
@@ -93,6 +94,7 @@
9394
ssl_cert => $ssl_cert,
9495
ssl_ca_cert => $ssl_ca_cert,
9596
ssl_protocols => $ssl_protocols,
97+
cipher_suites => $cipher_suites,
9698
database => $database,
9799
database_host => $database_host,
98100
database_port => $database_port,

manifests/params.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
$ssl_listen_port = '8081'
1111
$ssl_protocols = undef
1212
$disable_ssl = false
13+
$cipher_suites = undef
1314
$open_ssl_listen_port = undef
1415
$postgres_listen_addresses = 'localhost'
1516

manifests/server.pp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
$ssl_cert = $puppetdb::params::ssl_cert,
1919
$ssl_ca_cert = $puppetdb::params::ssl_ca_cert,
2020
$ssl_protocols = $puppetdb::params::ssl_protocols,
21+
$cipher_suites = $puppetdb::params::cipher_suites,
2122
$database = $puppetdb::params::database,
2223
$database_host = $puppetdb::params::database_host,
2324
$database_port = $puppetdb::params::database_port,
@@ -251,6 +252,7 @@
251252
ssl_cert_path => $ssl_cert_path,
252253
ssl_ca_cert_path => $ssl_ca_cert_path,
253254
ssl_protocols => $ssl_protocols,
255+
cipher_suites => $cipher_suites,
254256
disable_ssl => $disable_ssl,
255257
confdir => $confdir,
256258
max_threads => $max_threads,

manifests/server/jetty.pp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
$ssl_key_path = $puppetdb::params::ssl_key_path,
1212
$ssl_ca_cert_path = $puppetdb::params::ssl_ca_cert_path,
1313
$ssl_protocols = $puppetdb::params::ssl_protocols,
14+
$cipher_suites = $puppetdb::params::cipher_suites,
1415
$confdir = $puppetdb::params::confdir,
1516
$max_threads = $puppetdb::params::max_threads,
1617
$puppetdb_user = $puppetdb::params::puppetdb_user,
@@ -79,6 +80,17 @@
7980
}
8081
}
8182

83+
if $cipher_suites != undef {
84+
85+
validate_string($cipher_suites)
86+
87+
ini_setting { 'puppetdb_cipher-suites':
88+
ensure => $ssl_setting_ensure,
89+
setting => 'cipher-suites',
90+
value => $cipher_suites,
91+
}
92+
}
93+
8294
if str2bool($ssl_set_cert_paths) == true {
8395
# assume paths have been validated in calling class
8496
ini_setting { 'puppetdb_ssl_key':

spec/unit/classes/server/jetty_ini_spec.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,26 @@
171171
end
172172
end
173173

174+
describe 'when setting cipher_suites' do
175+
context 'to a valid string' do
176+
let(:params) do
177+
{
178+
'cipher_suites' => 'SSL_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, SSL_ECDHE_RSA_WITH_AES_256_CBC_SHA384, SSL_RSA_WITH_AES_256_CBC_SHA256'
179+
}
180+
end
181+
182+
it {
183+
should contain_ini_setting('puppetdb_cipher-suites').with(
184+
'ensure' => 'present',
185+
'path' => '/etc/puppetlabs/puppetdb/conf.d/jetty.ini',
186+
'section' => 'jetty',
187+
'setting' => 'cipher-suites',
188+
'value' => 'SSL_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, SSL_ECDHE_RSA_WITH_AES_256_CBC_SHA384, SSL_RSA_WITH_AES_256_CBC_SHA256'
189+
)
190+
}
191+
end
192+
end
193+
174194
describe 'when disabling the cleartext HTTP port' do
175195
let(:params) do
176196
{

0 commit comments

Comments
 (0)