Re: \conninfo and SSL

Lists: pgsql-hackers
From: Bruce Momjian <bruce(at)momjian(dot)us>
To: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: \conninfo and SSL
Date: 2012-05-31 19:04:58
Message-ID: 20120531190458.GZ24440@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On startup, psql shows the SSL information:

$ psql 'sslmode=require host=localhost'
psql (9.2beta1)
SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)

However, \conninfo does not mention SSL:

postgres=> \conninfo
You are connected to database "postgres" as user "postgres" on
host "localhost" at port "5432".

Should \conninfo mention SSL? Fortunately \c shows SSL information:

postgres=> \c
SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
You are now connected to database "postgres" as user "postgres".

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +


From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: \conninfo and SSL
Date: 2012-05-31 19:11:04
Message-ID: CABUevEwDbXT=gr6O74ghsZ6_UyWV87SpyGsF3iofdtQosqrazA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, May 31, 2012 at 9:04 PM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> On startup, psql shows the SSL information:
>
>        $ psql 'sslmode=require host=localhost'
>        psql (9.2beta1)
>        SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
>
> However, \conninfo does not mention SSL:
>
>        postgres=> \conninfo
>        You are connected to database "postgres" as user "postgres" on
>        host "localhost" at port "5432".
>
> Should \conninfo mention SSL?  Fortunately \c shows SSL information:
>
>        postgres=> \c
>        SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
>        You are now connected to database "postgres" as user "postgres".

Well, \c creates a new connection, so that's not really an information
command. It might not connect that trivially, depending on what
authentication method you use.

Including ssl info in \conninfo would be useful, I think.

//Magnus


From: Alastair Turner <bell(at)ctrlf5(dot)co(dot)za>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: \conninfo and SSL
Date: 2012-06-03 09:30:31
Message-ID: CAFgq2fWYH_QpE+Qgg9Xx+zzNXZx2Gx+x+sv76jVEgzPuVfao4w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, May 31, 2012 at 9:11 PM, Magnus Hagander <magnus(at)hagander(dot)net> wrote:
> On Thu, May 31, 2012 at 9:04 PM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
>> On startup, psql shows the SSL information:
>>
>>        $ psql 'sslmode=require host=localhost'
>>        psql (9.2beta1)
>>        SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
>>
>> However, \conninfo does not mention SSL:
>>
>>        postgres=> \conninfo
>>        You are connected to database "postgres" as user "postgres" on
>>        host "localhost" at port "5432".
>>
>> Should \conninfo mention SSL?  Fortunately \c shows SSL information:
>>
>>        postgres=> \c
>>        SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
>>        You are now connected to database "postgres" as user "postgres".
>
> Well, \c creates a new connection, so that's not really an information
> command. It might not connect that trivially, depending on what
> authentication method you use.
>
> Including ssl info in \conninfo would be useful, I think.
>
> //Magnus
>

A one-line change adds the SSL info on its own line like

------
You are connected to database "scratch" as user "scratch" on host
"127.0.0.1" at port "5432".
SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
------

Does this need a more integrated presentation, and therefore a broader
change to make it translatable?

Regards,
Alastair.

