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

Postgresql plugin does not support SCRAM-SHA-256 authentication #7438

Closed
vitalca opened this issue Apr 29, 2020 · 2 comments
Closed

Postgresql plugin does not support SCRAM-SHA-256 authentication #7438

vitalca opened this issue Apr 29, 2020 · 2 comments
Labels
area/postgresql feature request Requests for new plugin and for new features to existing plugins help wanted Request for community participation, code, contribution size/m 2-4 day effort

Comments

@vitalca
Copy link

vitalca commented Apr 29, 2020

Relevant telegraf.conf:

[[inputs.postgresql]]
    address = "postgres://$PG_USERNAME:$PG_PASSWORD@$PG_HOST/$PG_DBNAME"
    databases = ["$PG_DBNAME"]

System info:

  • telegraf 1.8 (official Docker image)
  • Postgres 12

Steps to reproduce:

  1. enable SCRAM-SHA-256 authentication
ALTER SYSTEM SET password_encryption = 'scram-sha-256';
  1. update passwords to recalculate hashes
ALTER ROLE username PASSWORD 'xxx';
  1. update pg_hba.conf
  2. reload configs
SELECT pg_reload_conf();
  1. try to start telegraf

Expected behavior:

No issues

Actual behavior:

E! Error in plugin [inputs.postgresql]: unknown authentication type: 10

Temporary workaround:

Configure trust authentication for telegraf in the pg_hba.conf

@danielnelson danielnelson added area/postgresql feature request Requests for new plugin and for new features to existing plugins labels Apr 29, 2020
@danielnelson
Copy link
Contributor

This would be a good addition, do you think it is something you could work on?

related: jackc/pgx@5044e84

@danielnelson danielnelson added the help wanted Request for community participation, code, contribution label Apr 29, 2020
@powersj powersj added the size/m 2-4 day effort label Aug 4, 2022
@powersj
Copy link
Contributor

powersj commented Aug 16, 2022

Hi,

It looks like this was added to the library Telegraf uses here. I tried launching a container with docker run --rm --name postgres --net host -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=password -e POSTGRES_INITDB_ARGS=--auth-host=scram-sha-256 postgres and was able to connect successfully:

postgresql,db=postgres,host=ryzen,server=dbname\=postgres\ host\=localhost\ user\=postgres tup_inserted=0i,datname="postgres",sessions_fatal=0i,sessions_abandoned=0i,tup_updated=0i,xact_commit=5i,blk_read_time=0,datid=13757i,deadlocks=0i,blks_read=171i,active_time=0.414,temp_bytes=0i,tup_returned=2907i,numbackends=1i,tup_deleted=0i,blks_hit=3038i,xact_rollback=0i,blk_write_time=0,temp_files=0i,sessions_killed=0i,sessions=2i,session_time=5.272,tup_fetched=1520i,conflicts=0i,idle_in_transaction_time=0 1660678797000000000
postgresql,db=postgres,host=ryzen,server=dbname\=postgres\ host\=localhost\ user\=postgres buffers_alloc=73i,buffers_backend_fsync=0i,checkpoints_req=1i,buffers_clean=0i,checkpoint_write_time=1,buffers_checkpoint=0i,maxwritten_clean=0i,buffers_backend=0i,checkpoint_sync_time=2,checkpoints_timed=0i 1660678797000000000

I'm going to mark this as closed, but if you are still seeing this issue, please do reply and let us know along with how to reproduce and telegraf logs.

Thanks!

@powersj powersj closed this as completed Aug 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/postgresql feature request Requests for new plugin and for new features to existing plugins help wanted Request for community participation, code, contribution size/m 2-4 day effort
Projects
None yet
Development

No branches or pull requests

3 participants