pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
How to enable SSL on client
4+ messages / 3 participants
[nested] [flat]

* How to enable SSL on client
@ 2014-12-05 09:37  Rajagopalan, Jayashree <Jayashree.Rajagopalan@emc.com>
  0 siblings, 3 replies; 4+ messages in thread

From: Rajagopalan, Jayashree @ 2014-12-05 09:37 UTC (permalink / raw)
  To: pgsql-admin

Hi all:

I'm on postgres 9.0.18. Want to enable SSL for the DB connections.
The binaries are build including the openssl.

I modified the postgresql.conf - for ssl=on.
Copied the server.crt in the  data folder.
Modified pg_hba.conf  - to add:

"hostssl  all         all        0.0.0.0/0       md5"

Getting the following errors in the logs when I start DB:
FATAL:  no pg_hba.conf entry for host "127.0.0.1", user "myuser", database "mydb", SSL off

Can someone share the right procedure to enable SSL on client?
I've created ~/.posgresql directory and added the client.crt and server.key.

Regards
Jayashree

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: How to enable SSL on client
@ 2014-12-05 10:22  reiner peterke <zedaardv@drizzle.com>
  parent: Rajagopalan, Jayashree <Jayashree.Rajagopalan@emc.com>
  2 siblings, 0 replies; 4+ messages in thread

From: reiner peterke @ 2014-12-05 10:22 UTC (permalink / raw)
  To: Rajagopalan, Jayashree <Jayashree.Rajagopalan@emc.com>; +Cc: pgsql-admin


> On Dec 5, 2014, at 10:37 AM, Rajagopalan, Jayashree <Jayashree.Rajagopalan@emc.com> wrote:
> 
> Hi all:
>  
> I’m on postgres 9.0.18. Want to enable SSL for the DB connections.
> The binaries are build including the openssl.
>  
> I modified the postgresql.conf – for ssl=on.
> Copied the server.crt in the  data folder.
> Modified pg_hba.conf  - to add:
> 
> “hostssl  all         all        0.0.0.0/0       md5”
>  
> Getting the following errors in the logs when I start DB:
> FATAL:  no pg_hba.conf entry for host "127.0.0.1", user "myuser", database "mydb", SSL off
>  
> Can someone share the right procedure to enable SSL on client?
> I’ve created ~/.posgresql directory and added the client.crt and server.key.
>  
> Regards
> Jayashree

Hi Jayashree,

I was recently setting this up, if i remember correctly to get the client to use SSL, i set the  PGSSLMODE environment variable to prefer or require.
Unfortunately I don’t work with that system anymore so i cannot just look at the settings.

Let me know if that helps.

Reiner

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: How to enable SSL on client
@ 2014-12-05 11:09  Harshad Adalkonda <adalkondaharshad@gmail.com>
  parent: Rajagopalan, Jayashree <Jayashree.Rajagopalan@emc.com>
  2 siblings, 0 replies; 4+ messages in thread

From: Harshad Adalkonda @ 2014-12-05 11:09 UTC (permalink / raw)
  To: Rajagopalan, Jayashree <Jayashree.Rajagopalan@emc.com>; +Cc: pgsql-admin

On Fri, Dec 5, 2014 at 3:07 PM, Rajagopalan, Jayashree <
Jayashree.Rajagopalan@emc.com> wrote:

>  Hi all:
>
>
>
> I’m on postgres 9.0.18. Want to enable SSL for the DB connections.
>
> The binaries are build including the openssl.
>
>
>
> I modified the postgresql.conf – for ssl=on.
>
> Copied the server.crt in the  data folder.
>
> Modified pg_hba.conf  - to add:
>
>
> “hostssl  all         all        0.0.0.0/0       md5”
>
>
>
> Getting the following errors in the logs when I start DB:
>
> FATAL:  no pg_hba.conf entry for host "127.0.0.1", user "myuser", database
> "mydb", SSL off
>
>
>
> Can someone share the right procedure to enable SSL on client?
>
> I’ve created ~/.posgresql directory and added the client.crt and
> server.key.
>
>
>
> Regards
>
> Jayashree
>


Hi Jayashree,

If you have created root, server, client certificate then you need to copy
following files in your *data* directory

rootCA.crt, server.crt, server.key
chmod 600 server.key

Your pg_hba.conf entry should be as following eg.

hostssl  myuser        mydb          192.168.0.112/0        cert
clientcert=1

In your postgresql.conf

ssl=on
ssl_cert_file = 'server.crt'
ssl_key_file = 'server.key'
ssl_ca_file = 'rootCA.crt'

Now create directory in users home directory.
Suppose you are using postgres from myuser in your linux then execute the
following commands.

su - myuser
mkdir ~/.postgresql

copy rootCA.crt, postgresql.crt, postgresql.key in the *.postgresql*
directory.
chmod 600 postgresql.key

now try to connect as following eg.

psql -h 192.168.0.112 -U myuser -d mydb -p 5432

The above solution will solve your problem.

Thanks & Regards,
Harshad Adalkonda
Database Administrator
harshad.adalkonda@shreeyansh.com

www.shreeyansh.com

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: How to enable SSL on client
@ 2014-12-05 11:18  Harshad Adalkonda <adalkondaharshad@gmail.com>
  parent: Rajagopalan, Jayashree <Jayashree.Rajagopalan@emc.com>
  2 siblings, 0 replies; 4+ messages in thread

From: Harshad Adalkonda @ 2014-12-05 11:18 UTC (permalink / raw)
  To: Rajagopalan, Jayashree <Jayashree.Rajagopalan@emc.com>; +Cc: pgsql-admin

On Fri, Dec 5, 2014 at 3:07 PM, Rajagopalan, Jayashree <
Jayashree.Rajagopalan@emc.com> wrote:

>  Hi all:
>
>
>
> I’m on postgres 9.0.18. Want to enable SSL for the DB connections.
>
> The binaries are build including the openssl.
>
>
>
> I modified the postgresql.conf – for ssl=on.
>
> Copied the server.crt in the  data folder.
>
> Modified pg_hba.conf  - to add:
>
>
> “hostssl  all         all        0.0.0.0/0       md5”
>
>
>
> Getting the following errors in the logs when I start DB:
>
> FATAL:  no pg_hba.conf entry for host "127.0.0.1", user "myuser", database
> "mydb", SSL off
>
>
>
> Can someone share the right procedure to enable SSL on client?
>
> I’ve created ~/.posgresql directory and added the client.crt and
> server.key.
>
>
>
> Regards
>
> Jayashree
>


Sorry for one typo error

*hostssl  myuser        mydb          192.168.0.112/32
<http://192.168.0.112/32;        cert clientcert=1*

Thanks & Regards,
Harshad Adalkonda
Database Administrator
harshad.adalkonda@shreeyansh.com

www.shreeyansh.com

^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2014-12-05 11:18 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-12-05 09:37 How to enable SSL on client Rajagopalan, Jayashree <Jayashree.Rajagopalan@emc.com>
2014-12-05 10:22 ` reiner peterke <zedaardv@drizzle.com>
2014-12-05 11:09 ` Harshad Adalkonda <adalkondaharshad@gmail.com>
2014-12-05 11:18 ` Harshad Adalkonda <adalkondaharshad@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox