pgadmin-org / pgagent

pgAgent - A job scheduler for PostgreSQL
https://www.pgadmin.org/
Other
97 stars 41 forks source link

PgAgent 4.2.2 as released has broken connection string support #27

Closed infraweavers closed 1 year ago

infraweavers commented 1 year ago

Hello!

Installing PgAgent 4.2.2 (http://apt.postgresql.org/pub/repos/apt/pool/main/p/pgagent/pgagent_4.2.2-2.pgdg100%2B1_amd64.deb) on Debian 10 it appears that you can't use a full connection string (for example ./pgagent -l 2 -f hostaddr=pgagentserver dbname=postgres user=pgagent_login_user password=ourverysecurepassword) this worked fine under 4.2.1 (on Debian 9 for example)

The error output is something like:

./pgagent -l 2 -f hostaddr=pgagentserver dbname=postgres user=pgagent_login_user password=ourverysecurepassword
Thu Nov 3 15:22:18 2022 DEBUG: Creating primary connection
Thu Nov 3 15:22:18 2022 DEBUG: Parsing connection information...
Thu Nov 3 15:22:18 2022 DEBUG: Creating DB connection: user=pgagent_login_user password=***** dbname=postgres hostaddr=pgagentserver dbname=postgres
Thu Nov 3 15:22:18 2022 WARNING: Failed to create primary connection: connection to server at "pgagentserver", port 5432 failed: FATAL:  password authentication failed for user "pgagent_login_user"
connection to server at "pgagentserver", port 5432 failed: FATAL:  password authentication failed for user "pgagent_login_user"
Thu Nov 3 15:22:18 2022 WARNING: Couldn't create the primary connection [Attempt #1]
Thu Nov 3 15:22:18 2022 DEBUG: Clearing all connections
Thu Nov 3 15:22:18 2022 DEBUG: No connections found!

This has been fixed in this commit (we have built and tested this in the lab) https://github.com/pgadmin-org/pgagent/commit/a172ef5aac4d6750b284ec6e18343f399e936019 however for some reason this fix isn't included in the 4.2.2 release even though (as far as I can see) it should have been?

dpage commented 1 year ago

That commit was made after 4.2.2 was released; see https://github.com/pgadmin-org/pgagent/commits/pgagent-4.2.2. Note that the project move its downloads to Github after that release, which is the date on the download is much newer.

I'd also note that it's very much not recommended that you include the password in a connection string as that's quite insecure. Consider using certificates or a .pgpass file instead.

infraweavers commented 1 year ago

Aha, I understand the confusion then. We were looking at the date on https://github.com/pgadmin-org/pgagent/releases/tag/pgagent-4.2.2 to indicate the release date.