File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2323 end
2424
2525 newparam ( :use_ssl ) do
26- desc 'Whether the connection will be attemped using https'
26+ desc 'Whether the connection will be attempted using https'
2727 defaultto true
2828 end
2929
Original file line number Diff line number Diff line change 1010 $manage_server = $puppetdb::params::manage_dbserver,
1111 $manage_package_repo = $puppetdb::params::manage_pg_repo,
1212 $postgres_version = $puppetdb::params::postgres_version,
13+ $postgresql_ssl_on = $puppetdb::params::postgresql_ssl_on
1314) inherits puppetdb::params {
1415
1516 if $manage_server {
2425 port => scanf($database_port , ' %i' )[0],
2526 }
2627
28+ # configure PostgreSQL communication with Puppet Agent SSL certificates if
29+ # postgresql_ssl_on is set to true
30+ if $postgresql_ssl_on {
31+ postgresql::server::config_entry {'ssl' :
32+ ensure => present ,
33+ value => ' on' ,
34+ }
35+
36+ postgresql::server::config_entry {'ssl_key_file' :
37+ ensure => present ,
38+ value => $postgresql_ssl_key_path ,
39+ }
40+
41+ postgresql::server::config_entry {'ssl_cert_file' :
42+ ensure => present ,
43+ value => $postgresql_ssl_cert_path ,
44+ }
45+
46+ postgresql::server::config_entry {'ssl_ca_file' :
47+ ensure => present ,
48+ value => $postgresql_ssl_ca_cert_path ,
49+ }
50+ }
51+
2752 # Only install pg_trgm extension, if database it is actually managed by the module
2853 if $manage_database {
2954
Original file line number Diff line number Diff line change 1919 $ssl_cert = $puppetdb::params::ssl_cert,
2020 $ssl_ca_cert = $puppetdb::params::ssl_ca_cert,
2121 $ssl_protocols = $puppetdb::params::ssl_protocols,
22+ $postgresql_ssl_on = $puppetdb::params::postgresql_ssl_on,
23+ $postgresql_ssl_folder = $puppetdb::params::postgresql_ssl_folder,
24+ $postgresql_ssl_cert_path = $puppetdb::params::postgresql_ssl_cert_path,
25+ $postgresql_ssl_key_path = $puppetdb::params::postgresql_ssl_key_path,
26+ $postgresql_ssl_ca_cert_path = $puppetdb::params::postgresql_ssl_ca_cert_path,
2227 $cipher_suites = $puppetdb::params::cipher_suites,
2328 $migrate = $puppetdb::params::migrate,
2429 $manage_dbserver = $puppetdb::params::manage_dbserver,
Original file line number Diff line number Diff line change 180180 $cleanup_timer_interval = " *-*-* ${fqdn_rand(24)}:${fqdn_rand(60)}:00"
181181 $dlo_max_age = 90
182182
183+ # certificats used for PostgreSQL SSL configuration. Puppet certificates are used
184+ $postgresql_ssl_on = true
185+ $postgresql_ssl_folder = " ${puppet_confdir} /ssl"
186+ $postgresql_ssl_cert_path = " ${postgresql_ssl_folder} /certs/${trusted['certname']}.pem"
187+ $postgresql_ssl_key_path = " ${postgresql_ssl_folder} /private_keys/${trusted['certname']}.pem"
188+ $postgresql_ssl_ca_cert_path = " ${postgresql_ssl_folder} /certs/ca.pem"
189+
190+ # certificats used for Jetty configuration
183191 $ssl_set_cert_paths = false
184192 $ssl_cert_path = " ${ssl_dir} /public.pem"
185193 $ssl_key_path = " ${ssl_dir} /private.pem"
Original file line number Diff line number Diff line change 2525 $puppetdb_group = $puppetdb::params::puppetdb_group,
2626 $database_max_pool_size = $puppetdb::params::database_max_pool_size,
2727 $migrate = $puppetdb::params::migrate,
28+ $postgresql_ssl_on = $puppetdb::params::postgresql_ssl_on
2829) inherits puppetdb::params {
2930
3031 if str2bool($database_validate ) {
8788
8889 $subname = " //${database_host} :${database_port} /${database_name}${database_suffix} "
8990
91+ if $postgresql_ssl_on {
92+ $subname += @(" EOT" )
93+ ?ssl=true &sslfactory=org.postgresql.ssl.LibPQFactory&
94+ sslmode=verify-full&sslrootcert=${ssl_ca_cert_path} &
95+ sslkey=${ssl_key_path} &sslcert=${ssl_cert_path}
96+ |-EOT
97+ }
98+
9099 # #Only setup for postgres
91100 ini_setting {'puppetdb_psdatabase_username' :
92101 setting => ' username' ,
Original file line number Diff line number Diff line change 1717 $puppetdb_user = $puppetdb::params::puppetdb_user,
1818 $puppetdb_group = $puppetdb::params::puppetdb_group,
1919 $database_max_pool_size = $puppetdb::params::read_database_max_pool_size,
20+ $postgresql_ssl_on = $puppetdb::params::postgresql_ssl_on
2021) inherits puppetdb::params {
2122
2223 # Only add the read database configuration if database host is defined.
7576
7677 $subname = " //${database_host} :${database_port} /${database_name}${database_suffix} "
7778
79+ if $postgresql_ssl_on {
80+ $subname += @(" EOT" )
81+ ?ssl=true &sslfactory=org.postgresql.ssl.LibPQFactory&
82+ sslmode=verify-full&sslrootcert=${ssl_ca_cert_path} &
83+ sslkey=${ssl_key_path} &sslcert=${ssl_cert_path}
84+ |-EOT
85+ }
86+
7887 ini_setting { 'puppetdb_read_database_username' :
7988 setting => ' username' ,
8089 value => $database_username ,
You can’t perform that action at this time.
0 commit comments