*** a/src/bin/psql/command.c
--- b/src/bin/psql/command.c
*************** exec_command(const char *cmd,
*** 312,319 ****
--- 312,322 ----
printf(_("You are connected to
database \"%s\" as user \"%s\" via socket in \"%s\" at port
\"%s\".\n"),
db, PQuser(pset.db), host,
PQport(pset.db));
else
+ {
printf(_("You are connected to
database \"%s\" as user \"%s\" on host \"%s\" at port \"%s\".\n"),
db, PQuser(pset.db), host,
PQport(pset.db));
+ printSSLInfo();
+ }
}
}


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Alastair Turner <bell(at)ctrlf5(dot)co(dot)za>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, Bruce Momjian <bruce(at)momjian(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: \conninfo and SSL
Date: 2012-06-06 18:45:46
Message-ID: CA+TgmobrKYyFwAK_W17W=ss087tB42ct5ViQG1Fm-HPfQ4S2Lw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Sun, Jun 3, 2012 at 5:30 AM, Alastair Turner <bell(at)ctrlf5(dot)co(dot)za> wrote:
> A one-line change adds the SSL info on its own line like
>
> ------
> You are connected to database "scratch" as user "scratch" on host
> "127.0.0.1" at port "5432".
> SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
> ------
>
> Does this need a more integrated presentation, and therefore a broader
> change to make it translatable?

+1 for doing it that way.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Alastair Turner <bell(at)ctrlf5(dot)co(dot)za>, Magnus Hagander <magnus(at)hagander(dot)net>, Bruce Momjian <bruce(at)momjian(dot)us>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: \conninfo and SSL
Date: 2012-06-06 19:55:10
Message-ID: 1339012032-sup-3924@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


Excerpts from Robert Haas's message of mié jun 06 14:45:46 -0400 2012:
> On Sun, Jun 3, 2012 at 5:30 AM, Alastair Turner <bell(at)ctrlf5(dot)co(dot)za> wrote:
> > A one-line change adds the SSL info on its own line like
> >
> > ------
> > You are connected to database "scratch" as user "scratch" on host
> > "127.0.0.1" at port "5432".
> > SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
> > ------
> >
> > Does this need a more integrated presentation, and therefore a broader
> > change to make it translatable?
>
> +1 for doing it that way.

Yeah, printSSLInfo already outputs translated stuff so this should be
OK. Merging both messages into a single translatable unit would be
pretty cumbersome, for no practical gain.

--
Álvaro Herrera <alvherre(at)commandprompt(dot)com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Alastair Turner <bell(at)ctrlf5(dot)co(dot)za>, Bruce Momjian <bruce(at)momjian(dot)us>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: \conninfo and SSL
Date: 2012-06-07 09:23:15
Message-ID: CABUevEyqjBUbSH1Khou_jYd1nTUUHT1mx-6q35i1tBnMKVQwfQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wednesday, June 6, 2012, Alvaro Herrera wrote:

>
> Excerpts from Robert Haas's message of mié jun 06 14:45:46 -0400 2012:
> > On Sun, Jun 3, 2012 at 5:30 AM, Alastair Turner <bell(at)ctrlf5(dot)co(dot)za<javascript:;>>
> wrote:
> > > A one-line change adds the SSL info on its own line like
> > >
> > > ------
> > > You are connected to database "scratch" as user "scratch" on host
> > > "127.0.0.1" at port "5432".
> > > SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
> > > ------
> > >
> > > Does this need a more integrated presentation, and therefore a broader
> > > change to make it translatable?
> >
> > +1 for doing it that way.
>
> Yeah, printSSLInfo already outputs translated stuff so this should be
> OK. Merging both messages into a single translatable unit would be
> pretty cumbersome, for no practical gain.
>
>
Seems like a very low-impact change. Are people Ok with sneaking this into
9.2?

//Magnus

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Alastair Turner <bell(at)ctrlf5(dot)co(dot)za>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, Bruce Momjian <bruce(at)momjian(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: \conninfo and SSL
Date: 2012-06-14 13:46:41
Message-ID: CA+TgmobXBSDkf2a4_XMNVso=o5afQo1yxFKGsWTcABmfSKqn=g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Sun, Jun 3, 2012 at 5:30 AM, Alastair Turner <bell(at)ctrlf5(dot)co(dot)za> wrote:
> A one-line change adds the SSL info on its own line like
>
> ------
> You are connected to database "scratch" as user "scratch" on host
> "127.0.0.1" at port "5432".
> SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
> ------
>
> Does this need a more integrated presentation, and therefore a broader
> change to make it translatable?

Committed to master. I didn't make it conditional on a non-local
connection, though, since there seemed to be no reason to it that way.

P.S. Email mangles patches. It's better to attach them rather than
including them inline.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company