Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unexpected authentication response #31

Open
itshikanov opened this issue Dec 21, 2023 · 0 comments
Open

unexpected authentication response #31

itshikanov opened this issue Dec 21, 2023 · 0 comments

Comments

@itshikanov
Copy link

Hello, i'm got problem with authentication of exporter.

postgresql: 15
pgpool-II version 4.4.5 (nurikoboshi)
pgpool2_exporter-1.2.1.linux-amd64.tar.gz

I'm configure passthrough authentication in pgpool and try to use pgpool_exporter to get metrics. When i'm start exporter i'm got error.

~/pgpool_exporter/pgpool2_exporter-1.2.1.linux-amd64#

DATA_SOURCE_USER=test DATA_SOURCE_PASS=test DATA_SOURCE_URI="192.168.50.1:5430/test?sslmode=disable" ./pgpool2_exporter
ts=2023-12-21T08:41:04.767Z caller=pgpool2_exporter.go:231 level=error err="error connecting to Pgpool-II: pq: unexpected authentication response: 'R'"

This is my settings of pgpool

pool_hba.conf:

host  all             all             all            password

my pgpool.conf template

listen_addresses = '*'
port = 5430

ssl = false
ssl_key = 'path_to_file'
ssl_cert = 'path_to_file'

pid_file_name = '/tmp/pgpool.pid'

enable_pool_hba = true
allow_clear_text_frontend_auth = false

pool_passwd  = ''

connection_cache = off

connection_life_time = 5

load_balance_mode = on

# disable_load_balance_on_write = transaction

failover_on_backend_error = off

num_init_children = 500
max_pool = 1

sr_check_period = 0                                     # default = 0. Disable check of replica lag.

health_check_period = 0                                 # Default 0. We use haproxy. Do not check backend

backend_clustering_mode = 'streaming_replication'

backend_hostname0 = '127.0.0.1'                         # Host name or IP address to connect to for backend 0
backend_port0 = 5428                 # Port number for backend 0
backend_weight0 = 1                                     # Weight for backend 0 (only in load balancing mode)
#backend_data_directory0 = '/var/lib/postgresql/11/main'# Data directory for backend 0
backend_flag0 = 'ALWAYS_PRIMARY|DISALLOW_TO_FAILOVER'   # always primary  !

backend_hostname1 = '127.0.0.1'                         # Host name or IP address to connect to for backend 0
backend_port1 = 5429                # Port number for backend 1
backend_weight1 = 2                                     # Weight for backend 1 (only in load balancing mode)

backend_flag1 = 'DISALLOW_TO_FAILOVER'

auto_failback = off                                     # Streaming Replication Check needed(sr_check_period), and user and password
auto_failback_interval = 5

log_connections = off  # when enable and give load . got error child process with pid: was terminated by segmentation fault. And client disconected. BUG ?
log_disconnections = off
log_statement = off
log_per_node_statement = on
log_client_messages = off
log_error_verbosity = terse

Traffic is:

####
T 192.168.50.201:51180 -> 192.168.50.1:5430 [AP] #27
  ...^....user.test.datestyle.ISO, MDY.client_encoding.UTF8.database.test.extra_float_digits.2..                                                          
##
T 192.168.50.1:5430 -> 192.168.50.201:51180 [AP] #29
  R........                                                                                                                                               
##
T 192.168.50.201:51180 -> 192.168.50.1:5430 [AP] #31
  p....test.                                                                                                                                              
#
T 192.168.50.1:5430 -> 192.168.50.201:51180 [AP] #32
  R........SCRAM-SHA-256..                                                                                                                                
####

On string R........SCRAM-SHA-256.. fail occured

Postgresql command psql - work well while pgpool_exporter is failed

PGPASSWORD='test' psql -h 192.168.50.1 -U test -p 5430 -d test"

I'm found workaround
enable_pool_hba = false
allow_clear_text_frontend_auth = true

But this option add 3 line in log on every connection(that need not! You can reduce this lines to 1 by log_error_verbosity = terse option )

# [pgpool] 2023-12-13 15:56:27.159: child pid 687: HINT:  you can disable this behavior by setting allow_clear_text_frontend_auth to off
# [pgpool] 2023-12-13 15:56:27.332: psql pid 684: LOG:  using clear text authentication with frontend
# [pgpool] 2023-12-13 15:56:27.332: psql pid 684: DETAIL:  backend will still use SCRAM auth

SCRAM not used at all in this configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant