pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
.pgpass not working ( centos7, pgagent_96 )
11+ messages / 4 participants
[nested] [flat]

* .pgpass not working ( centos7, pgagent_96 )
@ 2017-10-16 08:02 JaeWon Lee <thejaewon@gmail.com>
  2017-10-16 08:09 ` Re: .pgpass not working ( centos7, pgagent_96 ) JaeWon Lee <thejaewon@gmail.com>
  2017-10-16 15:17 ` Re: .pgpass not working ( centos7, pgagent_96 ) David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 2 replies; 11+ messages in thread

From: JaeWon Lee @ 2017-10-16 08:02 UTC (permalink / raw)
  To: pgsql-admin

Hi,  .pgpass seems to be not working.
Could you check my pgagent setting?

OS : centos 7   ( I did not disable selinux )
Database : postgresql 9.6.5
pgagent : pgagent_96 3.4.0-9.rhel7  ( installed package using  yum )

1. I logged on centos server as user 'frank'

2. Before starting pgagent, I checked status of pgagent.  ( I did not
enable pgagent_96 service. )
[frank@web]$ systemctl status pgagent_96.service
● pgagent_96.service - PgAgent for PostgreSQL 9.6
   Loaded: loaded (/usr/lib/systemd/system/pgagent_96.service; disabled;
vendor preset: disabled)
   Active: inactive (dead)

