PostgreSQL La base de donnees la plus sophistiquee au monde.

Forums PostgreSQL.fr

Le forum officiel de la communauté francophone de PostgreSQL

Vous n'êtes pas identifié(e).

#1 16/03/2016 15:30:21

Nicotyrox
Membre

Problème d'authentification phpPgAdmin / PGSQL

Bonjour,

Je rencontre des problèmes avec phpPgAdmin, que j'ai besoin d'avoir en association avec PostgreSQL pour lancer un projet Silverpeas.

Normallement,  le serveur Postgresql est correctement configuré puisque que j'ai pus crée un identifiant silverpeas, creer sa base de donnée propriétaire et m'y connecter en utilisant la commande "pgsql -U silverpeas silverpeas".

Maintenant, je veux faire tourner phpPgAdmin, sur le même serveur Centos 6.7 que Postgresql (version 9.5).
Quand je veux me connecter, j'ai un message d'echec, et quand je fais des tests pour modifier la conf, quelque fois, il m'oindique que j'attaque le systèmes.
Quand je regarde les logs de PGSQL après une tentative de connection, j'ai ce message :

< 2016-03-16 11:32:39.378 CET >LOG:  could not connect to Ident server at address "::1", port 113: Connection refused
< 2016-03-16 11:32:39.378 CET >FATAL:  Ident authentication failed for user "silverpeas"
< 2016-03-16 11:32:39.378 CET >DETAIL:  Connection matched pg_hba.conf line 84: "host    all             all             ::1/128                 ident"

Mais, mon /var/lib/pgsql/9.5/data/pg_hba.conf ressemble à ça :

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     md5
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
host    all             all             ::1/128                 md5
host    all             all             10.1.1.0/8              md5

Et j'ai cherché pour le fichier /var/lib/pgsql/9.5/data/postgresql.conf:

listen_addresses = 'localhost'

Et phpPgAdmin est configuré comme çi :

// use 'localhost' for TCP/IP connection on this computer
        $conf['servers'][0]['host'] = 'localhost';

        // Database port on server (5432 is the PostgreSQL default)
        $conf['servers'][0]['port'] = 5432;

        // Database SSL mode
        // Possible options: disable, allow, prefer, require
        // To require SSL on older servers use option: legacy
        // To ignore the SSL mode, use option: unspecified
        $conf['servers'][0]['sslmode'] = 'allow';

        // Change the default database only if you cannot connect to template1.
        // For a PostgreSQL 8.1+ server, you can set this to 'postgres'.
        $conf['servers'][0]['defaultdb'] = 'silverpeas';

Que faire ?

Dernière modification par Nicotyrox (16/03/2016 15:30:40)

Hors ligne

#2 16/03/2016 15:58:25

ruizsebastien
Membre

Re : Problème d'authentification phpPgAdmin / PGSQL

Bonjour,

Avec psql, que vous renvoie : select name, setting from pg_settings where name ='hba_file';

le chemin retourné correspond t'il à l'endroit où vous cherchez votre pg_hba.conf ?


Cordialement,

Sébastien.

Hors ligne

#3 16/03/2016 16:17:09

Nicotyrox
Membre

Re : Problème d'authentification phpPgAdmin / PGSQL

silverpeas=>  select name, setting from pg_settings where name ='hba_file';
name | setting
------+---------
(0 rows)

Ok intéressant, comment y remedier ?

Hors ligne

#4 16/03/2016 17:07:30

ruizsebastien
Membre

Re : Problème d'authentification phpPgAdmin / PGSQL

pour avoir un résultat il faut être superuser (postgres par exemple).


Cordialement,

Sébastien.

Hors ligne

#5 16/03/2016 17:10:25

Nicotyrox
Membre

Re : Problème d'authentification phpPgAdmin / PGSQL

Effectivement, excusez moi.

silverpeas=# select name, setting from pg_settings where name ='hba_file';
   name   |               setting
----------+-------------------------------------
hba_file | /var/lib/pgsql/9.5/data/pg_hba.conf
(1 row)

Hors ligne

#6 16/03/2016 17:47:30

ruizsebastien
Membre

Re : Problème d'authentification phpPgAdmin / PGSQL

et donc on peut avoir le contenu entier du fichier /var/lib/pgsql/9.5/data/pg_hba.conf ?


Cordialement,

Sébastien.

Hors ligne

#7 16/03/2016 18:36:05

Nicotyrox
Membre

Re : Problème d'authentification phpPgAdmin / PGSQL

