Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 964315

Summary: Installation fails with external postgres db if postgres user has no "ident" auth rights
Product: [Community] Spacewalk Reporter: Michele Baldessari <michele>
Component: InstallationAssignee: Jan Pazdziora (Red Hat) <jpazdziora>
Status: CLOSED NOTABUG QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: low Docs Contact:
Priority: low    
Version: 1.10CC: jpazdziora
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-05-18 13:02:47 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1484117    

Description Michele Baldessari 2013-05-17 20:45:29 UTC
Description of problem:
Playing with today's nightly rpms (rainy evening..I know), I have created a user+db for spacewalk in postgres. After launching:
# spacewalk-setup --disconnected --external-db
** Database: Setting up database connection for PostgreSQL backend.

Hostname (leave empty for local)? localhost
Port [5432]? 
Database? spacewalk
Username? spacewalk
Password? 
** Database: Populating database.
The Database has schema.  Would you like to clear the database [Y]? 
** Database: Clearing database.
** Database: Shutting down spacewalk services that may be using DB.
** Database: Services stopped.  Clearing DB.
** Database: Re-populating database.
*** Progress: ########################
Could not populate database.

Log file at /var/log/rhn/populate_db.log gave me:

psql:/etc/sysconfig/rhn/postgres/deploy.sql:42485: ERROR:  could not establish connection
DETAIL:  fe_sendauth: no password supplied

CONTEXT:  SQL statement "SELECT dblink_connect('at_conn', 'dbname=' || current_database() || ' port=' || coalesce(inet_server_port(), '5432'))"
PL/pgSQL function pg_dblink_exec(character varying) line 6 at PERFORM
SQL statement "SELECT pg_dblink_exec(
                'insert into rhnPackageName(id, name) values (' || name_id || ', ' ||
                coalesce(quote_literal(name_in), 'NULL') || ')')"
PL/pgSQL function lookup_package_name(character varying,numeric) line 17 at PERFORM

So I realized that in /var/lib/pgsql/data/pg_hba.conf I had for some reason:
local   all             all                                     md5

instead of:
local   all             all                                     ident

No biggie really, but it might be nice to check for postgres user access before starting if it cannot be avoided.

Version-Release number of selected component (if applicable):
postgresql-contrib-9.2.4-1.fc18.x86_64
spacewalk-setup-embedded-postgresql-1.10.1-1.fc18.noarch
spacewalk-backend-sql-postgresql-1.10.32-1.fc18.noarch
postgresql-server-9.2.4-1.fc18.x86_64
postgresql-libs-9.2.4-1.fc18.x86_64
postgresql-jdbc-9.2.1002-1.fc18.noarch
spacewalk-postgresql-1.9.2-1.fc18.noarch
spacewalk-java-postgresql-1.10.76-1.fc18.noarch
postgresql-9.2.4-1.fc18.x86_64

Comment 1 Jan Pazdziora (Red Hat) 2013-05-18 13:02:47 UTC
You don't need the full

   local all all ident

privileges, the

   local spaceschema postgres ident

is enough. We list that as a required pg_hba.conf configuration on the page

   https://fedorahosted.org/spacewalk/wiki/PostgreSQLServerSetup

Comment 2 Eric Herget 2017-09-28 18:09:57 UTC
This BZ closed some time during 2.5, 2.6 or 2.7.  Adding to 2.7 tracking bug.