3
0

OP#207fix variable relationship and add firewall rule

This commit is contained in:
12ww1160
2025-12-05 16:21:33 +01:00
parent a830a3adfd
commit 58e12e6714
4 changed files with 20 additions and 12 deletions

View File

@@ -3,11 +3,11 @@
# Author: 12ww1160 (12ww1160@confdroid.com) # Author: 12ww1160 (12ww1160@confdroid.com)
# @summary Class manages the pgbouncer service # @summary Class manages the pgbouncer service
# @example confdroid_postgresql::bouncer::bouncer_rule { 'test connection': # @example confdroid_postgresql::bouncer::bouncer_rule { 'test connection':
# pl_bouncer_db_name => 'test', # pl_bouncer_db_name => 'test',
# pl_bouncer_host => '127.0.0.7', # pl_bouncer_host => '127.0.0.7',
# pl_bouncer_port => '5432', # pl_bouncer_host_port => '5432',
# pl_bouncer_user => 'test_user', # pl_bouncer_user => 'test_user',
# pl_bouncer_order => '001', # pl_bouncer_order => '001',
# } # }
############################################################################### ###############################################################################
class confdroid_postgresql::bouncer::bouncer ( class confdroid_postgresql::bouncer::bouncer (

View File

@@ -5,18 +5,18 @@
# @see https://www.postgresql.org/docs/9.6/static/auth-pg-hba-conf.html # @see https://www.postgresql.org/docs/9.6/static/auth-pg-hba-conf.html
# @param [String] pl_bouncer_db_name db name for the bouncer rule # @param [String] pl_bouncer_db_name db name for the bouncer rule
# @param [String] pl_bouncer_host IP of the db host to bounce to # @param [String] pl_bouncer_host IP of the db host to bounce to
# @param [String] pl_bouncer_port port of the db host to bounce to # @param [String] pl_bouncer_host_port port of the db host to bounce to
# @param [String] pl_bouncer_user user for the connection. Must be defined in # @param [String] pl_bouncer_user user for the connection. Must be defined in
# userlist.txt # userlist.txt
# @param [String] pl_bouncer_order the order in which the rule should appear # @param [String] pl_bouncer_order the order in which the rule should appear
############################################################################## ##############################################################################
define confdroid_postgresql::bouncer::bouncer_rule ( define confdroid_postgresql::bouncer::bouncer_rule (
String $pl_bouncer_db_name = undef, String $pl_bouncer_db_name = undef,
String $pl_bouncer_host = '127.0.0.1', String $pl_bouncer_host = '127.0.0.1',
String $pl_bouncer_port = '5432', String $pl_bouncer_host_port = '5432',
String $pl_bouncer_user = undef, String $pl_bouncer_user = undef,
String $pl_bouncer_order = undef, String $pl_bouncer_order = undef,
) { ) {
$pl_bouncer_ini_file = $confdroid_postgresql::params::pl_bouncer_ini_file $pl_bouncer_ini_file = $confdroid_postgresql::params::pl_bouncer_ini_file

View File

@@ -13,5 +13,13 @@ class confdroid_postgresql::firewall::iptables (
dport => $pl_fw_port, dport => $pl_fw_port,
jump => 'accept', jump => 'accept',
} }
if $pl_use_pg_bouncer == true {
firewall { "${pl_fw_rule_order}${pl_bouncer_port} tcp port ${pl_bouncer_port}":
source => $pl_source_range,
proto => 'tcp',
dport => $pl_bouncer_port,
jump => 'accept',
}
}
} }
} }

View File

@@ -1 +1 @@
<%= @pl_bouncer_db_name %> = host=<%= @pl_bouncer_host %> port=<%= @pl_bouncer_port %> auth_user=<%= @pl_bouncer_user %> dbname=<%= @pl_bouncer_db_name %> <%= @pl_bouncer_db_name %> = host=<%= @pl_bouncer_host %> port=<%= @pl_bouncer_host_port %> auth_user=<%= @pl_bouncer_user %> dbname=<%= @pl_bouncer_db_name %>