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

Tatsuo Ishii ishii at postgresql.org
Thu Apr 10 14:23:03 JST 2014


Jeff,

Thank you for patch. I have committed to master branch with some
additions/modifications:

1) change the directive name to pcp_listen_addresses. This is for
   consistency purpose with existing "listen_addresses" directive.

2) modification to pool_config.l, rather than pool_config.c because
   pool_config.c is delived from pool_config.l

3) allow to specify empty pcp_listen_addresses. In this case only UNIX
   domain socket will be listen on (consistent behavior with
   listen_addresses).

4) Add documentations, pgoool.conf samples and show pool_status
   directive.

Again, thank you for your effort!

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

> thank you Tatsuo,
> 
> attached is the patch for the 4 changed files.
> 
> regards
> 
> Jeff McCormick
> 
> 
> 
> 
> On Tue, Apr 8, 2014 at 6:40 PM, Tatsuo Ishii <ishii at sraoss.co.jp> wrote:
> 
>> Jeff,
>>
>> Thanks for the patch. Could you please give it to me as a patch?
>>
>> Best regards,
>> --
>> Tatsuo Ishii
>> SRA OSS, Inc. Japan
>> English: http://www.sraoss.co.jp/index_en.php
>> Japanese: http://www.sraoss.co.jp
>>
>> > the more I think about it, the more I think the case you mention is more
>> > likely to occur than
>> > my case, so what I have done is created another version that I think will
>> > allow both
>> > cases to be addressed.  attached are the files that were changed.
>> >
>> > Essentially, I created another pool config setting called pcp_address,
>> the
>> > default value is "*", this
>> > can be overridden in the pgpool.conf file with a host setting to solve my
>> > case.  It seems to work
>> > so far in my testing of both the default case and the override case.
>> >
>> > Jeff McCormick
>> >
>> >
>> > On Mon, Apr 7, 2014 at 7:29 PM, Tatsuo Ishii <ishii at postgresql.org>
>> wrote:
>> >
>> >> 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
>> >>
>> >
>> >
>> >
>> > --
>> > *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