Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.8.0 not uses .pgpass data #94

Closed
AndreyKopeyko opened this issue May 28, 2021 · 5 comments
Closed

0.8.0 not uses .pgpass data #94

AndreyKopeyko opened this issue May 28, 2021 · 5 comments

Comments

@AndreyKopeyko
Copy link

Describe the bug
Looks like v0.8.0 ignores .pgpass file (or fails to get proper password from it) while 0.6.6 do use it.

Environment
Describe the environment where the bug occurred.

  • OS: CentOS 7 x86_64
  • no Docker
  • pgCenter Version: v0.8.0 df1cea5-release
  • pgCenter installation method: rpm from releases
  • PostgreSQL Version: PostgreSQL 13.2 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit

To Reproduce

[a.kopeyko@almadb3 ~]$ bin/pgcenter --version
pgcenter v0.8.0 df1cea5201ee10e6a9b99fae6a45bc5a3a4f70b4-release
[a.kopeyko@almadb3 ~]$ grep /tmp/ .pgpass 
/tmp/:7655:m***db:c**r:*****
[a.kopeyko@almadb3 ~]$ bin/pgcenter top -h /tmp/ -p 7655 -d m***db -U c**r
failed connection establishing: failed to connect to `host=/tmp/ user=c**r database=m***db`: server error (ERROR: password authentication failed (SQLSTATE 08P01))
[a.kopeyko@almadb3 ~]$ 

[a.kopeyko@almadb3 ~]$ /bin/pgcenter --version
pgcenter v0.6.6 4f87424-master
[a.kopeyko@almadb3 ~]$ rpm -qf /bin/pgcenter
pgcenter-0.6.6-1.x86_64
[a.kopeyko@almadb3 ~]$ /bin/pgcenter top -h /tmp/ -p 7655 -d maindb -U calendar
(...starts & connects fine...)

Expected behavior
Expect no connection problem as correct password is placed into .pgpass file and is used by pgcenter-0.6.6

Additional context
Add any other context about the problem here. This could be:

  • PostgreSQL error logs
  • Your assumptions, thoughts, hypothesis, etc
  • Whatever else?
@lesovsky
Copy link
Owner

Have you tried connect with psql using the same args and .pgpass? I mean:

$ cat ~/.pgpass
/tmp:7655:maindb:calendar:*****
$ psql -h /tmp/ -p 7655 -d maindb -U calendar

I ask, because psql also fails and this confuses me. When I change directory path to * all become ok.

@lesovsky
Copy link
Owner

Huh, my mistake, slash at the end of directory does matter.

@lesovsky
Copy link
Owner

Ok, the issue is confirmed, need some investigations.
Thanks for report.

@lesovsky
Copy link
Owner

Have inspect the code of used pgx driver and found that when UNIX path is used as a host, the driver uses "localhost" string for searching the password in the .pgpass. The interesting code here.

I asked the question about what the reason of this approach.

As a workaround I suppose to use 'localhost' value in pgpass instead of UNIX paths.

@lesovsky
Copy link
Owner

Closed due to behavior related to dependent library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants