Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W9JLS-0008TR-3b for pgsql-admin@arkaria.postgresql.org; Fri, 31 Jan 2014 19:01:42 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1W9JLQ-0003cS-Kr for pgsql-admin@arkaria.postgresql.org; Fri, 31 Jan 2014 19:01:40 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W9JLO-0003cJ-8r for pgsql-admin@postgresql.org; Fri, 31 Jan 2014 19:01:38 +0000 Received: from qmta15.westchester.pa.mail.comcast.net ([2001:558:fe14:44:76:96:59:228]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W9JLK-0003l8-7c for pgsql-admin@postgresql.org; Fri, 31 Jan 2014 19:01:36 +0000 Received: from omta24.westchester.pa.mail.comcast.net ([76.96.62.76]) by qmta15.westchester.pa.mail.comcast.net with comcast id LhSS1n0091ei1Bg5Fj1XoU; Fri, 31 Jan 2014 19:01:31 +0000 Received: from sz0093.wc.mail.comcast.net ([68.87.26.138]) by omta24.westchester.pa.mail.comcast.net with comcast id Lj1X1n0102ymm843kj1Xgd; Fri, 31 Jan 2014 19:01:31 +0000 Date: Fri, 31 Jan 2014 19:01:31 +0000 (UTC) From: Lou Picciano To: pgsql-admin Cc: Mark Steben Message-ID: <1676386945.897876.1391194891512.JavaMail.root@sz0093a.westchester.pa.mail.comcast.net> In-Reply-To: Subject: Re: configuring openssl for postgres 9.2 for the first time MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [::ffff:76.117.177.86] X-Mailer: Zimbra 6.0.13_GA_2944 (ZimbraWebClient - SAF3 (Mac)/6.0.13_GA_2944) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20121106; t=1391194891; bh=fDzbJESU33GCu9tt/PQVNeRZLMbygS1Fqs6MPqYaSQQ=; h=Received:Received:Date:From:To:Message-ID:Subject:MIME-Version: Content-Type; b=RtOcoUbZY4KCZoT01B7muwu1ri9PdCFjKWKSwVxMRB6x+Sn/M99V3fBMgh+WEcNUn 0a3pWBjcBzGJDoryeHnjqcxuHtlm5h7+8/G/i0+gD398qwrf8TNDbf/QlN5F6dHgUW 1pTNhSEZqKBp0t5IL4vAMKBRozz9VlpNYPlkrVtdtyCtXyBIniMVdPZ4T/aYsZgj1p ARJo8rHYhn6SAdnvQFXB9YMLCcwSUIo8I0MX5/d3ht9Rw7SGn0C0mnFxTxQ2dRpG46 kgCIBq4SHVI07KRhsJnNRPMd44dKyrtg1sr2qrVaMYMEB4DJEZOZnknKXJrq6CFtRy 3fL0GWdCekYMw== X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org Hello Mark: Cursory review? Looks like this line in you pg_hba.conf will cause the server to demand a 'login' name of '10.10.4.34' -- the 'Common Name' of the cert you're presenting. but you're trying to login as 'postgres'. hostssl all all 0.0.0.0/0 cert clientcert=1 The six-ticket ride, just for fun? Try adding the ROLE 10.10.4.34, with login privs, of course, to your cluster. Then add this line to pg_hba.conf: hostssl all "10.10.4.34" 0.0.0.0/0 cert clientcert=1 Also, check that your log reports the server _first_ trying the SSL connection. If not, you may not be using an SSL-enabled client, a requirement. (Do you have other lines in pg_hba.conf? These may be in play...) ...and welcome to The Joys of Cert Authentication on PostgreSQL. The Good News? It works great! (It's at the core of our infrastructure here). Lou Picciano ----- Original Message ----- From: "Mark Steben" To: pgsql-admin@postgresql.org Sent: Thursday, January 30, 2014 2:00:53 PM Subject: [ADMIN] configuring openssl for postgres 9.2 for the first time Hello, We are looking to provide openssl methodology into our testing environment. I've run into this issue when attempting to access from a client to a remote postgres server after SSL configuration: from client 10.10.4.34 : psql -U postgres marktst -h 10.10.4.52 psql: FATAL: no pg_hba.conf entry for host "10.10.4.34", user "postgres", database "marktst", SSL off Here are the steps I've taken trying to follow postgresql 9.2 docs sections 17.9 and 30.17: on CLIENT (10.10.4.34) I. Created a 'self-signed' certificate (in home directory /home/postgres/.postgresql:) A. openssl req -new -text -out postgresql.req (create request) ***NOTE - the 'common name' I entered in when prompted was the ip address 10.10.4.34 *** B. 1. openssl rsa -in privkey.pem -out postgresql.key 2. rm privkey.com (these two steps to remove the passphrase from certificate) C. 1. openssl req -x509 -in postgresql.req -text -key postgresql.key -out postgresql.crt 2. chmod 600 postgresql.key (to generate package and renounce 'world authority') 2. secure copied postgresql.crt to the 9.2 data directory in server 10.10.4.52. The name I copied to was root.crt on SERVER (10.10.4.52) I. Created a 'self signed' certificate A. openssl req -new -text -out server.req ***NOTE - the 'common name' entered when prompted was ip address 10.10.4.52 B. 1. openssl rsa -in privkey.pem -out server.key 2. rm privkey.pem (to remove passphrase from certificate) C. 1. openssl req -x509 -in server.req -text -key server.key -out.server.crt 2. chmod 600 serverkey II. Copied server.key and server.crt to the data directory III re-installed postgres from source using config option --with-openssl (along with make, make install) IV. made the following changes to postgresql, pg.hba.conf files and restarted server A. postgresql.conf 1. ssl = on 2. ssl_ca_file = root.crt 3. ssl_cert_file = server.crt 4. uncommented ssl_ciphers to ensure all the defaults allowed 5. ssl_key_file = server.key B. pg_hba.conf 1. added one line: hostssl all all 0.0.0.0/0 cert clientcert=1 I can login locally as postgres as I have a local entry in pg_hba.conf. Any insight appreciated. thank you, Mark Steben Database Administrator @utoRevenue | Autobase CRM division of Dominion Dealer Solutions 95D Ashley Ave. West Springfield, MA 01089 t: 413.327-3045 f: 413.383-9567 www.fb.com/DominionDealerSolutions www.twitter.com/DominionDealer www.drivedominion.com -- Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin