[pgpool-general: 2723] Re: pcp override locahost as default host?

Tatsuo Ishii ishii at postgresql.org
Tue Apr 8 08:29:47 JST 2014


Hi Jeff,

Thanks for the patch. It works as expected on my testing.

The only concern is, with the patch now pcp is only allowed to connect
to the same address as pgpool itself (before was allowed to connect
from any address). Suppose we have machine which has network
192.168.10.0 and 192.168.20.0, and 192.168.10.0 is supposed to be used
for incoming connections from clients. So only 192.168.10.0 is set to
listen_address of pgpool.conf. On the other hand 192.168.20.0 is for
managing use and admin connects this port by using pcp
command. Before, pcp server was bound to both 192.168.10.0 and
192.168.20.0 because listen address was '*' in bind(2). Now it is only
bound to 192.168.10.0 and the admin fails to connect by using pcp.

What do yo think?

Best regards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese: http://www.sraoss.co.jp

> I experimented today with hopefully a very simple fix for this.
> 
> I'm working with v 3.3.3, and on line 674 in main.c, I now have the
> following changed line:
> 
> pcp_inet_fd = create_inet_domain_socket(pool_config->listen_addresses,
> pool_config->pcp_port);
> 
> so far in my testing, this seems to work without any errors, I can issue
> pcp commands with normal
> results, and the process is binding to the address as specified in
> pgpool.conf's listen_addresses parameter.
> 
> attached is the main.c file
> 
> I took the approach of using the existing 'listen_addresses' parameter
> rather than creating a new configuration parameter.
> 
> best regards
> 
> Jeff McCormick
> 
> 
> 
> On Sat, Apr 5, 2014 at 5:53 AM, Tatsuo Ishii <ishii at postgresql.org> wrote:
> 
>> Hi Jeff,
>>
>> Oh, I see. As I said currently there's no way to override the
>> setting. Can you please propose a fix for it?
>>
>> Best regards,
>> --
>> Tatsuo Ishii
>> SRA OSS, Inc. Japan
>> English: http://www.sraoss.co.jp/index_en.php
>> Japanese: http://www.sraoss.co.jp
>>
>> > Hi Tatsuo,
>> >
>> > the reason is they run a multi-tenet form of PaaS on a single physical
>> > host, you could for example have several different application
>> 'instances'
>> > running and each needs to be prevented from stepping on the other
>> deployed
>> > applications, what Openshift does is assign a unique IP address to each
>> > application instance that they can bind to instead.  They use selinux to
>> > lock down each application into it's own jail.  Kind of an interesting
>> idea
>> > but it seems to always trip up applications that reference 'localhost'.
>> >
>> > I had to patch postgres (pgstat.c) to overcome this exact issue.  I
>> think I
>> > see the line of code in main.c where I could make a similar patch for
>> > pgpool but wasn't sure if there was another way to override the setting.
>> >
>> > regards
>> >
>> > Jeff McCormick
>> >
>> >
>> > On Thu, Apr 3, 2014 at 7:09 PM, Tatsuo Ishii <ishii at postgresql.org>
>> wrote:
>> >
>> >> > Is there a way to override the host that pcp binds to?  it appears to
>> >> bind
>> >> > to localhost
>> >> > by default.
>> >>
>> >> Sorry, but no.
>> >>
>> >> > I am running pgpool on Openshift where binding to 127.0.0.1 is not
>> >> allowed.
>> >>
>> >> Just out of curiosity, do you know why Openshift does not allow it?
>> >>
>> >> If the reason is sane, I would like to address the problem in the
>> future.
>> >>
>> >> Best regards,
>> >> --
>> >> Tatsuo Ishii
>> >> SRA OSS, Inc. Japan
>> >> English: http://www.sraoss.co.jp/index_en.php
>> >> Japanese: http://www.sraoss.co.jp
>> >>
>> >
>> >
>> >
>> > --
>> > *Jeff McCormick*
>> > 843-327-5754
>> > jeffmc04 at gmail.com
>>
> 
> 
> 
> -- 
> *Jeff McCormick*
> 843-327-5754
> jeffmc04 at gmail.com


More information about the pgpool-general mailing list