Skip to content

Commit db91599

Browse files
committed
Merge pull request #206 from mullr/ticket/master/pdb-1415-jdbc-subparams
(PDB-1415) Add jdbc_ssl_properties parameter
2 parents 908c8a8 + 28d23d5 commit db91599

7 files changed

Lines changed: 367 additions & 204 deletions

File tree

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,11 +290,23 @@ The password for the database user (defaults to `puppetdb`; ignored for `embedde
290290

291291
The name of the database instance to connect to (defaults to `puppetdb`; ignored for `embedded` db).
292292

293-
####`database_ssl`
293+
####`database_ssl` (DEPRECATED)
294294

295295
If true, puppetdb will use SSL to connect to the postgres database (defaults to false; ignored for `embedded` db).
296296
Setting up proper trust- and keystores has to be managed outside of the puppetdb module.
297297

298+
This parameter is deprecated and will be retired in a future release. Please use
299+
the `jdbc_ssl_properties` parameter with the value `?ssl=true`.
300+
301+
####`jdbc_ssl_properties`
302+
303+
The text to append to the JDBC connection URI. This should begin with a '?'
304+
character. For example, to use SSL for the PostgreSQL connection, set this
305+
parameter's value to `?ssl=true`.
306+
307+
This setting is only available when using PostgreSQL; when using HyperSQL (the
308+
'embedded' database), it does nothing.
309+
298310
####`database_validate`
299311

300312
If true, the module will attempt to connect to the database using the specified settings and fail if it is not able to do so. (defaults to true)

manifests/init.pp

Lines changed: 124 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -1,129 +1,133 @@
11
# All in one class for setting up a PuppetDB instance. See README.md for more
22
# details.
33
class puppetdb (
4-
$listen_address = $puppetdb::params::listen_address,
5-
$listen_port = $puppetdb::params::listen_port,
6-
$open_listen_port = $puppetdb::params::open_listen_port,
7-
$ssl_listen_address = $puppetdb::params::ssl_listen_address,
8-
$ssl_listen_port = $puppetdb::params::ssl_listen_port,
9-
$disable_ssl = $puppetdb::params::disable_ssl,
10-
$open_ssl_listen_port = $puppetdb::params::open_ssl_listen_port,
11-
$ssl_dir = $puppetdb::params::ssl_dir,
12-
$ssl_set_cert_paths = $puppetdb::params::ssl_set_cert_paths,
13-
$ssl_cert_path = $puppetdb::params::ssl_cert_path,
14-
$ssl_key_path = $puppetdb::params::ssl_key_path,
15-
$ssl_ca_cert_path = $puppetdb::params::ssl_ca_cert_path,
16-
$ssl_deploy_certs = $puppetdb::params::ssl_deploy_certs,
17-
$ssl_key = $puppetdb::params::ssl_key,
18-
$ssl_cert = $puppetdb::params::ssl_cert,
19-
$ssl_ca_cert = $puppetdb::params::ssl_ca_cert,
20-
$ssl_protocols = $puppetdb::params::ssl_protocols,
21-
$manage_dbserver = $puppetdb::params::manage_dbserver,
22-
$manage_package_repo = $puppetdb::params::manage_pg_repo,
23-
$postgres_version = $puppetdb::params::postgres_version,
24-
$database = $puppetdb::params::database,
25-
$database_host = $puppetdb::params::database_host,
26-
$database_port = $puppetdb::params::database_port,
27-
$database_username = $puppetdb::params::database_username,
28-
$database_password = $puppetdb::params::database_password,
29-
$database_name = $puppetdb::params::database_name,
30-
$database_ssl = $puppetdb::params::database_ssl,
31-
$database_listen_address = $puppetdb::params::postgres_listen_addresses,
32-
$database_validate = $puppetdb::params::database_validate,
33-
$database_embedded_path = $puppetdb::params::database_embedded_path,
34-
$node_ttl = $puppetdb::params::node_ttl,
35-
$node_purge_ttl = $puppetdb::params::node_purge_ttl,
36-
$report_ttl = $puppetdb::params::report_ttl,
37-
$gc_interval = $puppetdb::params::gc_interval,
38-
$log_slow_statements = $puppetdb::params::log_slow_statements,
39-
$conn_max_age = $puppetdb::params::conn_max_age,
40-
$conn_keep_alive = $puppetdb::params::conn_keep_alive,
41-
$conn_lifetime = $puppetdb::params::conn_lifetime,
42-
$puppetdb_package = $puppetdb::params::puppetdb_package,
43-
$puppetdb_service = $puppetdb::params::puppetdb_service,
44-
$puppetdb_service_status = $puppetdb::params::puppetdb_service_status,
45-
$puppetdb_user = $puppetdb::params::puppetdb_user,
46-
$puppetdb_group = $puppetdb::params::puppetdb_group,
47-
$read_database = $puppetdb::params::read_database,
48-
$read_database_host = $puppetdb::params::read_database_host,
49-
$read_database_port = $puppetdb::params::read_database_port,
50-
$read_database_username = $puppetdb::params::read_database_username,
51-
$read_database_password = $puppetdb::params::read_database_password,
52-
$read_database_name = $puppetdb::params::read_database_name,
53-
$read_database_ssl = $puppetdb::params::read_database_ssl,
54-
$read_database_validate = $puppetdb::params::read_database_validate,
55-
$read_log_slow_statements = $puppetdb::params::read_log_slow_statements,
56-
$read_conn_max_age = $puppetdb::params::read_conn_max_age,
57-
$read_conn_keep_alive = $puppetdb::params::read_conn_keep_alive,
58-
$read_conn_lifetime = $puppetdb::params::read_conn_lifetime,
59-
$confdir = $puppetdb::params::confdir,
60-
$manage_firewall = $puppetdb::params::manage_firewall,
61-
$java_args = $puppetdb::params::java_args,
62-
$max_threads = $puppetdb::params::max_threads,
63-
$command_threads = $puppetdb::params::command_threads,
64-
$store_usage = $puppetdb::params::store_usage,
65-
$temp_usage = $puppetdb::params::temp_usage
4+
$listen_address = $puppetdb::params::listen_address,
5+
$listen_port = $puppetdb::params::listen_port,
6+
$open_listen_port = $puppetdb::params::open_listen_port,
7+
$ssl_listen_address = $puppetdb::params::ssl_listen_address,
8+
$ssl_listen_port = $puppetdb::params::ssl_listen_port,
9+
$disable_ssl = $puppetdb::params::disable_ssl,
10+
$open_ssl_listen_port = $puppetdb::params::open_ssl_listen_port,
11+
$ssl_dir = $puppetdb::params::ssl_dir,
12+
$ssl_set_cert_paths = $puppetdb::params::ssl_set_cert_paths,
13+
$ssl_cert_path = $puppetdb::params::ssl_cert_path,
14+
$ssl_key_path = $puppetdb::params::ssl_key_path,
15+
$ssl_ca_cert_path = $puppetdb::params::ssl_ca_cert_path,
16+
$ssl_deploy_certs = $puppetdb::params::ssl_deploy_certs,
17+
$ssl_key = $puppetdb::params::ssl_key,
18+
$ssl_cert = $puppetdb::params::ssl_cert,
19+
$ssl_ca_cert = $puppetdb::params::ssl_ca_cert,
20+
$ssl_protocols = $puppetdb::params::ssl_protocols,
21+
$manage_dbserver = $puppetdb::params::manage_dbserver,
22+
$manage_package_repo = $puppetdb::params::manage_pg_repo,
23+
$postgres_version = $puppetdb::params::postgres_version,
24+
$database = $puppetdb::params::database,
25+
$database_host = $puppetdb::params::database_host,
26+
$database_port = $puppetdb::params::database_port,
27+
$database_username = $puppetdb::params::database_username,
28+
$database_password = $puppetdb::params::database_password,
29+
$database_name = $puppetdb::params::database_name,
30+
$database_ssl = $puppetdb::params::database_ssl,
31+
$jdbc_ssl_properties = $puppetdb::params::jdbc_ssl_properties,
32+
$database_listen_address = $puppetdb::params::postgres_listen_addresses,
33+
$database_validate = $puppetdb::params::database_validate,
34+
$database_embedded_path = $puppetdb::params::database_embedded_path,
35+
$node_ttl = $puppetdb::params::node_ttl,
36+
$node_purge_ttl = $puppetdb::params::node_purge_ttl,
37+
$report_ttl = $puppetdb::params::report_ttl,
38+
$gc_interval = $puppetdb::params::gc_interval,
39+
$log_slow_statements = $puppetdb::params::log_slow_statements,
40+
$conn_max_age = $puppetdb::params::conn_max_age,
41+
$conn_keep_alive = $puppetdb::params::conn_keep_alive,
42+
$conn_lifetime = $puppetdb::params::conn_lifetime,
43+
$puppetdb_package = $puppetdb::params::puppetdb_package,
44+
$puppetdb_service = $puppetdb::params::puppetdb_service,
45+
$puppetdb_service_status = $puppetdb::params::puppetdb_service_status,
46+
$puppetdb_user = $puppetdb::params::puppetdb_user,
47+
$puppetdb_group = $puppetdb::params::puppetdb_group,
48+
$read_database = $puppetdb::params::read_database,
49+
$read_database_host = $puppetdb::params::read_database_host,
50+
$read_database_port = $puppetdb::params::read_database_port,
51+
$read_database_username = $puppetdb::params::read_database_username,
52+
$read_database_password = $puppetdb::params::read_database_password,
53+
$read_database_name = $puppetdb::params::read_database_name,
54+
$read_database_ssl = $puppetdb::params::read_database_ssl,
55+
$read_database_jdbc_ssl_properties = $puppetdb::params::read_database_jdbc_ssl_properties,
56+
$read_database_validate = $puppetdb::params::read_database_validate,
57+
$read_log_slow_statements = $puppetdb::params::read_log_slow_statements,
58+
$read_conn_max_age = $puppetdb::params::read_conn_max_age,
59+
$read_conn_keep_alive = $puppetdb::params::read_conn_keep_alive,
60+
$read_conn_lifetime = $puppetdb::params::read_conn_lifetime,
61+
$confdir = $puppetdb::params::confdir,
62+
$manage_firewall = $puppetdb::params::manage_firewall,
63+
$java_args = $puppetdb::params::java_args,
64+
$max_threads = $puppetdb::params::max_threads,
65+
$command_threads = $puppetdb::params::command_threads,
66+
$store_usage = $puppetdb::params::store_usage,
67+
$temp_usage = $puppetdb::params::temp_usage
6668
) inherits puppetdb::params {
6769

6870
class { '::puppetdb::server':
69-
listen_address => $listen_address,
70-
listen_port => $listen_port,
71-
open_listen_port => $open_listen_port,
72-
ssl_listen_address => $ssl_listen_address,
73-
ssl_listen_port => $ssl_listen_port,
74-
disable_ssl => $disable_ssl,
75-
open_ssl_listen_port => $open_ssl_listen_port,
76-
ssl_dir => $ssl_dir,
77-
ssl_set_cert_paths => $ssl_set_cert_paths,
78-
ssl_cert_path => $ssl_cert_path,
79-
ssl_key_path => $ssl_key_path,
80-
ssl_ca_cert_path => $ssl_ca_cert_path,
81-
ssl_deploy_certs => $ssl_deploy_certs,
82-
ssl_key => $ssl_key,
83-
ssl_cert => $ssl_cert,
84-
ssl_ca_cert => $ssl_ca_cert,
85-
ssl_protocols => $ssl_protocols,
86-
database => $database,
87-
database_host => $database_host,
88-
database_port => $database_port,
89-
database_username => $database_username,
90-
database_password => $database_password,
91-
database_name => $database_name,
92-
database_ssl => $database_ssl,
93-
database_validate => $database_validate,
94-
database_embedded_path => $database_embedded_path,
95-
node_ttl => $node_ttl,
96-
node_purge_ttl => $node_purge_ttl,
97-
report_ttl => $report_ttl,
98-
gc_interval => $gc_interval,
99-
log_slow_statements => $log_slow_statements,
100-
conn_max_age => $conn_max_age,
101-
conn_keep_alive => $conn_keep_alive,
102-
conn_lifetime => $conn_lifetime,
103-
puppetdb_package => $puppetdb_package,
104-
puppetdb_service => $puppetdb_service,
105-
puppetdb_service_status => $puppetdb_service_status,
106-
confdir => $confdir,
107-
java_args => $java_args,
108-
max_threads => $max_threads,
109-
read_database => $read_database,
110-
read_database_host => $read_database_host,
111-
read_database_port => $read_database_port,
112-
read_database_username => $read_database_username,
113-
read_database_password => $read_database_password,
114-
read_database_name => $read_database_name,
115-
read_database_ssl => $read_database_ssl,
116-
read_database_validate => $read_database_validate,
117-
read_log_slow_statements => $read_log_slow_statements,
118-
read_conn_max_age => $read_conn_max_age,
119-
read_conn_keep_alive => $read_conn_keep_alive,
120-
read_conn_lifetime => $read_conn_lifetime,
121-
puppetdb_user => $puppetdb_user,
122-
puppetdb_group => $puppetdb_group,
123-
manage_firewall => $manage_firewall,
124-
command_threads => $command_threads,
125-
store_usage => $store_usage,
126-
temp_usage => $temp_usage,
71+
listen_address => $listen_address,
72+
listen_port => $listen_port,
73+
open_listen_port => $open_listen_port,
74+
ssl_listen_address => $ssl_listen_address,
75+
ssl_listen_port => $ssl_listen_port,
76+
disable_ssl => $disable_ssl,
77+
open_ssl_listen_port => $open_ssl_listen_port,
78+
ssl_dir => $ssl_dir,
79+
ssl_set_cert_paths => $ssl_set_cert_paths,
80+
ssl_cert_path => $ssl_cert_path,
81+
ssl_key_path => $ssl_key_path,
82+
ssl_ca_cert_path => $ssl_ca_cert_path,
83+
ssl_deploy_certs => $ssl_deploy_certs,
84+
ssl_key => $ssl_key,
85+
ssl_cert => $ssl_cert,
86+
ssl_ca_cert => $ssl_ca_cert,
87+
ssl_protocols => $ssl_protocols,
88+
database => $database,
89+
database_host => $database_host,
90+
database_port => $database_port,
91+
database_username => $database_username,
92+
database_password => $database_password,
93+
database_name => $database_name,
94+
database_ssl => $database_ssl,
95+
jdbc_ssl_properties => $jdbc_ssl_properties,
96+
database_validate => $database_validate,
97+
database_embedded_path => $database_embedded_path,
98+
node_ttl => $node_ttl,
99+
node_purge_ttl => $node_purge_ttl,
100+
report_ttl => $report_ttl,
101+
gc_interval => $gc_interval,
102+
log_slow_statements => $log_slow_statements,
103+
conn_max_age => $conn_max_age,
104+
conn_keep_alive => $conn_keep_alive,
105+
conn_lifetime => $conn_lifetime,
106+
puppetdb_package => $puppetdb_package,
107+
puppetdb_service => $puppetdb_service,
108+
puppetdb_service_status => $puppetdb_service_status,
109+
confdir => $confdir,
110+
java_args => $java_args,
111+
max_threads => $max_threads,
112+
read_database => $read_database,
113+
read_database_host => $read_database_host,
114+
read_database_port => $read_database_port,
115+
read_database_username => $read_database_username,
116+
read_database_password => $read_database_password,
117+
read_database_name => $read_database_name,
118+
read_database_ssl => $read_database_ssl,
119+
read_database_jdbc_ssl_properties => $read_database_jdbc_ssl_properties,
120+
read_database_validate => $read_database_validate,
121+
read_log_slow_statements => $read_log_slow_statements,
122+
read_conn_max_age => $read_conn_max_age,
123+
read_conn_keep_alive => $read_conn_keep_alive,
124+
read_conn_lifetime => $read_conn_lifetime,
125+
puppetdb_user => $puppetdb_user,
126+
puppetdb_group => $puppetdb_group,
127+
manage_firewall => $manage_firewall,
128+
command_threads => $command_threads,
129+
store_usage => $store_usage,
130+
temp_usage => $temp_usage,
127131
}
128132

129133
if ($database == 'postgres') {

manifests/params.pp

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@
1919
$postgres_version = '9.4'
2020

2121
# The remaining database settings are not used for an embedded database
22-
$database_host = 'localhost'
23-
$database_port = '5432'
24-
$database_name = 'puppetdb'
25-
$database_username = 'puppetdb'
26-
$database_password = 'puppetdb'
27-
$database_ssl = false
28-
$database_validate = true
22+
$database_host = 'localhost'
23+
$database_port = '5432'
24+
$database_name = 'puppetdb'
25+
$database_username = 'puppetdb'
26+
$database_password = 'puppetdb'
27+
$database_ssl = undef
28+
$jdbc_ssl_properties = ''
29+
$database_validate = true
2930

3031
# These settings manage the various auto-deactivation and auto-purge settings
3132
$node_ttl = '0s'
@@ -42,18 +43,19 @@
4243
$max_threads = undef
4344

4445
# These settings are for the read database
45-
$read_database = 'postgres'
46-
$read_database_host = undef
47-
$read_database_port = '5432'
48-
$read_database_name = 'puppetdb'
49-
$read_database_username = 'puppetdb'
50-
$read_database_password = 'puppetdb'
51-
$read_database_ssl = false
52-
$read_database_validate = true
53-
$read_log_slow_statements = '10'
54-
$read_conn_max_age = '60'
55-
$read_conn_keep_alive = '45'
56-
$read_conn_lifetime = '0'
46+
$read_database = 'postgres'
47+
$read_database_host = undef
48+
$read_database_port = '5432'
49+
$read_database_name = 'puppetdb'
50+
$read_database_username = 'puppetdb'
51+
$read_database_password = 'puppetdb'
52+
$read_database_ssl = undef
53+
$read_database_jdbc_ssl_properties = ''
54+
$read_database_validate = true
55+
$read_log_slow_statements = '10'
56+
$read_conn_max_age = '60'
57+
$read_conn_keep_alive = '45'
58+
$read_conn_lifetime = '0'
5759

5860
$manage_firewall = true
5961
$java_args = {}

0 commit comments

Comments
 (0)