Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1azrp4-00052G-MQ for pgsql-bugs@arkaria.postgresql.org; Mon, 09 May 2016 20:30:34 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1azrp4-0003xA-9L for pgsql-bugs@arkaria.postgresql.org; Mon, 09 May 2016 20:30:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1azroQ-0003BW-RN for pgsql-bugs@postgresql.org; Mon, 09 May 2016 20:29:54 +0000 Received: from gproxy5-pub.mail.unifiedlayer.com ([67.222.38.55]) by magus.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1azroM-0002Gk-3k for pgsql-bugs@postgresql.org; Mon, 09 May 2016 20:29:54 +0000 Received: (qmail 26878 invoked by uid 0); 9 May 2016 20:29:47 -0000 Received: from unknown (HELO cmgw4) (10.0.90.85) by gproxy5.mail.unifiedlayer.com with SMTP; 9 May 2016 20:29:47 -0000 Received: from box389.bluehost.com ([69.89.31.189]) by cmgw4 with id sLVd1s00V44paXZ01LVghF; Mon, 09 May 2016 14:29:47 -0600 X-Authority-Analysis: v=2.1 cv=aJ5j99Nm c=1 sm=1 tr=0 a=7/VPv81j2DGlxAUA/rvrRg==:117 a=7/VPv81j2DGlxAUA/rvrRg==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=v_EBXs2xYywA:10 a=B5BlCi73M48A:10 a=yrkiwgmsf1kA:10 a=r77TgQKjGQsHNAKrUKIA:9 a=epTmVMiNAAAA:8 a=w50gjuj3YM6Xnw1kvwYA:9 a=owx1dIphLGJo2xL9:21 a=ROdtTHL-s47iJyF0:21 a=QEXdDO2ut3YA:10 a=-58Vfd3QvrIA:10 a=ffi9OvK0suoA:10 a=DrzikTGf0PBcaVqJ860A:9 a=PjmM5HQEuyoprJFP:21 a=J8JAtFhgzrh_z9kQ:21 a=nWWm9gdIm9Zlw2uD:21 a=_W_S_7VecoQA:10 a=ndEWmUVY6Yapc0oHF_P4:22 Received: from [75.159.201.239] (port=53948 helo=[192.168.1.20]) by box389.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.86_2) (envelope-from ) id 1azro9-0003w2-75; Mon, 09 May 2016 14:29:37 -0600 To: Heikki Linnakangas , pgsql-bugs@postgresql.org In-Reply-To: 5730C6F6.2000302@iki.fi From: Sergei Agalakov Subject: It seems to be a documentation bug to me then Message-ID: <37243100-aa81-1e38-ec77-c33e837e0c66@getmyle.com> Date: Mon, 9 May 2016 14:29:50 -0600 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="------------4D998F5490A5F21180E37B22" X-Identified-User: {3455:box389.bluehost.com:getmylec:getmyle.com} {sentby:smtp auth 75.159.201.239 authed with sergei.agalakov@getmyle.com} X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org This is a multi-part message in MIME format. --------------4D998F5490A5F21180E37B22 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit To resolve this confusion all we need is to add something like to documentation http://www.postgresql.org/docs/9.5/static/libpq-ssl.html Currently PostgreSQL supports only Subject Alternative Name attribute(s) of type dNSName, and IP type isn't supported. and remove If the connection is made using an IP address instead of a host name, the IP address will be matched (without doing any DNS lookups). The last one seems to be incorrect, if the SAN IP attributes are ignored. Am I correct? Sergei Agalakov > On 09/05/16 20:08, sergei(dot)agalakov(at)getmyle(dot)com wrote: > > CentOS 7, OpenSSL 1.0.2h, Postgres 9.5.2 > > 1. Created server certificate signed by local CA with three Subject > > Alternative Name values > > $ openssl x509 -in server.crt -text -noout > > ... > > X509v3 Subject Alternative Name: > > DNS:myle-db001a-small.c.myle-gce-proj-01.internal, IP > > Address:162.222.177.29, IP Address:10.240.0.3 > > ... > > 2. Created and copied root.crt for local CA certificate > > 3. Switched SSL mode to verify-full > > $export PGSSLMODE=verify-full > > 4. $psql -h 10.240.0.3 -U postgres > > psql: server certificate for "myle-db001a-small.c.myle-gce-proj-01.internal" > > does not match host name "10.240.0.3" > > According to E.3.3.1.4. SSL in > >http://www.postgresql.org/docs/9.5/static/release-9-5.html > > PG 9.5 should check all Subject Alternative Names to match in the > > certificate. The same implies in > >http://www.postgresql.org/docs/9.5/static/libpq-ssl.html > > "In verify-full mode, the host name is matched against the certificate's > > Subject Alternative Name attribute(s), or against the Common Name attribute > > if no Subject Alternative Name of type dNSName is present." > > An expected result was a SSL connection because one of SAN attributes > > matched host name. Instead a connection was refused. > > PostgreSQL only pays attention to "DNS" SAN attributes, the IP addresses > are ignored. It would be a nice feature if it did, but that hasn't been > implemented. > > - Heikki > --------------4D998F5490A5F21180E37B22 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit To resolve this confusion all we need is to add something like to documentation
http://www.postgresql.org/docs/9.5/static/libpq-ssl.html

Currently PostgreSQL supports only Subject Alternative Name attribute(s) of type dNSName, and IP type isn't supported.

and remove

If the connection is made using an IP address instead of a host name, the IP address will be matched (without doing any DNS lookups).

The last one seems to be incorrect, if the SAN IP attributes are ignored.
Am I correct?

Sergei Agalakov

On 09/05/16 20:08, sergei(dot)agalakov(at)getmyle(dot)com wrote:
> CentOS 7, OpenSSL 1.0.2h, Postgres 9.5.2
> 1. Created server certificate signed by local CA with three Subject
> Alternative Name values
> $ openssl x509 -in server.crt -text -noout
> ...
> X509v3 Subject Alternative Name:
>                  DNS:myle-db001a-small.c.myle-gce-proj-01.internal, IP
> Address:162.222.177.29, IP Address:10.240.0.3
> ...
> 2. Created and copied root.crt for local CA certificate
> 3. Switched SSL mode to verify-full
> $export PGSSLMODE=verify-full
> 4. $psql -h 10.240.0.3 -U postgres
> psql: server certificate for "myle-db001a-small.c.myle-gce-proj-01.internal"
> does not match host name "10.240.0.3"
> According to E.3.3.1.4. SSL in
> http://www.postgresql.org/docs/9.5/static/release-9-5.html
> PG 9.5 should check all Subject Alternative Names to match in the
> certificate. The same implies in
> http://www.postgresql.org/docs/9.5/static/libpq-ssl.html
> "In verify-full mode, the host name is matched against the certificate's
> Subject Alternative Name attribute(s), or against the Common Name attribute
> if no Subject Alternative Name of type dNSName is present."
> An expected result was a SSL connection because one of SAN attributes
> matched host name. Instead a connection was refused.

PostgreSQL only pays attention to "DNS" SAN attributes, the IP addresses 
are ignored. It would be a nice feature if it did, but that hasn't been 
implemented.

- Heikki


--------------4D998F5490A5F21180E37B22--