SCRAM on PostgreSQL in Jitterbit private agents
Introduction
This page explains how to change your PostgreSQL installation's password encryption from MD5 to SCRAM-SHA-256. Follow the steps in these sections in sequence. (Run the SQL command as the PostgreSQL admin user.)
Fresh installations of Linux private agents use SCRAM-SHA-256 by default. This guide applies to upgraded Linux agents, which retain MD5 encryption, and Windows private agents.
Prerequisites
-
For Windows installations, access to a Microsoft Windows administrator account. For Linux installations, an account with root privileges.
Part 1: Reconfigure PostgreSQL
-
In a
psqlsession, check the current encryption method:SHOW password_encryption;Expected outputpassword_encryption --------------------- md5 (1 row) -
Edit the PostgreSQL instance's
postgresql.confandpg_hba.conffiles. These are usually located in the/opt/jitterbit/DataInterchange/pgsql/datadirectory on Linux and Docker, and theC:\Program Files\PostgreSQL\X\datafolder on Windows (whereXis the major version number).-
In
postgresql.conf, find thepassword_encryptionparameter and change its value frommd5toscram-sha-256. -
In
pg_hba.conf, change the values in theMETHODcolumns frommd5toscram-sha-md5for the desired connections.
-
-
In a
psqlsession, reload the configuration:SELECT pg_reload_conf(); -
Recheck the current encryption method:
SHOW password_encryption;Expected outputpassword_encryption --------------------- scram-sha-256 (1 row)
Part 2: Update user passwords
-
In a
psqlsession, list accounts using MD5 password encryption:SELECT rolname, rolpassword ~ '^SCRAM-SHA-256$' AS has_scram FROM pg_authid WHERE rolcanlogin;Tip
In a standard private agent system, there should be only two users listed,
postgresandjitterbit.Expected outputrolname | has_scram -----------+----------- postgres | f jitterbit | f (2 rows) -
For each account with
has_scramshowingf, update their passwords using the following command:ALTER ROLE <username> PASSWORD '<password>';-
<username>: The user's PostgreSQL username. -
<password>: A new password for the user.
Tip
You can reuse each account's existing password.
-
Part 3: Reconfigure PgBouncer
To reconfigure PgBouncer, follow these steps:
-
Get the SCRAM verifier hash string and record it:
SELECT rolname, rolpassword FROM pg_authid WHERE rolname = 'jitterbit';Make a note of the
rolpasswordvalue. (It should start withSCRAM-SHA-256.) -
Edit the PgBouncer's
users.txtfile, usually located in/opt/jitterbit/pgbouncer/share/doc/pgbouncer/on Linux, andC:\Program Files\Jitterbit Agent\pgbounceron Windows.Replace the hash value with the value of copied from the previous step.
Example users.txt with original hash"jitterbit" "md5b51676b2b6ff8113190a8e4df1b3a144"Example users.txt with updated hash"jitterbit" "SCRAM-SHA-256$4096:DaRaCof9KFmKvfxW/OIAsg==$gAmuj8MsIamBk/MsLmCrg2FO9FXeFBx+vmm0cUxXkXw=:mlH5eE3+AEdSniA0NPocfSt1BbcLAryftXhYWbMsaS0="
Part 4: Restart services
Restart the private agent:
jitterbit restart
"C:\Program Files\Jitterbit Agent\StopServices.bat"
"C:\Program Files\Jitterbit Agent\StartServices.bat"