3. I started pgagent. At first it looks successful. But after tens of
seconds, it failed to create connection and died.
( While starting CentOs asked me frank's OS password. )
[frank@web]$ systemctl start pgagent_96.service
[frank@web]$ systemctl status pgagent_96.service
● pgagent_96.service - PgAgent for PostgreSQL 9.6
   Loaded: loaded (/usr/lib/systemd/system/pgagent_96.service; disabled;
vendor preset: disabled)
   Active: active (running) since 2017-10-16 16:42:11 KST; 5s ago
  Process: 9507 ExecStart=/usr/bin/pgagent_96 -s ${LOGFILE}
hostaddr=${DBHOST} dbname=${DBNAME} user=${DBUSER} port=${DBPORT}
(code=exited, status=0/SUCCESS)
 Main PID: 9510 (pgagent_96)
   CGroup: /system.slice/pgagent_96.service
           └─9510 /usr/bin/pgagent_96 -s /var/log/pgagent_96.log
hostaddr=127.0.0.1 dbname=postgres user=postgres port=5432

16 Oct 16:42:11 web.frank.net systemd[1]: Starting PgAgent for PostgreSQL
9.6...
16 Oct 16:42:11 web.frank.net systemd[1]: Started PgAgent for PostgreSQL
9.6.

(After tens of seconds... )

[frank@web]$ systemctl status pgagent_96.service
● pgagent_96.service - PgAgent for PostgreSQL 9.6
   Loaded: loaded (/usr/lib/systemd/system/pgagent_96.service; disabled;
vendor preset: disabled)
   Active: failed (Result: exit-code) since 2017-10-16 16:42:56 KST; 4min
9s ago
  Process: 9507 ExecStart=/usr/bin/pgagent_96 -s ${LOGFILE}
hostaddr=${DBHOST} dbname=${DBNAME} user=${DBUSER} port=${DBPORT}
(code=exited, status=0/SUCCESS)
 Main PID: 9510 (code=exited, status=1/FAILURE)

16 Oct 16:42:11 web.frank.net systemd[1]: Starting PgAgent for PostgreSQL
9.6...
16 Oct 16:42:11 web.frank.net systemd[1]: Started PgAgent for PostgreSQL
9.6.
16 Oct 16:42:56 web.frank.net systemd[1]: pgagent_96.service: main process
exited, code=exited, status=1/FAILURE
16 Oct 16:42:56 web.frank.net systemd[1]: Unit pgagent_96.service entered
failed state.
16 Oct 16:42:56 web.frank.net systemd[1]: pgagent_96.service failed.

4. I checked pgagent log.
( Log in /var/log/pgagent_96.log )
WARNING: Couldn't create the primary connection (attempt 1): fe_sendauth:
no password supplied
WARNING: Couldn't create the primary connection (attempt 2): fe_sendauth:
no password supplied
WARNING: Couldn't create the primary connection (attempt 3): fe_sendauth:
no password supplied
WARNING: Couldn't create the primary connection (attempt 4): fe_sendauth:
no password supplied
WARNING: Couldn't create the primary connection (attempt 5): fe_sendauth:
no password supplied
WARNING: Couldn't create the primary connection (attempt 6): fe_sendauth:
no password supplied
WARNING: Couldn't create the primary connection (attempt 7): fe_sendauth:
no password supplied
WARNING: Couldn't create the primary connection (attempt 8): fe_sendauth:
no password supplied
WARNING: Couldn't create the primary connection (attempt 9): fe_sendauth:
no password supplied
WARNING: Couldn't create the primary connection (attempt 10): fe_sendauth:
no password supplied
ERROR: Stopping pgAgent: Couldn't establish the primary connection with the
database server.

5. Checked my .pgpass file. ( .pgpass is in frank's home directory.
/home/frank )
[frank@web]$ ls -alZ .pgpass
-rw-------. frank frank unconfined_u:object_r:user_home_t:s0 .pgpass
[frank@web]$ ls -al .pgpass
-rw-------. 1 frank frank 43 16 Oct 16:23 .pgpass
[frank@web]$ id -Z
unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
[frank@web]$ id
uid=1000(frank) gid=1000(frank) groups=1000(frank),10(wheel)
context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

6. Checked my pg_hba.conf.
[frank@web]$ su - postgres
-bash-4.2$ pwd
/var/lib/pgsql/9.6/data
-bash-4.2$ ls -alZ pg_hba.conf
-rw-------. postgres postgres unconfined_u:object_r:postgresql_db_t:s0
pg_hba.conf( pg_hba.conf )

( pg_hba.conf )
# TYPE  DATABASE        USER            ADDRESS                 METHOD
# "local" is for Unix domain socket connections only
#local   all             all                                     peer
local   all             all                                md5

# IPv4 local connections:
#host    all             all             127.0.0.1/32            ident
host    all             all             122.32.2.21/32            md5
(122.32.2.21  is my server's IP )

# IPv6 local connections:
#host    all             all             ::1/128                 ident
host    all             all             ::1/128                 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

7. I changed postgres user's password like this.
postgres=# ALTER USER postgres WITH PASSWORD 'pwd';

These are all I did. I can't guess what I should do. Help me please...

^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: .pgpass not working ( centos7, pgagent_96 )
  2017-10-16 08:02 .pgpass not working ( centos7, pgagent_96 ) JaeWon Lee <thejaewon@gmail.com>
@ 2017-10-16 08:09 ` JaeWon Lee <thejaewon@gmail.com>
  2017-10-16 08:16   ` Re: .pgpass not working ( centos7, pgagent_96 ) JaeWon Lee <thejaewon@gmail.com>
  1 sibling, 1 reply; 11+ messages in thread

From: JaeWon Lee @ 2017-10-16 08:09 UTC (permalink / raw)
  To: pgsql-admin

8. My .pgpass file.
localhost:5432:postgres:postgres:pwd


2017-10-16 17:02 GMT+09:00 JaeWon Lee <thejaewon@gmail.com>:

> Hi,  .pgpass seems to be not working.
> Could you check my pgagent setting?
>
> OS : centos 7   ( I did not disable selinux )
> Database : postgresql 9.6.5
> pgagent : pgagent_96 3.4.0-9.rhel7  ( installed package using  yum )
>
> 1. I logged on centos server as user 'frank'
>
> 2. Before starting pgagent, I checked status of pgagent.  ( I did not
> enable pgagent_96 service. )
> [frank@web]$ systemctl status pgagent_96.service
> ● pgagent_96.service - PgAgent for PostgreSQL 9.6
>    Loaded: loaded (/usr/lib/systemd/system/pgagent_96.service; disabled;
> vendor preset: disabled)
>    Active: inactive (dead)
>
> 3. I started pgagent. At first it looks successful. But after tens of
> seconds, it failed to create connection and died.
> ( While starting CentOs asked me frank's OS password. )
> [frank@web]$ systemctl start pgagent_96.service
> [frank@web]$ systemctl status pgagent_96.service
> ● pgagent_96.service - PgAgent for PostgreSQL 9.6
>    Loaded: loaded (/usr/lib/systemd/system/pgagent_96.service; disabled;
> vendor preset: disabled)
>    Active: active (running) since 2017-10-16 16:42:11 KST; 5s ago
>   Process: 9507 ExecStart=/usr/bin/pgagent_96 -s ${LOGFILE}
> hostaddr=${DBHOST} dbname=${DBNAME} user=${DBUSER} port=${DBPORT}
> (code=exited, status=0/SUCCESS)
>  Main PID: 9510 (pgagent_96)
>    CGroup: /system.slice/pgagent_96.service
>            └─9510 /usr/bin/pgagent_96 -s /var/log/pgagent_96.log
> hostaddr=127.0.0.1 dbname=postgres user=postgres port=5432
>
> 16 Oct 16:42:11 web.frank.net systemd[1]: Starting PgAgent for PostgreSQL
> 9.6...
> 16 Oct 16:42:11 web.frank.net systemd[1]: Started PgAgent for PostgreSQL
> 9.6.
>
> (After tens of seconds... )
>
> [frank@web]$ systemctl status pgagent_96.service
> ● pgagent_96.service - PgAgent for PostgreSQL 9.6
>    Loaded: loaded (/usr/lib/systemd/system/pgagent_96.service; disabled;
> vendor preset: disabled)
>    Active: failed (Result: exit-code) since 2017-10-16 16:42:56 KST; 4min
> 9s ago
>   Process: 9507 ExecStart=/usr/bin/pgagent_96 -s ${LOGFILE}
> hostaddr=${DBHOST} dbname=${DBNAME} user=${DBUSER} port=${DBPORT}
> (code=exited, status=0/SUCCESS)
>  Main PID: 9510 (code=exited, status=1/FAILURE)
>
> 16 Oct 16:42:11 web.frank.net systemd[1]: Starting PgAgent for PostgreSQL
> 9.6...
> 16 Oct 16:42:11 web.frank.net systemd[1]: Started PgAgent for PostgreSQL
> 9.6.
> 16 Oct 16:42:56 web.frank.net systemd[1]: pgagent_96.service: main
> process exited, code=exited, status=1/FAILURE
> 16 Oct 16:42:56 web.frank.net systemd[1]: Unit pgagent_96.service entered
> failed state.
> 16 Oct 16:42:56 web.frank.net systemd[1]: pgagent_96.service failed.
>
>
> 4. I checked pgagent log.
> ( Log in /var/log/pgagent_96.log )
> WARNING: Couldn't create the primary connection (attempt 1): fe_sendauth:
> no password supplied
> WARNING: Couldn't create the primary connection (attempt 2): fe_sendauth:
> no password supplied
> WARNING: Couldn't create the primary connection (attempt 3): fe_sendauth:
> no password supplied
> WARNING: Couldn't create the primary connection (attempt 4): fe_sendauth:
> no password supplied
> WARNING: Couldn't create the primary connection (attempt 5): fe_sendauth:
> no password supplied
> WARNING: Couldn't create the primary connection (attempt 6): fe_sendauth:
> no password supplied
> WARNING: Couldn't create the primary connection (attempt 7): fe_sendauth:
> no password supplied
> WARNING: Couldn't create the primary connection (attempt 8): fe_sendauth:
> no password supplied
> WARNING: Couldn't create the primary connection (attempt 9): fe_sendauth:
> no password supplied
> WARNING: Couldn't create the primary connection (attempt 10): fe_sendauth:
> no password supplied
> ERROR: Stopping pgAgent: Couldn't establish the primary connection with
> the database server.
>
> 5. Checked my .pgpass file. ( .pgpass is in frank's home directory.
> /home/frank )
> [frank@web]$ ls -alZ .pgpass
> -rw-------. frank frank unconfined_u:object_r:user_home_t:s0 .pgpass
> [frank@web]$ ls -al .pgpass
> -rw-------. 1 frank frank 43 16 Oct 16:23 .pgpass
> [frank@web]$ id -Z
> unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
> [frank@web]$ id
> uid=1000(frank) gid=1000(frank) groups=1000(frank),10(wheel)
> context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
>
> 6. Checked my pg_hba.conf.
> [frank@web]$ su - postgres
> -bash-4.2$ pwd
> /var/lib/pgsql/9.6/data
> -bash-4.2$ ls -alZ pg_hba.conf
> -rw-------. postgres postgres unconfined_u:object_r:postgresql_db_t:s0
> pg_hba.conf( pg_hba.conf )
>
> ( pg_hba.conf )
> # TYPE  DATABASE        USER            ADDRESS                 METHOD
> # "local" is for Unix domain socket connections only
> #local   all             all                                     peer
> local   all             all                                md5
>
> # IPv4 local connections:
> #host    all             all             127.0.0.1/32            ident
> host    all             all             122.32.2.21/32            md5
> (122.32.2.21  is my server's IP )
>
> # IPv6 local connections:
> #host    all             all             ::1/128                 ident
> host    all             all             ::1/128                 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
>
> 7. I changed postgres user's password like this.
> postgres=# ALTER USER postgres WITH PASSWORD 'pwd';
>
> These are all I did. I can't guess what I should do. Help me please...
>
>

^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: .pgpass not working ( centos7, pgagent_96 )
  2017-10-16 08:02 .pgpass not working ( centos7, pgagent_96 ) JaeWon Lee <thejaewon@gmail.com>
  2017-10-16 08:09 ` Re: .pgpass not working ( centos7, pgagent_96 ) JaeWon Lee <thejaewon@gmail.com>
@ 2017-10-16 08:16   ` JaeWon Lee <thejaewon@gmail.com>
  2017-10-16 08:18     ` Re: .pgpass not working ( centos7, pgagent_96 ) JaeWon Lee <thejaewon@gmail.com>
  0 siblings, 1 reply; 11+ messages in thread

From: JaeWon Lee @ 2017-10-16 08:16 UTC (permalink / raw)
  To: pgsql-admin

9. Security context of my .pgpass file
[frank@web]$ ls -alZ .pgpass
-rw-------. frank frank unconfined_u:object_r:user_home_t:s0 .pgpass


2017-10-16 17:09 GMT+09:00 JaeWon Lee <thejaewon@gmail.com>:

> 8. My .pgpass file.
> localhost:5432:postgres:postgres:pwd
>
>
> 2017-10-16 17:02 GMT+09:00 JaeWon Lee <thejaewon@gmail.com>:
>
>> Hi,  .pgpass seems to be not working.
>> Could you check my pgagent setting?
>>
>> OS : centos 7   ( I did not disable selinux )
>> Database : postgresql 9.6.5
>> pgagent : pgagent_96 3.4.0-9.rhel7  ( installed package using  yum )
>>
>> 1. I logged on centos server as user 'frank'
>>
>> 2. Before starting pgagent, I checked status of pgagent.  ( I did not
>> enable pgagent_96 service. )
>> [frank@web]$ systemctl status pgagent_96.service
>> ● pgagent_96.service - PgAgent for PostgreSQL 9.6
>>    Loaded: loaded (/usr/lib/systemd/system/pgagent_96.service; disabled;
>> vendor preset: disabled)
>>    Active: inactive (dead)
>>
>> 3. I started pgagent. At first it looks successful. But after tens of
>> seconds, it failed to create connection and died.
>> ( While starting CentOs asked me frank's OS password. )
>> [frank@web]$ systemctl start pgagent_96.service
>> [frank@web]$ systemctl status pgagent_96.service
>> ● pgagent_96.service - PgAgent for PostgreSQL 9.6
>>    Loaded: loaded (/usr/lib/systemd/system/pgagent_96.service; disabled;
>> vendor preset: disabled)
>>    Active: active (running) since 2017-10-16 16:42:11 KST; 5s ago
>>   Process: 9507 ExecStart=/usr/bin/pgagent_96 -s ${LOGFILE}
>> hostaddr=${DBHOST} dbname=${DBNAME} user=${DBUSER} port=${DBPORT}
>> (code=exited, status=0/SUCCESS)
>>  Main PID: 9510 (pgagent_96)
>>    CGroup: /system.slice/pgagent_96.service
>>            └─9510 /usr/bin/pgagent_96 -s /var/log/pgagent_96.log
>> hostaddr=127.0.0.1 dbname=postgres user=postgres port=5432
>>
>> 16 Oct 16:42:11 web.frank.net systemd[1]: Starting PgAgent for
>> PostgreSQL 9.6...
>> 16 Oct 16:42:11 web.frank.net systemd[1]: Started PgAgent for PostgreSQL
>> 9.6.
>>
>> (After tens of seconds... )
>>
>> [frank@web]$ systemctl status pgagent_96.service
>> ● pgagent_96.service - PgAgent for PostgreSQL 9.6
>>    Loaded: loaded (/usr/lib/systemd/system/pgagent_96.service; disabled;
>> vendor preset: disabled)
>>    Active: failed (Result: exit-code) since 2017-10-16 16:42:56 KST; 4min
>> 9s ago
>>   Process: 9507 ExecStart=/usr/bin/pgagent_96 -s ${LOGFILE}
>> hostaddr=${DBHOST} dbname=${DBNAME} user=${DBUSER} port=${DBPORT}
>> (code=exited, status=0/SUCCESS)
>>  Main PID: 9510 (code=exited, status=1/FAILURE)
>>
>> 16 Oct 16:42:11 web.frank.net systemd[1]: Starting PgAgent for
>> PostgreSQL 9.6...
>> 16 Oct 16:42:11 web.frank.net systemd[1]: Started PgAgent for PostgreSQL
>> 9.6.
>> 16 Oct 16:42:56 web.frank.net systemd[1]: pgagent_96.service: main
>> process exited, code=exited, status=1/FAILURE
>> 16 Oct 16:42:56 web.frank.net systemd[1]: Unit pgagent_96.service
>> entered failed state.
>> 16 Oct 16:42:56 web.frank.net systemd[1]: pgagent_96.service failed.
>>
>>
>> 4. I checked pgagent log.
>> ( Log in /var/log/pgagent_96.log )
>> WARNING: Couldn't create the primary connection (attempt 1): fe_sendauth:
>> no password supplied
>> WARNING: Couldn't create the primary connection (attempt 2): fe_sendauth:
>> no password supplied
>> WARNING: Couldn't create the primary connection (attempt 3): fe_sendauth:
>> no password supplied
>> WARNING: Couldn't create the primary connection (attempt 4): fe_sendauth:
>> no password supplied
>> WARNING: Couldn't create the primary connection (attempt 5): fe_sendauth:
>> no password supplied
>> WARNING: Couldn't create the primary connection (attempt 6): fe_sendauth:
>> no password supplied
>> WARNING: Couldn't create the primary connection (attempt 7): fe_sendauth:
>> no password supplied
>> WARNING: Couldn't create the primary connection (attempt 8): fe_sendauth:
>> no password supplied
>> WARNING: Couldn't create the primary connection (attempt 9): fe_sendauth:
>> no password supplied
>> WARNING: Couldn't create the primary connection (attempt 10):
>> fe_sendauth: no password supplied
>> ERROR: Stopping pgAgent: Couldn't establish the primary connection with
>> the database server.
>>
>> 5. Checked my .pgpass file. ( .pgpass is in frank's home directory.
>> /home/frank )
>> [frank@web]$ ls -alZ .pgpass
>> -rw-------. frank frank unconfined_u:object_r:user_home_t:s0 .pgpass
>> [frank@web]$ ls -al .pgpass
>> -rw-------. 1 frank frank 43 16 Oct 16:23 .pgpass
>> [frank@web]$ id -Z
>> unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
>> [frank@web]$ id
>> uid=1000(frank) gid=1000(frank) groups=1000(frank),10(wheel)
>> context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
>>
>> 6. Checked my pg_hba.conf.
>> [frank@web]$ su - postgres
>> -bash-4.2$ pwd
>> /var/lib/pgsql/9.6/data
>> -bash-4.2$ ls -alZ pg_hba.conf
>> -rw-------. postgres postgres unconfined_u:object_r:postgresql_db_t:s0
>> pg_hba.conf( pg_hba.conf )
>>
>> ( pg_hba.conf )
>> # TYPE  DATABASE        USER            ADDRESS                 METHOD
>> # "local" is for Unix domain socket connections only
>> #local   all             all                                     peer
>> local   all             all                                md5
>>
>> # IPv4 local connections:
>> #host    all             all             127.0.0.1/32            ident
>> host    all             all             122.32.2.21/32            md5
>> (122.32.2.21  is my server's IP )
>>
>> # IPv6 local connections:
>> #host    all             all             ::1/128                 ident
>> host    all             all             ::1/128                 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
>>
>> 7. I changed postgres user's password like this.
>> postgres=# ALTER USER postgres WITH PASSWORD 'pwd';
>>
>> These are all I did. I can't guess what I should do. Help me please...
>>
>>
>

^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: .pgpass not working ( centos7, pgagent_96 )
  2017-10-16 08:02 .pgpass not working ( centos7, pgagent_96 ) JaeWon Lee <thejaewon@gmail.com>
  2017-10-16 08:09 ` Re: .pgpass not working ( centos7, pgagent_96 ) JaeWon Lee <thejaewon@gmail.com>
  2017-10-16 08:16   ` Re: .pgpass not working ( centos7, pgagent_96 ) JaeWon Lee <thejaewon@gmail.com>
@ 2017-10-16 08:18     ` JaeWon Lee <thejaewon@gmail.com>
  2017-10-16 14:09       ` Re: .pgpass not working ( centos7, pgagent_96 ) Shreeyansh Dba <shreeyansh2014@gmail.com>
  0 siblings, 1 reply; 11+ messages in thread

From: JaeWon Lee @ 2017-10-16 08:18 UTC (permalink / raw)
  To: pgsql-admin

9. Security context of my .pgpass file
[frank@web]$ ls -alZ .pgpass
-rw-------. frank frank unconfined_u:object_r:user_home_t:s0 .pgpass


2017-10-16 17:16 GMT+09:00 JaeWon Lee <thejaewon@gmail.com>:

> 9. Security context of my .pgpass file
> [frank@web]$ ls -alZ .pgpass
> -rw-------. frank frank unconfined_u:object_r:user_home_t:s0 .pgpass
>
>
> 2017-10-16 17:09 GMT+09:00 JaeWon Lee <thejaewon@gmail.com>:
>
>> 8. My .pgpass file.
>> localhost:5432:postgres:postgres:pwd
>>
>>
>> 2017-10-16 17:02 GMT+09:00 JaeWon Lee <thejaewon@gmail.com>:
>>
>>> Hi,  .pgpass seems to be not working.
>>> Could you check my pgagent setting?
>>>
>>> OS : centos 7   ( I did not disable selinux )
>>> Database : postgresql 9.6.5
>>> pgagent : pgagent_96 3.4.0-9.rhel7  ( installed package using  yum )
>>>
>>> 1. I logged on centos server as user 'frank'
>>>
>>> 2. Before starting pgagent, I checked status of pgagent.  ( I did not
>>> enable pgagent_96 service. )
>>> [frank@web]$ systemctl status pgagent_96.service
>>> ● pgagent_96.service - PgAgent for PostgreSQL 9.6
>>>    Loaded: loaded (/usr/lib/systemd/system/pgagent_96.service;
>>> disabled; vendor preset: disabled)
>>>    Active: inactive (dead)
>>>
>>> 3. I started pgagent. At first it looks successful. But after tens of
>>> seconds, it failed to create connection and died.
>>> ( While starting CentOs asked me frank's OS password. )
>>> [frank@web]$ systemctl start pgagent_96.service
>>> [frank@web]$ systemctl status pgagent_96.service
>>> ● pgagent_96.service - PgAgent for PostgreSQL 9.6
>>>    Loaded: loaded (/usr/lib/systemd/system/pgagent_96.service;
>>> disabled; vendor preset: disabled)
>>>    Active: active (running) since 2017-10-16 16:42:11 KST; 5s ago
>>>   Process: 9507 ExecStart=/usr/bin/pgagent_96 -s ${LOGFILE}
>>> hostaddr=${DBHOST} dbname=${DBNAME} user=${DBUSER} port=${DBPORT}
>>> (code=exited, status=0/SUCCESS)
>>>  Main PID: 9510 (pgagent_96)
>>>    CGroup: /system.slice/pgagent_96.service
>>>            └─9510 /usr/bin/pgagent_96 -s /var/log/pgagent_96.log
>>> hostaddr=127.0.0.1 dbname=postgres user=postgres port=5432
>>>
>>> 16 Oct 16:42:11 web.frank.net systemd[1]: Starting PgAgent for
>>> PostgreSQL 9.6...
>>> 16 Oct 16:42:11 web.frank.net systemd[1]: Started PgAgent for
>>> PostgreSQL 9.6.
>>>
>>> (After tens of seconds... )
>>>
>>> [frank@web]$ systemctl status pgagent_96.service
>>> ● pgagent_96.service - PgAgent for PostgreSQL 9.6
>>>    Loaded: loaded (/usr/lib/systemd/system/pgagent_96.service;
>>> disabled; vendor preset: disabled)
>>>    Active: failed (Result: exit-code) since 2017-10-16 16:42:56 KST;
>>> 4min 9s ago
>>>   Process: 9507 ExecStart=/usr/bin/pgagent_96 -s ${LOGFILE}
>>> hostaddr=${DBHOST} dbname=${DBNAME} user=${DBUSER} port=${DBPORT}
>>> (code=exited, status=0/SUCCESS)
>>>  Main PID: 9510 (code=exited, status=1/FAILURE)
>>>
>>> 16 Oct 16:42:11 web.frank.net systemd[1]: Starting PgAgent for
>>> PostgreSQL 9.6...
>>> 16 Oct 16:42:11 web.frank.net systemd[1]: Started PgAgent for
>>> PostgreSQL 9.6.
>>> 16 Oct 16:42:56 web.frank.net systemd[1]: pgagent_96.service: main
>>> process exited, code=exited, status=1/FAILURE
>>> 16 Oct 16:42:56 web.frank.net systemd[1]: Unit pgagent_96.service
>>> entered failed state.
>>> 16 Oct 16:42:56 web.frank.net systemd[1]: pgagent_96.service failed.
>>>
>>>
>>> 4. I checked pgagent log.
>>> ( Log in /var/log/pgagent_96.log )
>>> WARNING: Couldn't create the primary connection (attempt 1):
>>> fe_sendauth: no password supplied
>>> WARNING: Couldn't create the primary connection (attempt 2):
>>> fe_sendauth: no password supplied
>>> WARNING: Couldn't create the primary connection (attempt 3):
>>> fe_sendauth: no password supplied
>>> WARNING: Couldn't create the primary connection (attempt 4):
>>> fe_sendauth: no password supplied
>>> WARNING: Couldn't create the primary connection (attempt 5):
>>> fe_sendauth: no password supplied
>>> WARNING: Couldn't create the primary connection (attempt 6):
>>> fe_sendauth: no password supplied
>>> WARNING: Couldn't create the primary connection (attempt 7):
>>> fe_sendauth: no password supplied
>>> WARNING: Couldn't create the primary connection (attempt 8):
>>> fe_sendauth: no password supplied
>>> WARNING: Couldn't create the primary connection (attempt 9):
>>> fe_sendauth: no password supplied
>>> WARNING: Couldn't create the primary connection (attempt 10):
>>> fe_sendauth: no password supplied
>>> ERROR: Stopping pgAgent: Couldn't establish the primary connection with
>>> the database server.
>>>
>>> 5. Checked my .pgpass file. ( .pgpass is in frank's home directory.
>>> /home/frank )
>>> [frank@web]$ ls -alZ .pgpass
>>> -rw-------. frank frank unconfined_u:object_r:user_home_t:s0 .pgpass
>>> [frank@web]$ ls -al .pgpass
>>> -rw-------. 1 frank frank 43 16 Oct 16:23 .pgpass
>>> [frank@web]$ id -Z
>>> unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
>>> [frank@web]$ id
>>> uid=1000(frank) gid=1000(frank) groups=1000(frank),10(wheel)
>>> context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
>>>
>>> 6. Checked my pg_hba.conf.
>>> [frank@web]$ su - postgres
>>> -bash-4.2$ pwd
>>> /var/lib/pgsql/9.6/data
>>> -bash-4.2$ ls -alZ pg_hba.conf
>>> -rw-------. postgres postgres unconfined_u:object_r:postgresql_db_t:s0
>>> pg_hba.conf( pg_hba.conf )
>>>
>>> ( pg_hba.conf )
>>> # TYPE  DATABASE        USER            ADDRESS                 METHOD
>>> # "local" is for Unix domain socket connections only
>>> #local   all             all                                     peer
>>> local   all             all                                md5
>>>
>>> # IPv4 local connections:
>>> #host    all             all             127.0.0.1/32            ident
>>> host    all             all             122.32.2.21/32            md5
>>> (122.32.2.21  is my server's IP )
>>>
>>> # IPv6 local connections:
>>> #host    all             all             ::1/128                 ident
>>> host    all             all             ::1/128                 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
>>>
>>> 7. I changed postgres user's password like this.
>>> postgres=# ALTER USER postgres WITH PASSWORD 'pwd';
>>>
>>> These are all I did. I can't guess what I should do. Help me please...
>>>
>>>
>>
>

^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: .pgpass not working ( centos7, pgagent_96 )
  2017-10-16 08:02 .pgpass not working ( centos7, pgagent_96 ) JaeWon Lee <thejaewon@gmail.com>
  2017-10-16 08:09 ` Re: .pgpass not working ( centos7, pgagent_96 ) JaeWon Lee <thejaewon@gmail.com>
  2017-10-16 08:16   ` Re: .pgpass not working ( centos7, pgagent_96 ) JaeWon Lee <thejaewon@gmail.com>
  2017-10-16 08:18     ` Re: .pgpass not working ( centos7, pgagent_96 ) JaeWon Lee <thejaewon@gmail.com>
@ 2017-10-16 14:09       ` Shreeyansh Dba <shreeyansh2014@gmail.com>
  2017-10-16 14:58         ` Re: .pgpass not working ( centos7, pgagent_96 ) JaeWon Lee <thejaewon@gmail.com>
  0 siblings, 1 reply; 11+ messages in thread

From: Shreeyansh Dba @ 2017-10-16 14:09 UTC (permalink / raw)
  To: JaeWon Lee <thejaewon@gmail.com>; +Cc: pgsql-admin

Hi JaeWon Lee,

I have gone through the issue you listed

Hopefully the issue raised due to the change of ownership of .pgpass file
which needs to be postgres but not other user.

*-rw-------  1 postgres postgres     38 Oct  4 18:41 .pgpass*


Hope this helps you...



On Mon, Oct 16, 2017 at 1:48 PM, JaeWon Lee <thejaewon@gmail.com> wrote:

> 9. Security context of my .pgpass file
> [frank@web]$ ls -alZ .pgpass
> -rw-------. frank frank unconfined_u:object_r:user_home_t:s0 .pgpass
>
>
> 2017-10-16 17:16 GMT+09:00 JaeWon Lee <thejaewon@gmail.com>:
>
>> 9. Security context of my .pgpass file
>> [frank@web]$ ls -alZ .pgpass
>> -rw-------. frank frank unconfined_u:object_r:user_home_t:s0 .pgpass
>>
>>
>> 2017-10-16 17:09 GMT+09:00 JaeWon Lee <thejaewon@gmail.com>:
>>
>>> 8. My .pgpass file.
>>> localhost:5432:postgres:postgres:pwd
>>>
>>>
>>> 2017-10-16 17:02 GMT+09:00 JaeWon Lee <thejaewon@gmail.com>:
>>>
>>>> Hi,  .pgpass seems to be not working.
>>>> Could you check my pgagent setting?
>>>>
>>>> OS : centos 7   ( I did not disable selinux )
>>>> Database : postgresql 9.6.5
>>>> pgagent : pgagent_96 3.4.0-9.rhel7  ( installed package using  yum )
>>>>
>>>> 1. I logged on centos server as user 'frank'
>>>>
>>>> 2. Before starting pgagent, I checked status of pgagent.  ( I did not
>>>> enable pgagent_96 service. )
>>>> [frank@web]$ systemctl status pgagent_96.service
>>>> ● pgagent_96.service - PgAgent for PostgreSQL 9.6
>>>>    Loaded: loaded (/usr/lib/systemd/system/pgagent_96.service;
>>>> disabled; vendor preset: disabled)
>>>>    Active: inactive (dead)
>>>>
>>>> 3. I started pgagent. At first it looks successful. But after tens of
>>>> seconds, it failed to create connection and died.
>>>> ( While starting CentOs asked me frank's OS password. )
>>>> [frank@web]$ systemctl start pgagent_96.service
>>>> [frank@web]$ systemctl status pgagent_96.service
>>>> ● pgagent_96.service - PgAgent for PostgreSQL 9.6
>>>>    Loaded: loaded (/usr/lib/systemd/system/pgagent_96.service;
>>>> disabled; vendor preset: disabled)
>>>>    Active: active (running) since 2017-10-16 16:42:11 KST; 5s ago
>>>>   Process: 9507 ExecStart=/usr/bin/pgagent_96 -s ${LOGFILE}
>>>> hostaddr=${DBHOST} dbname=${DBNAME} user=${DBUSER} port=${DBPORT}
>>>> (code=exited, status=0/SUCCESS)
>>>>  Main PID: 9510 (pgagent_96)
>>>>    CGroup: /system.slice/pgagent_96.service
>>>>            └─9510 /usr/bin/pgagent_96 -s /var/log/pgagent_96.log
>>>> hostaddr=127.0.0.1 dbname=postgres user=postgres port=5432
>>>>
>>>> 16 Oct 16:42:11 web.frank.net systemd[1]: Starting PgAgent for
>>>> PostgreSQL 9.6...
>>>> 16 Oct 16:42:11 web.frank.net systemd[1]: Started PgAgent for
>>>> PostgreSQL 9.6.
>>>>
>>>> (After tens of seconds... )
>>>>
>>>> [frank@web]$ systemctl status pgagent_96.service
>>>> ● pgagent_96.service - PgAgent for PostgreSQL 9.6
>>>>    Loaded: loaded (/usr/lib/systemd/system/pgagent_96.service;
>>>> disabled; vendor preset: disabled)
>>>>    Active: failed (Result: exit-code) since 2017-10-16 16:42:56 KST;
>>>> 4min 9s ago
>>>>   Process: 9507 ExecStart=/usr/bin/pgagent_96 -s ${LOGFILE}
>>>> hostaddr=${DBHOST} dbname=${DBNAME} user=${DBUSER} port=${DBPORT}
>>>> (code=exited, status=0/SUCCESS)
>>>>  Main PID: 9510 (code=exited, status=1/FAILURE)
>>>>
>>>> 16 Oct 16:42:11 web.frank.net systemd[1]: Starting PgAgent for
>>>> PostgreSQL 9.6...
>>>> 16 Oct 16:42:11 web.frank.net systemd[1]: Started PgAgent for
>>>> PostgreSQL 9.6.
>>>> 16 Oct 16:42:56 web.frank.net systemd[1]: pgagent_96.service: main
>>>> process exited, code=exited, status=1/FAILURE
>>>> 16 Oct 16:42:56 web.frank.net systemd[1]: Unit pgagent_96.service
>>>> entered failed state.
>>>> 16 Oct 16:42:56 web.frank.net systemd[1]: pgagent_96.service failed.
>>>>
>>>>
>>>> 4. I checked pgagent log.
>>>> ( Log in /var/log/pgagent_96.log )
>>>> WARNING: Couldn't create the primary connection (attempt 1):
>>>> fe_sendauth: no password supplied
>>>> WARNING: Couldn't create the primary connection (attempt 2):
>>>> fe_sendauth: no password supplied
>>>> WARNING: Couldn't create the primary connection (attempt 3):
>>>> fe_sendauth: no password supplied
>>>> WARNING: Couldn't create the primary connection (attempt 4):
>>>> fe_sendauth: no password supplied
>>>> WARNING: Couldn't create the primary connection (attempt 5):
>>>> fe_sendauth: no password supplied
>>>> WARNING: Couldn't create the primary connection (attempt 6):
>>>> fe_sendauth: no password supplied
>>>> WARNING: Couldn't create the primary connection (attempt 7):
>>>> fe_sendauth: no password supplied
>>>> WARNING: Couldn't create the primary connection (attempt 8):
>>>> fe_sendauth: no password supplied
>>>> WARNING: Couldn't create the primary connection (attempt 9):
>>>> fe_sendauth: no password supplied
>>>> WARNING: Couldn't create the primary connection (attempt 10):
>>>> fe_sendauth: no password supplied
>>>> ERROR: Stopping pgAgent: Couldn't establish the primary connection with
>>>> the database server.
>>>>
>>>> 5. Checked my .pgpass file. ( .pgpass is in frank's home directory.
>>>> /home/frank )
>>>> [frank@web]$ ls -alZ .pgpass
>>>> -rw-------. frank frank unconfined_u:object_r:user_home_t:s0 .pgpass
>>>> [frank@web]$ ls -al .pgpass
>>>> -rw-------. 1 frank frank 43 16 Oct 16:23 .pgpass
>>>> [frank@web]$ id -Z
>>>> unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
>>>> [frank@web]$ id
>>>> uid=1000(frank) gid=1000(frank) groups=1000(frank),10(wheel)
>>>> context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
>>>>
>>>> 6. Checked my pg_hba.conf.
>>>> [frank@web]$ su - postgres
>>>> -bash-4.2$ pwd
>>>> /var/lib/pgsql/9.6/data
>>>> -bash-4.2$ ls -alZ pg_hba.conf
>>>> -rw-------. postgres postgres unconfined_u:object_r:postgresql_db_t:s0
>>>> pg_hba.conf( pg_hba.conf )
>>>>
>>>> ( pg_hba.conf )
>>>> # TYPE  DATABASE        USER            ADDRESS                 METHOD
>>>> # "local" is for Unix domain socket connections only
>>>> #local   all             all                                     peer
>>>> local   all             all                                md5
>>>>
>>>> # IPv4 local connections:
>>>> #host    all             all             127.0.0.1/32            ident
>>>> host    all             all             122.32.2.21/32
>>>> md5   (122.32.2.21  is my server's IP )
>>>>
>>>> # IPv6 local connections:
>>>> #host    all             all             ::1/128                 ident
>>>> host    all             all             ::1/128                 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
>>>>
>>>> 7. I changed postgres user's password like this.
>>>> postgres=# ALTER USER postgres WITH PASSWORD 'pwd';
>>>>
>>>> These are all I did. I can't guess what I should do. Help me please...
>>>>
>>>>
>>>
>>
>

^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: .pgpass not working ( centos7, pgagent_96 )
  2017-10-16 08:02 .pgpass not working ( centos7, pgagent_96 ) JaeWon Lee <thejaewon@gmail.com>
  2017-10-16 08:09 ` Re: .pgpass not working ( centos7, pgagent_96 ) JaeWon Lee <thejaewon@gmail.com>
  2017-10-16 08:16   ` Re: .pgpass not working ( centos7, pgagent_96 ) JaeWon Lee <thejaewon@gmail.com>
  2017-10-16 08:18     ` Re: .pgpass not working ( centos7, pgagent_96 ) JaeWon Lee <thejaewon@gmail.com>
  2017-10-16 14:09       ` Re: .pgpass not working ( centos7, pgagent_96 ) Shreeyansh Dba <shreeyansh2014@gmail.com>
@ 2017-10-16 14:58         ` JaeWon Lee <thejaewon@gmail.com>
  0 siblings, 0 replies; 11+ messages in thread

From: JaeWon Lee @ 2017-10-16 14:58 UTC (permalink / raw)
  To: Shreeyansh Dba <shreeyansh2014@gmail.com>; +Cc: pgsql-admin

Thanks ^^  But the result is same..
It failed to create connection. Exactly same reason. ( fe_sendauth: no
password supplied )

I logged on centos server as OS user 'frank' and tried to start pgagent_96
service.

*========== (1)Try to start as OS user 'root' *
[root@web frank]# ls -al .pgpass
-rw-------. 1 *postgres postgres* 43 10월 16 17:08 .pgpass
[root@web frank]# ls -alZ .pgpass
-rw-------. *postgres postgres unconfined_u:object_r:user_home_t:s0* .pgpass
[root@web frank]# cat .pgpass
localhost:5432:postgres:postgres:pwd
[root@web frank]# systemctl start pgagent_96      (Here, centos asked*
frank*'s OS password )
[root@web frank]# systemctl status pgagent_96
● pgagent_96.service - PgAgent for PostgreSQL 9.6
   Loaded: loaded (/usr/lib/systemd/system/pgagent_96.service; disabled;
vendor preset: disabled)
   Active: *failed* (Result: exit-code) since 2017-10-16 23:33:15 KST; 3s
ago
  Process: 25928 ExecStart=/usr/bin/pgagent_96 -s ${LOGFILE}
hostaddr=${DBHOST} dbname=${DBNAME} user=${DBUSER} port=${DBPORT}
(code=exited, status=0/SUCCESS)
 Main PID: 25930 (code=exited, status=1/FAILURE)

16 Oct 23:32:30 web.frank.net systemd[1]: Starting PgAgent for Postgre....
16 Oct 23:32:30 web.frank.net systemd[1]: Started PgAgent for PostgreS....
16 Oct 23:33:15 web.frank.net systemd[1]: pgagent_96.service: main pro...E
16 Oct 23:33:15 web.frank.net systemd[1]: Unit pgagent_96.service ente....
16 Oct 23:33:15 web.frank.net systemd[1]: pgagent_96.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

*========== (2)Try to start as OS user 'frank'*
[frank@web ~]$ systemctl start pgagent_96         (Here, centos asked*
frank*'s OS password )
[frank@web ~]$ systemctl status pgagent_96
● pgagent_96.service - PgAgent for PostgreSQL 9.6
   Loaded: loaded (/usr/lib/systemd/system/pgagent_96.service; disabled;
vendor preset: disabled)
   Active:* failed* (Result: exit-code) since 월 2017-10-16 23:41:03 KST;
1min 21s ago
  Process: 26531 ExecStart=/usr/bin/pgagent_96 -s ${LOGFILE}
hostaddr=${DBHOST} dbname=${DBNAME} user=${DBUSER} port=${DBPORT}
(code=exited, status=0/SUCCESS)
 Main PID: 26533 (code=exited, status=1/FAILURE)

16 Oct 23:40:18 web.frank.net systemd[1]: Starting PgAgent for Postgre....
16 Oct 23:40:18 web.frank.net systemd[1]: Started PgAgent for PostgreS....
16 Oct 23:41:03 web.frank.net systemd[1]: pgagent_96.service: main pro...E
16 Oct 23:41:03 web.frank.net systemd[1]: Unit pgagent_96.service ente....
16 Oct 23:41:03 web.frank.net systemd[1]: pgagent_96.service failed.
Hint: Some lines were ellipsized, use -l to show in full.


*========== (3)Try to start as OS user 'postgres'*-bash-4.2$ systemctl
start pgagent_96              (Here, centos asked* frank*'s OS password )
-bash-4.2$ systemctl status pgagent_96
● pgagent_96.service - PgAgent for PostgreSQL 9.6
   Loaded: loaded (/usr/lib/systemd/system/pgagent_96.service; disabled;
vendor preset: disabled)
   Active: failed (Result: exit-code) since 월 2017-10-16 23:54:22 KST; 21s
ago
  Process: 27511 ExecStart=/usr/bin/pgagent_96 -s ${LOGFILE}
hostaddr=${DBHOST} dbname=${DBNAME} user=${DBUSER} port=${DBPORT}
(code=exited, status=0/SUCCESS)
 Main PID: 27515 (code=exited, status=1/FAILURE)


*============(4) Security context of 'root' and 'frank' and 'postgres'*
--* root*
[root@web ~]# id
uid=0(root) gid=0(root) groups=0(root) context=unconfined_u:
unconfined_r:unconfined_t:s0-s0:c0.c1023
--* frank*
[frank@web ~]$ id
uid=1000(frank) gid=1000(frank) groups=1000(frank),10(wheel)
context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
-- *postgres*
-bash-4.2$ id
uid=26(postgres) gid=26(postgres) groups=26(postgres) context=unconfined_u:
unconfined_r:unconfined_t:s0-s0:c0.c1023

2017-10-16 23:09 GMT+09:00 Shreeyansh Dba <shreeyansh2014@gmail.com>:

> Hi JaeWon Lee,
>
> I have gone through the issue you listed
>
> Hopefully the issue raised due to the change of ownership of .pgpass file
> which needs to be postgres but not other user.
>
> *-rw-------  1 postgres postgres     38 Oct  4 18:41 .pgpass*
>
>
> Hope this helps you...
>
>
>
> On Mon, Oct 16, 2017 at 1:48 PM, JaeWon Lee <thejaewon@gmail.com> wrote:
>
>> 9. Security context of my .pgpass file
>> [frank@web]$ ls -alZ .pgpass
>> -rw-------. frank frank unconfined_u:object_r:user_home_t:s0 .pgpass
>>
>>
>> 2017-10-16 17:16 GMT+09:00 JaeWon Lee <thejaewon@gmail.com>:
>>
>>> 9. Security context of my .pgpass file
>>> [frank@web]$ ls -alZ .pgpass
>>> -rw-------. frank frank unconfined_u:object_r:user_home_t:s0 .pgpass
>>>
>>>
>>> 2017-10-16 17:09 GMT+09:00 JaeWon Lee <thejaewon@gmail.com>:
>>>
>>>> 8. My .pgpass file.
>>>> localhost:5432:postgres:postgres:pwd
>>>>
>>>>
>>>> 2017-10-16 17:02 GMT+09:00 JaeWon Lee <thejaewon@gmail.com>:
>>>>
>>>>> Hi,  .pgpass seems to be not working.
>>>>> Could you check my pgagent setting?
>>>>>
>>>>> OS : centos 7   ( I did not disable selinux )
>>>>> Database : postgresql 9.6.5
>>>>> pgagent : pgagent_96 3.4.0-9.rhel7  ( installed package using  yum )
>>>>>
>>>>> 1. I logged on centos server as user 'frank'
>>>>>
>>>>> 2. Before starting pgagent, I checked status of pgagent.  ( I did not
>>>>> enable pgagent_96 service. )
>>>>> [frank@web]$ systemctl status pgagent_96.service
>>>>> ● pgagent_96.service - PgAgent for PostgreSQL 9.6
>>>>>    Loaded: loaded (/usr/lib/systemd/system/pgagent_96.service;
>>>>> disabled; vendor preset: disabled)
>>>>>    Active: inactive (dead)
>>>>>
>>>>> 3. I started pgagent. At first it looks successful. But after tens of
>>>>> seconds, it failed to create connection and died.
>>>>> ( While starting CentOs asked me frank's OS password. )
>>>>> [frank@web]$ systemctl start pgagent_96.service
>>>>> [frank@web]$ systemctl status pgagent_96.service
>>>>> ● pgagent_96.service - PgAgent for PostgreSQL 9.6
>>>>>    Loaded: loaded (/usr/lib/systemd/system/pgagent_96.service;
>>>>> disabled; vendor preset: disabled)
>>>>>    Active: active (running) since 2017-10-16 16:42:11 KST; 5s ago
>>>>>   Process: 9507 ExecStart=/usr/bin/pgagent_96 -s ${LOGFILE}
>>>>> hostaddr=${DBHOST} dbname=${DBNAME} user=${DBUSER} port=${DBPORT}
>>>>> (code=exited, status=0/SUCCESS)
>>>>>  Main PID: 9510 (pgagent_96)
>>>>>    CGroup: /system.slice/pgagent_96.service
>>>>>            └─9510 /usr/bin/pgagent_96 -s /var/log/pgagent_96.log
>>>>> hostaddr=127.0.0.1 dbname=postgres user=postgres port=5432
>>>>>
>>>>> 16 Oct 16:42:11 web.frank.net systemd[1]: Starting PgAgent for
>>>>> PostgreSQL 9.6...
>>>>> 16 Oct 16:42:11 web.frank.net systemd[1]: Started PgAgent for
>>>>> PostgreSQL 9.6.
>>>>>
>>>>> (After tens of seconds... )
>>>>>
>>>>> [frank@web]$ systemctl status pgagent_96.service
>>>>> ● pgagent_96.service - PgAgent for PostgreSQL 9.6
>>>>>    Loaded: loaded (/usr/lib/systemd/system/pgagent_96.service;
>>>>> disabled; vendor preset: disabled)
>>>>>    Active: failed (Result: exit-code) since 2017-10-16 16:42:56 KST;
>>>>> 4min 9s ago
>>>>>   Process: 9507 ExecStart=/usr/bin/pgagent_96 -s ${LOGFILE}
>>>>> hostaddr=${DBHOST} dbname=${DBNAME} user=${DBUSER} port=${DBPORT}
>>>>> (code=exited, status=0/SUCCESS)
>>>>>  Main PID: 9510 (code=exited, status=1/FAILURE)
>>>>>
>>>>> 16 Oct 16:42:11 web.frank.net systemd[1]: Starting PgAgent for
>>>>> PostgreSQL 9.6...
>>>>> 16 Oct 16:42:11 web.frank.net systemd[1]: Started PgAgent for
>>>>> PostgreSQL 9.6.
>>>>> 16 Oct 16:42:56 web.frank.net systemd[1]: pgagent_96.service: main
>>>>> process exited, code=exited, status=1/FAILURE
>>>>> 16 Oct 16:42:56 web.frank.net systemd[1]: Unit pgagent_96.service
>>>>> entered failed state.
>>>>> 16 Oct 16:42:56 web.frank.net systemd[1]: pgagent_96.service failed.
>>>>>
>>>>>
>>>>> 4. I checked pgagent log.
>>>>> ( Log in /var/log/pgagent_96.log )
>>>>> WARNING: Couldn't create the primary connection (attempt 1):
>>>>> fe_sendauth: no password supplied
>>>>> WARNING: Couldn't create the primary connection (attempt 2):
>>>>> fe_sendauth: no password supplied
>>>>> WARNING: Couldn't create the primary connection (attempt 3):
>>>>> fe_sendauth: no password supplied
>>>>> WARNING: Couldn't create the primary connection (attempt 4):
>>>>> fe_sendauth: no password supplied
>>>>> WARNING: Couldn't create the primary connection (attempt 5):
>>>>> fe_sendauth: no password supplied
>>>>> WARNING: Couldn't create the primary connection (attempt 6):
>>>>> fe_sendauth: no password supplied
>>>>> WARNING: Couldn't create the primary connection (attempt 7):
>>>>> fe_sendauth: no password supplied
>>>>> WARNING: Couldn't create the primary connection (attempt 8):
>>>>> fe_sendauth: no password supplied
>>>>> WARNING: Couldn't create the primary connection (attempt 9):
>>>>> fe_sendauth: no password supplied
>>>>> WARNING: Couldn't create the primary connection (attempt 10):
>>>>> fe_sendauth: no password supplied
>>>>> ERROR: Stopping pgAgent: Couldn't establish the primary connection
>>>>> with the database server.
>>>>>
>>>>> 5. Checked my .pgpass file. ( .pgpass is in frank's home directory.
>>>>> /home/frank )
>>>>> [frank@web]$ ls -alZ .pgpass
>>>>> -rw-------. frank frank unconfined_u:object_r:user_home_t:s0 .pgpass
>>>>> [frank@web]$ ls -al .pgpass
>>>>> -rw-------. 1 frank frank 43 16 Oct 16:23 .pgpass
>>>>> [frank@web]$ id -Z
>>>>> unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
>>>>> [frank@web]$ id
>>>>> uid=1000(frank) gid=1000(frank) groups=1000(frank),10(wheel)
>>>>> context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
>>>>>
>>>>> 6. Checked my pg_hba.conf.
>>>>> [frank@web]$ su - postgres
>>>>> -bash-4.2$ pwd
>>>>> /var/lib/pgsql/9.6/data
>>>>> -bash-4.2$ ls -alZ pg_hba.conf
>>>>> -rw-------. postgres postgres unconfined_u:object_r:postgresql_db_t:s0
>>>>> pg_hba.conf( pg_hba.conf )
>>>>>
>>>>> ( pg_hba.conf )
>>>>> # TYPE  DATABASE        USER            ADDRESS                 METHOD
>>>>> # "local" is for Unix domain socket connections only
>>>>> #local   all             all                                     peer
>>>>> local   all             all                                md5
>>>>>
>>>>> # IPv4 local connections:
>>>>> #host    all             all             127.0.0.1/32            ident
>>>>> host    all             all             122.32.2.21/32
>>>>> md5   (122.32.2.21  is my server's IP )
>>>>>
>>>>> # IPv6 local connections:
>>>>> #host    all             all             ::1/128                 ident
>>>>> host    all             all             ::1/128                 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
>>>>>
>>>>> 7. I changed postgres user's password like this.
>>>>> postgres=# ALTER USER postgres WITH PASSWORD 'pwd';
>>>>>
>>>>> These are all I did. I can't guess what I should do. Help me please...
>>>>>
>>>>>
>>>>
>>>
>>
>

^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: .pgpass not working ( centos7, pgagent_96 )
  2017-10-16 08:02 .pgpass not working ( centos7, pgagent_96 ) JaeWon Lee <thejaewon@gmail.com>
@ 2017-10-16 15:17 ` David G. Johnston <david.g.johnston@gmail.com>
  2017-10-16 16:23   ` Re: .pgpass not working ( centos7, pgagent_96 ) JaeWon Lee <thejaewon@gmail.com>
  1 sibling, 1 reply; 11+ messages in thread

From: David G. Johnston @ 2017-10-16 15:17 UTC (permalink / raw)
  To: JaeWon Lee <thejaewon@gmail.com>; +Cc: pgsql-admin

On Mon, Oct 16, 2017 at 1:02 AM, JaeWon Lee <thejaewon@gmail.com> wrote:

>
> 5. Checked my .pgpass file. ( .pgpass is in frank's home directory.
> /home/frank )
>
​
Frankly[1], this is probably your problem.  pgAgent is most likely not
running as user "frank".  You need to identify what O/S user the
application is running under and place the .pgpass file in that user's home
directory.

David J.
​
1. pun intended...

^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: .pgpass not working ( centos7, pgagent_96 )
  2017-10-16 08:02 .pgpass not working ( centos7, pgagent_96 ) JaeWon Lee <thejaewon@gmail.com>
  2017-10-16 15:17 ` Re: .pgpass not working ( centos7, pgagent_96 ) David G. Johnston <david.g.johnston@gmail.com>
@ 2017-10-16 16:23   ` JaeWon Lee <thejaewon@gmail.com>
  2017-10-16 18:01     ` Re: .pgpass not working ( centos7, pgagent_96 ) Payal Singh <payal@omniti.com>
  0 siblings, 1 reply; 11+ messages in thread

From: JaeWon Lee @ 2017-10-16 16:23 UTC (permalink / raw)
  To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: pgsql-admin

Thanks ^^
I tested same thing for OS user 'root' (/root),  'postgres' (/var/lib/pgsql
), and other two normal users who has home directory in /home.
But I got same error.
---- [ pgagent_96.log ]
WARNING: Couldn't create the primary connection (attempt 10): fe_sendauth:
no password supplied
ERROR: Stopping pgAgent: Couldn't establish the primary connection with the
database server.


2017-10-17 0:17 GMT+09:00 David G. Johnston <david.g.johnston@gmail.com>:

> On Mon, Oct 16, 2017 at 1:02 AM, JaeWon Lee <thejaewon@gmail.com> wrote:
>
>>
>> 5. Checked my .pgpass file. ( .pgpass is in frank's home directory.
>> /home/frank )
>>
> ​
> Frankly[1], this is probably your problem.  pgAgent is most likely not
> running as user "frank".  You need to identify what O/S user the
> application is running under and place the .pgpass file in that user's home
> directory.
>
> David J.
> ​
> 1. pun intended...
>
>

^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: .pgpass not working ( centos7, pgagent_96 )
  2017-10-16 08:02 .pgpass not working ( centos7, pgagent_96 ) JaeWon Lee <thejaewon@gmail.com>
  2017-10-16 15:17 ` Re: .pgpass not working ( centos7, pgagent_96 ) David G. Johnston <david.g.johnston@gmail.com>
  2017-10-16 16:23   ` Re: .pgpass not working ( centos7, pgagent_96 ) JaeWon Lee <thejaewon@gmail.com>
@ 2017-10-16 18:01     ` Payal Singh <payal@omniti.com>
  2017-10-16 18:04       ` Re: .pgpass not working ( centos7, pgagent_96 ) Payal Singh <payal@omniti.com>
  2017-10-18 10:21       ` Re: .pgpass not working ( centos7, pgagent_96 ) JaeWon Lee <thejaewon@gmail.com>
  0 siblings, 2 replies; 11+ messages in thread

From: Payal Singh @ 2017-10-16 18:01 UTC (permalink / raw)
  To: JaeWon Lee <thejaewon@gmail.com>; +Cc: David G. Johnston <david.g.johnston@gmail.com>; pgsql-admin

Just to be sure, you are able to login to the database from psql? psql -h
localhost -U postgres  ?

Payal Singh,
Database Administrator,
OmniTI Computer Consulting Inc.
Phone: 240.646.0770 x 253

On Mon, Oct 16, 2017 at 12:23 PM, JaeWon Lee <thejaewon@gmail.com> wrote:

> Thanks ^^
> I tested same thing for OS user 'root' (/root),  'postgres'
> (/var/lib/pgsql ), and other two normal users who has home directory in
> /home.
> But I got same error.
> ---- [ pgagent_96.log ]
> WARNING: Couldn't create the primary connection (attempt 10): fe_sendauth:
> no password supplied
> ERROR: Stopping pgAgent: Couldn't establish the primary connection with
> the database server.
>
>
> 2017-10-17 0:17 GMT+09:00 David G. Johnston <david.g.johnston@gmail.com>:
>
>> On Mon, Oct 16, 2017 at 1:02 AM, JaeWon Lee <thejaewon@gmail.com> wrote:
>>
>>>
>>> 5. Checked my .pgpass file. ( .pgpass is in frank's home directory.
>>> /home/frank )
>>>
>> ​
>> Frankly[1], this is probably your problem.  pgAgent is most likely not
>> running as user "frank".  You need to identify what O/S user the
>> application is running under and place the .pgpass file in that user's home
>> directory.
>>
>> David J.
>> ​
>> 1. pun intended...
>>
>>
>

^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: .pgpass not working ( centos7, pgagent_96 )
  2017-10-16 08:02 .pgpass not working ( centos7, pgagent_96 ) JaeWon Lee <thejaewon@gmail.com>
  2017-10-16 15:17 ` Re: .pgpass not working ( centos7, pgagent_96 ) David G. Johnston <david.g.johnston@gmail.com>
  2017-10-16 16:23   ` Re: .pgpass not working ( centos7, pgagent_96 ) JaeWon Lee <thejaewon@gmail.com>
  2017-10-16 18:01     ` Re: .pgpass not working ( centos7, pgagent_96 ) Payal Singh <payal@omniti.com>
@ 2017-10-16 18:04       ` Payal Singh <payal@omniti.com>
  1 sibling, 0 replies; 11+ messages in thread

From: Payal Singh @ 2017-10-16 18:04 UTC (permalink / raw)
  To: JaeWon Lee <thejaewon@gmail.com>; +Cc: David G. Johnston <david.g.johnston@gmail.com>; pgsql-admin

>
> Just to be sure, you are able to login to the database from psql? psql -h
> localhost -U postgres  ?
>
> Payal Singh,
> Database Administrator,
> OmniTI Computer Consulting Inc.
> Phone: 240.646.0770 x 253
>
> On Mon, Oct 16, 2017 at 12:23 PM, JaeWon Lee <thejaewon@gmail.com> wrote:
>
>> Thanks ^^
>> I tested same thing for OS user 'root' (/root),  'postgres'
>> (/var/lib/pgsql ), and other two normal users who has home directory in
>> /home.
>> But I got same error.
>> ---- [ pgagent_96.log ]
>> WARNING: Couldn't create the primary connection (attempt 10):
>> fe_sendauth: no password supplied
>> ERROR: Stopping pgAgent: Couldn't establish the primary connection with
>> the database server.
>>
>>
Also try placing the pgpass file in postgres home and run psql. If that
succeeds, the problem is likely with pgAdmin/pgAgent and you might have
more success asking in pgAdmin specific support mailing list -
https://www.postgresql.org/list/pgadmin-support/

Payal Singh,
Database Administrator,
OmniTI Computer Consulting Inc.
Phone: 240.646.0770 x 253

On Mon, Oct 16, 2017 at 2:01 PM, Payal Singh <payal@omniti.com> wrote:

>
>>
>> 2017-10-17 0:17 GMT+09:00 David G. Johnston <david.g.johnston@gmail.com>:
>>
>>> On Mon, Oct 16, 2017 at 1:02 AM, JaeWon Lee <thejaewon@gmail.com> wrote:
>>>
>>>>
>>>> 5. Checked my .pgpass file. ( .pgpass is in frank's home directory.
>>>> /home/frank )
>>>>
>>> ​
>>> Frankly[1], this is probably your problem.  pgAgent is most likely not
>>> running as user "frank".  You need to identify what O/S user the
>>> application is running under and place the .pgpass file in that user's home
>>> directory.
>>>
>>> David J.
>>> ​
>>> 1. pun intended...
>>>
>>>
>>
>

^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: .pgpass not working ( centos7, pgagent_96 )
  2017-10-16 08:02 .pgpass not working ( centos7, pgagent_96 ) JaeWon Lee <thejaewon@gmail.com>
  2017-10-16 15:17 ` Re: .pgpass not working ( centos7, pgagent_96 ) David G. Johnston <david.g.johnston@gmail.com>
  2017-10-16 16:23   ` Re: .pgpass not working ( centos7, pgagent_96 ) JaeWon Lee <thejaewon@gmail.com>
  2017-10-16 18:01     ` Re: .pgpass not working ( centos7, pgagent_96 ) Payal Singh <payal@omniti.com>
@ 2017-10-18 10:21       ` JaeWon Lee <thejaewon@gmail.com>
  1 sibling, 0 replies; 11+ messages in thread

From: JaeWon Lee @ 2017-10-18 10:21 UTC (permalink / raw)
  To: Payal Singh <payal@omniti.com>; +Cc: pgsql-admin

Thanks ^^  I can log in to database like that.
But still I can not use my .pgpass.
I think this problem may be related to security context of .pgpass.
pgagent_96  or  systemd  may not be allowed to read .pgpass file ... ( Just
my guess ^^ )
I'm checking if pgagent_96 or systemd can read .pgpass.

[root@web bin]# su - postgres
-bash-4.2$ psql -h localhost -U postgres
psql (9.6.5)
postgres=#

[root@web frank]# ls -alZ .pgpass
-rw-------. postgres postgres unconfined_u:object_r:user_home_t:s0 .pgpass
[root@web frank]# ls -alZ /usr/bin/pgagent_96
-rwxr-xr-x. root root system_u:object_r:bin_t:s0       /usr/bin/pgagent_96
[root@web frank]# ls -alZ /usr/lib/systemd/systemd
-rwxr-xr-x. root root system_u:object_r:init_exec_t:s0
/usr/lib/systemd/systemd
[root@web frank]# ls -alZ /var/lib/pgsql/9.6/data/pg_hba.conf
-rw-------. postgres postgres unconfined_u:object_r:postgresql_db_t:s0
/var/lib/pgsql/9.6/data/pg_hba.conf


2017-10-17 3:01 GMT+09:00 Payal Singh <payal@omniti.com>:

> Just to be sure, you are able to login to the database from psql? psql -h
> localhost -U postgres  ?
>
> Payal Singh,
> Database Administrator,
> OmniTI Computer Consulting Inc.
> Phone: 240.646.0770 x 253
>
> On Mon, Oct 16, 2017 at 12:23 PM, JaeWon Lee <thejaewon@gmail.com> wrote:
>
>> Thanks ^^
>> I tested same thing for OS user 'root' (/root),  'postgres'
>> (/var/lib/pgsql ), and other two normal users who has home directory in
>> /home.
>> But I got same error.
>> ---- [ pgagent_96.log ]
>> WARNING: Couldn't create the primary connection (attempt 10):
>> fe_sendauth: no password supplied
>> ERROR: Stopping pgAgent: Couldn't establish the primary connection with
>> the database server.
>>
>>
>> 2017-10-17 0:17 GMT+09:00 David G. Johnston <david.g.johnston@gmail.com>:
>>
>>> On Mon, Oct 16, 2017 at 1:02 AM, JaeWon Lee <thejaewon@gmail.com> wrote:
>>>
>>>>
>>>> 5. Checked my .pgpass file. ( .pgpass is in frank's home directory.
>>>> /home/frank )
>>>>
>>> ​
>>> Frankly[1], this is probably your problem.  pgAgent is most likely not
>>> running as user "frank".  You need to identify what O/S user the
>>> application is running under and place the .pgpass file in that user's home
>>> directory.
>>>
>>> David J.
>>> ​
>>> 1. pun intended...
>>>
>>>
>>
>

^ permalink  raw  reply  [nested|flat] 11+ messages in thread


end of thread, other threads:[~2017-10-18 10:21 UTC | newest]

Thread overview: 11+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-10-16 08:02 .pgpass not working ( centos7, pgagent_96 ) JaeWon Lee <thejaewon@gmail.com>
2017-10-16 08:09 ` JaeWon Lee <thejaewon@gmail.com>
2017-10-16 08:16   ` JaeWon Lee <thejaewon@gmail.com>
2017-10-16 08:18     ` JaeWon Lee <thejaewon@gmail.com>
2017-10-16 14:09       ` Shreeyansh Dba <shreeyansh2014@gmail.com>
2017-10-16 14:58         ` JaeWon Lee <thejaewon@gmail.com>
2017-10-16 15:17 ` David G. Johnston <david.g.johnston@gmail.com>
2017-10-16 16:23   ` JaeWon Lee <thejaewon@gmail.com>
2017-10-16 18:01     ` Payal Singh <payal@omniti.com>
2017-10-16 18:04       ` Payal Singh <payal@omniti.com>
2017-10-18 10:21       ` JaeWon Lee <thejaewon@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox