File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77 $open_listen_port = false
88 $ssl_listen_address = $::fqdn
99 $ssl_listen_port = ' 8081'
10+ $ssl_protocols = undef
1011 $disable_ssl = false
1112 $open_ssl_listen_port = undef
1213 $postgres_listen_addresses = ' localhost'
Original file line number Diff line number Diff line change 99 $ssl_cert_path = $puppetdb::params::ssl_cert_path,
1010 $ssl_key_path = $puppetdb::params::ssl_key_path,
1111 $ssl_ca_cert_path = $puppetdb::params::ssl_ca_cert_path,
12+ $ssl_protocols = $puppetdb::params::ssl_protocols,
1213 $confdir = $puppetdb::params::confdir,
1314 $max_threads = $puppetdb::params::max_threads,
1415) inherits puppetdb::params {
4748 value => $ssl_listen_port ,
4849 }
4950
51+ if $ssl_protocols != undef {
52+
53+ validate_string($ssl_protocols )
54+
55+ ini_setting { 'puppetdb_sslprotocols' :
56+ ensure => $ssl_setting_ensure ,
57+ setting => ' ssl-protocols' ,
58+ value => $ssl_protocols ,
59+ }
60+ }
61+
5062 if str2bool($ssl_set_cert_paths ) == true {
5163 # assume paths have been validated in calling class
5264 ini_setting { 'puppetdb_ssl_key' :
Original file line number Diff line number Diff line change 4444 'setting' => 'ssl-port' ,
4545 'value' => 8081
4646 ) }
47+ it { should_not contain_ini_setting ( 'puppetdb_sslprotocols' ) }
4748 end
4849
4950 describe 'when disabling ssl' do
99100 'value' => '150'
100101 ) }
101102 end
103+
104+ describe 'when setting ssl_protocols' do
105+ context 'to a valid string' do
106+ let ( :params ) { { 'ssl_protocols' => 'TLSv1, TLSv1.1, TLSv1.2' } }
107+
108+ it {
109+ should contain_ini_setting ( 'puppetdb_sslprotocols' ) . with (
110+ 'ensure' => 'present' ,
111+ 'path' => '/etc/puppetdb/conf.d/jetty.ini' ,
112+ 'section' => 'jetty' ,
113+ 'setting' => 'ssl-protocols' ,
114+ 'value' => 'TLSv1, TLSv1.1, TLSv1.2'
115+ )
116+ }
117+ end
118+
119+ context 'to an invalid type (non-string)' do
120+ let ( :params ) { { 'ssl_protocols' => [ 'invalid' , 'type' ] } }
121+
122+ it 'should fail' do
123+ expect {
124+ should contain_class ( 'puppetdb::server::jetty_ini' )
125+ } . to raise_error ( Puppet ::Error )
126+ end
127+ end
128+ end
102129 end
103130end
You can’t perform that action at this time.
0 commit comments