Where and how is password encryption configured in PgBouncer settings?
sobes.tech AI
Answer from AI
In PgBouncer, password encryption on the client side is not configured directly, as PgBouncer acts as a proxy for PostgreSQL. However, for storing user passwords in the userlist.txt file, hashed passwords can be used.
To set password encryption:
-
In the
userlist.txtfile, passwords can be specified as MD5 hashes, for example:"username" "md5<md5hash>"where
<md5hash>is the MD5 hash of the password in PostgreSQL format. -
In the
pgbouncer.iniconfiguration file, theauth_typeparameter determines the authentication method, for example:auth_type = md5— for using MD5 password hashes.auth_type = trust— without a password.
-
The
auth_fileparameter specifies the path to the file with users and passwords (usuallyuserlist.txt).
Thus, password encryption is indirectly set through the format of stored passwords in userlist.txt and the authentication method chosen in pgbouncer.ini.
Example line in userlist.txt:
"user1" "md5c3ab8ff13720e8ad9047dd39466b3c89"
where c3ab8ff13720e8ad9047dd39466b3c89 is the MD5 hash of the password.