<div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif">Thank you Tatsuo, you have been very helpful!<br><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">I also think it would be a good idea, if the part of your reply about the authentication flow<br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">was added to the manual at the section &quot;Authentication / Access Controls&quot; because it <br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">answers (at least for newcomers) some of the common security-related worries.<br></div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">Thanks again, and congratulations on the great work!<br></div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 11, 2015 at 3:38 AM, Tatsuo Ishii <span dir="ltr">&lt;<a href="mailto:ishii@postgresql.org" target="_blank">ishii@postgresql.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Michail,<br>
<br>
Welcome to the pgpool-II world!<br>
<div><div class="h5"><br>
&gt; Hello list,<br>
&gt;<br>
&gt; First, i am a complete newbie to pgpool, so please forgive any<br>
&gt; misunderstandings i may have. I am experimenting with pgpool in order to<br>
&gt; use it in front of a master/standy postgresql cluster (streaming<br>
&gt; replication) as the only connection endpoint for several web applications.<br>
&gt; I have installed (via APT) pgpool2  3.1.3-5.<br>
&gt;<br>
&gt; I was trying to understand the authentication workflow (and in particular<br>
&gt; how pool_hba works). I guessed that pool_hba is there to authenticate<br>
&gt; client connections before (re)using an already authenticated connection<br>
&gt; from the connection pool (to one of the backends).<br>
&gt;<br>
&gt; I use the following settings:<br>
&gt; enable_pool_hba = on<br>
&gt; pool_passwd = &#39;pool_passwd&#39;<br>
&gt;<br>
&gt; I populated pool_passwd (owned by postgres, 0600) using pg_md5 as described<br>
&gt; at the official manual:<br>
&gt; pg_md5 --md5auth -p -u tester -f /etc/pgpool2/pgpool.conf<br>
&gt; and it;s contents are now:<br>
&gt; tester:md5c3271fc99b3e8cada6aa9d8b8f0d0938<br>
&gt;<br>
&gt; I have a pool_hba.conf file with an entry (let <a href="http://192.168.1.0/24" target="_blank">192.168.1.0/24</a> be the<br>
&gt; network from where applications connect to pgpool):<br>
&gt; host    all         all         <a href="http://192.168.1.0/24" target="_blank">192.168.1.0/24</a>        md5<br>
&gt;<br>
&gt; The backend&#39;s (only 1 for the time) pg_hba.conf is configured to trust<br>
&gt; (method:trust) connections from user &quot;tester&quot; originating from pgpool&#39;s<br>
&gt; host.<br>
&gt;<br>
&gt; So, i&#39;d expect that when trying to connect to pgpool (e.g. with psql), i<br>
&gt; would have been forced to authenticate against pool_passwd&#39;s entries, but<br>
&gt; instead i passed without a prompt (just like connecting directly to the<br>
&gt; backend). Is this the normal behavior?<br>
<br>
</div></div>Yes. pgpool-II first asks backends if md5 auth is required or not. If<br>
required, pgpool-II asks md5 auth to frontend. In other word, if the<br>
backends do not require md5 auth, trust auth is used.<br>
<span class=""><br>
&gt; More generally, i was curious on how exactly are clients authenticated and<br>
&gt; mapped to (opened?) connection slots from the pool?<br>
<br>
</span>Each connection request from frontend is associated with user name and<br>
database name. pgpool-II also remembers opened connection&#39;s user name<br>
and database name. So pgpool-II can easily maps an incoming connection<br>
request to already opened connections (if any). In md5 auth case,<br>
pgpool-II also memories hashed password for the opened connection. So<br>
pgpool-II does the auth work without asking backends.<br>
<span class=""><br>
&gt; Thanks for your time!<br>
&gt;<br>
&gt; Michail Alexakis,<br>
&gt; Software engineer,  RC &quot;Athena&quot;, Athens, Greece<br>
<br>
</span>Best regards,<br>
--<br>
Tatsuo Ishii<br>
SRA OSS, Inc. Japan<br>
English: <a href="http://www.sraoss.co.jp/index_en.php" target="_blank">http://www.sraoss.co.jp/index_en.php</a><br>
Japanese:<a href="http://www.sraoss.co.jp" target="_blank">http://www.sraoss.co.jp</a><br>
</blockquote></div><br></div>