Question

I run pgpool-II as postgres user so I can replicate exactly what I did in one sequence here in this post.

-bash-4.2$ echo "pgpool:$(pg_md5 test)" > /etc/pgpool-II-11/pcp.conf
-bash-4.2$ cat /etc/pgpool-II-11/pcp.conf
pgpool:098f6bcd4621d373cade4e832627b4f6
<Restart pgpool-II-11 service>
-bash-4.2$ echo "cia-db-vip:9898:pgpool:$(pg_md5 test)" > .pcppass
-bash-4.2$ cat .pcppass
cia-db-vip:9898:pgpool:098f6bcd4621d373cade4e832627b4f6
-bash-4.2$ pcp_watchdog_info -h cia-db-vip -p 9898 -U pgpool -w 0
FATAL:  authentication failed for user "pgpool"
DETAIL:  username and/or password does not match

-bash-4.2$ pcp_watchdog_info -h cia-db-vip -p 9898 -U pgpool 0
Password: <I Enter the password test>
2 YES cia-db-3:9999 Linux cia-db-3 cia-db-3

cia-db-3:9999 Linux cia-db-3 cia-db-3 9999 9000 4 MASTER
-bash-4.2$ ls -l .pcppass /etc/pgpool-II-11/pcp.conf
-rw-------. 1 postgres postgres 40 Jul 30 11:22 /etc/pgpool-II-11/pcp.conf
-rw-------. 1 postgres postgres 56 Jul 30 11:23 .pcppass

So only if I enter the password does it work. I've also tried hitting enter without a password.

I tried checking strace -ff pcp_watchdog_info and it starts to read the file .pcppass but I can only see the first line. Have no idea if it continues reading through the file or closes it.

stat("/var/lib/pgsql/.pcppass", {st_mode=S_IFREG|0600, st_size=56, ...}) = 0
open("/var/lib/pgsql/.pcppass", O_RDONLY) = 4
fstat(4, {st_mode=S_IFREG|0600, st_size=56, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f581f3d6000
read(4, "cia-db-vip:9898:pgpool:098f6bcd4"..., 4096) = 56
close(4)                                = 0
munmap(0x7f581f3d6000, 4096)            = 0
write(3, "M\0\0\0\4", 5)                = 5
select(4, [3], NULL, [3], NULL)         = 1 (in [3])
read(3, "m\0\0\0\10\205^\v\341", 1024)  = 9
write(3, "R\0\0\0,pgpool\000381d652cc9ef7891d4cb"..., 45) = 45
select(4, [3], NULL, [3], NULL)         = 1 (in [3])
read(3, "E\0\0\0xSFATAL\0CXX000\0Mauthenticati"..., 1024) = 121
close(3)                                = 0
write(2, "FATAL:  authentication failed fo"..., 98FATAL:  authentication failed for user "pgpool"
DETAIL:  username and/or password does not match

I also tried resetting the postgres user pgpool password to test, including in /etc/pgpool-II-11/pool_passwd but I doubt it matters since I can actually use pcp commands if I enter the password. So it seems that user is separate from the postgres users.

Edit: Also tried temporarily setting SElinux to permissive but it did not help.

Was it helpful?

Solution

The password is not supposed to be pg_md5 encoded in the .pcppass file, only in the pcp.conf file.

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top