Thread: phppgadmin : login failed

phppgadmin : login failed

From
arnaud gaboury
Date:
OS . Fedora 22. It is my localhost.

website : enl.global.
for phppgadmin : phppgadmin.enl.global

Nginx, php, postgresql

socket:
--------------------------
bash-4.3# ls -al /run/postgresql/

srwxrwxrwx  1 postgres postgres   0 May 28 10:10 .s.PGSQL.5432
-rw-------  1 postgres postgres  52 May 28 10:10 .s.PGSQL.5432.lock
--------------------------------

php-fpm running:
-------------------------------
● php-fpm.service - The PHP FastCGI Process Manager
   Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; enabled;
vendor preset: disabled)
   Active: active (running) since Thu 2015-05-28 09:24:26 CEST; 3s ago
 Main PID: 9784 (php-fpm)
   Status: "Ready to handle connections"
   CGroup: /system.slice/system-systemd\x2dnspawn.slice/systemd-nspawn@poppy.service/system.slice/php-fpm.service
           └─9784 php-fpm: master process (/etc/php-fpm.conf

May 28 09:24:26 poppy systemd[1]: Starting The PHP FastCGI Process Manager...
May 28 09:24:26 poppy systemd[1]: Started The PHP FastCGI Process Manager.
bash-4.3#

postgresql running:
---------------------------------
● postgresql.service - PostgreSQL database server
   Loaded: loaded (/etc/systemd/system/postgresql.service; enabled;
vendor preset: disabled)
   Active: active (running) since Thu 2015-05-28 09:12:00 CEST; 1h 11min ago
  Process: 9512 ExecStart=/usr/libexec/postgresql-ctl start -s -D
${PGDATA} -w -t 120 (code=exited, status=0/SUCCESS)
 Main PID: 8561 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/system-systemd\x2dnspawn.slice/systemd-nspawn@poppy.service/system.slice/postgresql.service
           ├─9516 /usr/bin/postgres -D /db/pgsql/data
           ├─9517 postgres: logger process
           ├─9525 postgres: checkpointer process
           ├─9526 postgres: writer process
           ├─9527 postgres: wal writer process
           ├─9528 postgres: autovacuum launcher process
           └─9529 postgres: stats collector process

May 28 09:11:49 poppy systemd[1]: Starting PostgreSQL database server...
May 28 09:11:49 poppy postgresql-ctl[9512]: LOG:  redirecting log
output to logging collector process
May 28 09:11:49 poppy postgresql-ctl[9512]: HINT:  Future log output
will appear in directory "/sto...ql".
May 28 09:12:00 poppy systemd[1]: Started PostgreSQL database server.
Hint: Some lines were ellipsized, use -l to show in full.

Nginx running
--------------------------
● nginx.service - The nginx HTTP and reverse proxy server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled;
vendor preset: disabled)
   Active: active (running) since Thu 2015-05-28 07:37:45 CEST; 2h 46min ago
 Main PID: 7383 (nginx)
   CGroup: /system.slice/system-systemd\x2dnspawn.slice/systemd-nspawn@poppy.service/system.slice/nginx.service
           ├─7383 nginx: master process /usr/sbin/nginx
           ├─7384 nginx: worker process
           ├─7385 nginx: worker process
           ├─7386 nginx: worker process
           ├─7387 nginx: worker process
           ├─7388 nginx: worker process
           ├─7389 nginx: worker process
           ├─7390 nginx: worker process
           └─7391 nginx: worker process

May 28 07:37:45 poppy systemd[1]: Starting The nginx HTTP and reverse
proxy server...
May 28 07:37:45 poppy nginx[7381]: nginx: the configuration file
/etc/nginx/nginx.conf syntax is ok
May 28 07:37:45 poppy nginx[7381]: nginx: configuration file
/etc/nginx/nginx.conf test is successful
May 28 07:37:45 poppy systemd[1]: Started The nginx HTTP and reverse
proxy server.

************************************************************************************************

Config files:

 /etc/nginx/conf.d/phppgadmin.conf
-------------------------------------------------------


server{

        server_name     phppgadmin.enl.global;
        root            /usr/share/phpPgAdmin;
        index          index.php;
        access_log      /storage/log/phppgadmin/access.log;
        error_log       /storage/log/phppgadmin/error.log;

        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass unix:/run/php5-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME
/usr/share/phpPgAdmin/$fastcgi_script_name;
                include /etc/nginx/fastcgi_params;
        }
}

----------------------------------------------------------------
- Part of postgresql.conf

#------------------------------------------------------------------------------
# FILE LOCATIONS
#------------------------------------------------------------------------------

# The default values of these variables are driven from the -D command-line
# option or PGDATA environment variable, represented here as ConfigDir.

data_directory = '/db/pgsql/data' # use data in another directory
# (change requires restart)
hba_file = '/db/pgsql/data/pg_hba.conf' # host-based authentication file
# (change requires restart)
ident_file = '/db/pgsql/data/pg_ident.conf' # ident configuration file
# (change requires restart)

# If external_pid_file is not explicitly set, no extra PID file is written.
#external_pid_file = '' # write an extra PID file
# (change requires restart)


#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------

# - Connection Settings -

listen_addresses = '*' # what IP address(es) to listen on;
#listen_addresses = 'localhost,212.147.52.214'   # comma-separated
list of addresses;
# defaults to 'localhost'; use '*' for all
# (change requires restart)
#port = 5432 # (change requires restart)
# Note: In RHEL/Fedora installations, you can't set the port number here;
# adjust it in the service file instead.
max_connections = 153 # (change requires restart)
# Note:  Increasing max_connections costs ~400 bytes of shared memory per
# connection slot, plus lock space (see max_locks_per_transaction).
#superuser_reserved_connections = 3 # (change requires restart)
unix_socket_directories = '/run/postgresql' # comma-separated list of
directories
# (change requires restart)
unix_socket_group = 'postgres' # (change requires restart)
#unix_socket_permissions = 0777 # begin with 0 to use octal notation
# (change requires restart)
#bonjour = off # advertise server via Bonjour
# (change requires restart)
#bonjour_name = '' # defaults to the computer name
# (change requires restart)

# - Security and Authentication -

authentication_timeout = 600s # 1s-600s
#ssl = off # (change requires restart)
#ssl_ciphers = 'HIGH:MEDIUM:+3DES:!aNULL' # allowed SSL ciphers
# (change requires restart)
#ssl_prefer_server_ciphers = on # (change requires restart)
#ssl_ecdh_curve = 'prime256v1' # (change requires restart)
#ssl_renegotiation_limit = 512MB # amount of data between renegotiations
#ssl_cert_file = 'server.crt' # (change requires restart)
#ssl_key_file = 'server.key' # (change requires restart)
#ssl_ca_file = '' # (change requires restart)
#ssl_crl_file = '' # (change requires restart)
#password_encryption = on
#db_user_namespace = off

# GSSAPI using Kerberos
#krb_server_keyfile = ''
#krb_caseins_users = off

# - TCP Keepalives -
# see "man 7 tcp" for details

#tcp_keepalives_idle = 0 # TCP_KEEPIDLE, in seconds;
# 0 selects the system default
#tcp_keepalives_interval = 0 # TCP_KEEPINTVL, in seconds;
# 0 selects the system default
#tcp_keepalives_count = 0 # TCP_KEEPCNT;
# 0 selects the system default

-------------------------------------------------------

pg_hba.conf
----------------------
# 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:
--------------------------------------

- some postgres output:

 postgres=# \l
                                 List of databases
   Name    |   Owner   | Encoding |  Collate   |   Ctype    |   Access
privileges
-----------+-----------+----------+------------+------------+-----------------------
 enlwiki   | mediawiki | UTF8     | en_US.UTF8 | en_US.UTF8 |
 postgres  | postgres  | UTF8     | en_US.UTF8 | en_US.UTF8 |
 template0 | postgres  | UTF8     | en_US.UTF8 | en_US.UTF8 |
=c/postgres          +
           |           |          |            |            |
postgres=CTc/postgres
 template1 | postgres  | UTF8     | en_US.UTF8 | en_US.UTF8 |
=c/postgres          +
           |           |          |            |            |
postgres=CTc/postgres
-------------------------------------

postgres=# \du
                             List of roles
 Role name |                   Attributes                   | Member of
-----------+------------------------------------------------+-----------
 enl       | Create DB                                      | {}
 mediawiki |                                                | {}
 postgres  | Superuser, Create role, Create DB, Replication | {}


*********************************************************************************************************
I can't log from the phppgadmin. I have login failed.
First, I am not sure if I shall log with my unix account or postgres
role (I guess the latter one).

Log:
LOG:  database system is ready to accept connections
LOG:  connection received: host=[local]
LOG:  connection received: host=::1 port=39999
FATAL:  no pg_hba.conf entry for host "::1", user "mediawiki",
database "postgres", SSL off



I see there is a problem in my pg_hba.conf, but can't see how to set
up it correctly.

Thank you for hints.

--

google.com/+arnaudgabourygabx


Re: phppgadmin : login failed

From
Ian Barwick
Date:
On 15/05/28 17:55, arnaud gaboury wrote:
(...)
> I can't log from the phppgadmin. I have login failed.
> First, I am not sure if I shall log with my unix account or postgres
> role (I guess the latter one).
>
> Log:
> LOG:  database system is ready to accept connections
> LOG:  connection received: host=[local]
> LOG:  connection received: host=::1 port=39999
> FATAL:  no pg_hba.conf entry for host "::1", user "mediawiki",
> database "postgres", SSL off
>
> I see there is a problem in my pg_hba.conf, but can't see how to set
> up it correctly.

> pg_hba.conf
> ----------------------
> # 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:
> --------------------------------------

Looks like you're missing an entry for IPv6 in pg_hba.conf; something
like this:

  host    all             all             ::1/128           md5


Regards

Ian Barwick

--
 Ian Barwick                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, RemoteDBA, Training & Services


Re: phppgadmin : login failed

From
arnaud gaboury
Date:
On Thu, May 28, 2015 at 11:04 AM, Ian Barwick <ian@2ndquadrant.com> wrote:
> On 15/05/28 17:55, arnaud gaboury wrote:
> (...)
>> I can't log from the phppgadmin. I have login failed.
>> First, I am not sure if I shall log with my unix account or postgres
>> role (I guess the latter one).
>>
>> Log:
>> LOG:  database system is ready to accept connections
>> LOG:  connection received: host=[local]
>> LOG:  connection received: host=::1 port=39999
>> FATAL:  no pg_hba.conf entry for host "::1", user "mediawiki",
>> database "postgres", SSL off
>>
>> I see there is a problem in my pg_hba.conf, but can't see how to set
>> up it correctly.
>
>> pg_hba.conf
>> ----------------------
>> # 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:
>> --------------------------------------
>
> Looks like you're missing an entry for IPv6 in pg_hba.conf; something
> like this:
>
>   host    all             all             ::1/128           md5

YES. I just uncommented the line a few mn ago and now it is OK.

TY
>
>
> Regards
>
> Ian Barwick
>
> --
>  Ian Barwick                   http://www.2ndQuadrant.com/
>  PostgreSQL Development, 24x7 Support, RemoteDBA, Training & Services



--

google.com/+arnaudgabourygabx