Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 189854 - dev-db/postgresql - pg_autovacuum fails if postgres user needs a password to log in
Summary: dev-db/postgresql - pg_autovacuum fails if postgres user needs a password to ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: PgSQL Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-22 15:45 UTC by Richard Ash
Modified: 2010-06-04 14:22 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
patch to make all database access come from one system account (pg_autovacuum.patch,957 bytes, patch)
2007-08-22 15:48 UTC, Richard Ash
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Ash 2007-08-22 15:45:57 UTC
If postgreSQL is configured to require a password to log in from localhost (e.g. for security with untrusted users), then pg_autovacuum won't start, because it can't log in (not that the error says so).

You can't easily fix this with a .pgpass file because the init script accesses the database as two different system users. The test of whether the database is up is made running as root, whilst the actual daemon runs as system user postgres, both logging in as database user postgres.

The fix is two-fold:
1) create a file /var/lib/postgresql/.pgpass which contains a single line:
localhost:5432:*:<POSTGRES USER>:<PASSWORD>
(changing the port if needed and setting the database superuser and password appropriately). Set this file to be owned by the postgres system account (the one that runs the postgres database server), with no access for the user or group to the file.

2) Apply a patch to the init script to make it do all the database access as the postgres system user and not root. This patch will work fine for all users as it uses the existing PGUSER variable from /etc/conf.d/pg_autovacuum
Comment 1 Richard Ash 2007-08-22 15:48:07 UTC
Created attachment 128881 [details, diff]
patch to make all database access come from one system account

This is the patch required to /etc/init.d/pg_autovacuum to always access the database from the system account specified in ./etc/conf.d/pg_autovacuum
Comment 2 Aaron W. Swenson gentoo-dev 2010-03-24 00:09:53 UTC
Addressed in bug #311047
Comment 3 Patrick Lauer gentoo-dev 2010-06-04 14:22:00 UTC
Committed