# PostgreSQL Client Authentication Configuration File
# ===================================================
#
# Refer to the "Client Authentication" section in the PostgreSQL
# documentation for a complete description of this file.  A short
# synopsis follows.
#
# This file controls: which hosts are allowed to connect, how clients
# are authenticated, which PostgreSQL user names they can use, which
# databases they can access.  Records take one of these forms:
#
# local      DATABASE  USER  METHOD  [OPTIONS]
# host       DATABASE  USER  ADDRESS  METHOD  [OPTIONS]
# hostssl    DATABASE  USER  ADDRESS  METHOD  [OPTIONS]
# hostnossl  DATABASE  USER  ADDRESS  METHOD  [OPTIONS]
#
# (The uppercase items must be replaced by actual values.)
#
# The first field is the connection type: "local" is a Unix-domain
# socket, "host" is either a plain or SSL-encrypted TCP/IP socket,
# "hostssl" is an SSL-encrypted TCP/IP socket, and "hostnossl" is a
# plain TCP/IP socket.
#
# DATABASE can be "all", "sameuser", "samerole", "replication", a
# database name, or a comma-separated list thereof. The "all"
# keyword does not match "replication". Access to replication
# must be enabled in a separate record (see example below).
#
# USER can be "all", a user name, a group name prefixed with "+", or a
# comma-separated list thereof.  In both the DATABASE and USER fields
# you can also write a file name prefixed with "@" to include names
# from a separate file.
#
# ADDRESS specifies the set of hosts the record matches.  It can be a
# host name, or it is made up of an IP address and a CIDR mask that is
# an integer (between 0 and 32 (IPv4) or 128 (IPv6) inclusive) that
# specifies the number of significant bits in the mask.  A host name
# that starts with a dot (.) matches a suffix of the actual host name.
# Alternatively, you can write an IP address and netmask in separate
# columns to specify the set of hosts.  Instead of a CIDR-address, you
# can write "samehost" to match any of the server's own IP addresses,
# or "samenet" to match any address in any subnet that the server is
# directly connected to.
#
# METHOD can be "trust", "reject", "md5", "password", "gss", "sspi",
# "ident", "peer", "pam", "ldap", "radius" or "cert".  Note that
# "password" sends passwords in clear text; "md5" is preferred since
# it sends encrypted passwords.
#
# OPTIONS are a set of options for the authentication in the format
# NAME=VALUE.  The available options depend on the different
# authentication methods -- refer to the "Client Authentication"
# section in the documentation for a list of which options are
# available for which authentication methods.
#
# Database and user names containing spaces, commas, quotes and other
# special characters must be quoted.  Quoting one of the keywords
# "all", "sameuser", "samerole" or "replication" makes the name lose
# its special character, and just match a database or username with
# that name.
#
# This file is read on server startup and when the postmaster receives
# a SIGHUP signal.  If you edit the file on a running system, you have
# to SIGHUP the postmaster for the changes to take effect.  You can
# use "pg_ctl reload" to do that.

# Put your actual configuration here
# ----------------------------------
#
# If you want to allow non-local connections, you need to add more
# "host" records.  In that case you will also need to make PostgreSQL
# listen on a non-local interface via the listen_addresses
# configuration parameter, or via the -i or -h command line switches.



# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     md5
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
host    all             all             ::1/128                 md5
host    all             all             10.1.1.0/8              md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local   replication     postgres                                peer
#host    replication     postgres        127.0.0.1/32            ident
#host    replication     postgres        ::1/128                 ident

Hors ligne

#8 16/03/2016 18:43:51

ruizsebastien
Membre

Re : Problème d'authentification phpPgAdmin / PGSQL

Bonjour,

Ce fichier ne correspond pas au message d'erreur.
J'imagine que vous avez modifié le fichier tel que vous nous l'avez envoyé et que vous n'avez pas relancé le serveur (ou fait un reload de la conf) ?


Cordialement,

Sébastien.

Hors ligne

#9 17/03/2016 10:12:18

Nicotyrox
Membre

Re : Problème d'authentification phpPgAdmin / PGSQL

Bon, en effet, après un restart, ça a fonctionné. Je faisais que des reloads, pour moi ça suffisait mais visiblement non.
Merci beaucoup, et désolé du post.

Hors ligne

#10 17/03/2016 10:17:08

ruizsebastien
Membre

Re : Problème d'authentification phpPgAdmin / PGSQL

si, normalement un reload suffit. étrange...


Cordialement,

Sébastien.

Hors ligne

Pied de page des forums