Re: Libpq functions & string to obtain connection parameters

Поиск
Список
Период
Сортировка
От arnaud gaboury
Тема Re: Libpq functions & string to obtain connection parameters
Дата
Msg-id CAK1hC9uLhsyn4g8Fc1FwhnDQzNx9k115GkK9iFKHepfjeMc+eg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Libpq functions & string to obtain connection parameters  (Adrian Klaver <adrian.klaver@aklaver.com>)
Ответы Re: Libpq functions & string to obtain connection parameters  (Adrian Klaver <adrian.klaver@aklaver.com>)
Re: Libpq functions & string to obtain connection parameters  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general


On Fri, Oct 7, 2016 at 4:42 PM Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 10/07/2016 07:28 AM, arnaud gaboury wrote:
>
>
> On Fri, Oct 7, 2016 at 3:56 PM Adrian Klaver <adrian.klaver@aklaver.com
> <mailto:adrian.klaver@aklaver.com>> wrote:
>
>     On 10/07/2016 06:42 AM, arnaud gaboury wrote:
>     >
>     >
>
>     >
>     > Honestly not so much, as it is a nearly perfect Copy/past of
>     postgresql
>     > official doc[0].
>     > My postgresql socket is in the usual place:
>     >  /run/postgresql/.s.PGSQL.5432=
>     > So no need to specify it. But for the rest, I am still not sure of
>     my URI
>     >
>     > [0]https://www.postgresql.org/docs/9.5/static/libpq-connect.html
>     >
>     >
>
>     Aah, just remembered you wanted username and password, so:
>
>     psql postgresql://aklaver:pwd@/test?connect_timeout=10
>
>
> It helps, but I must have something else misconfigured then:
>
> -------------------------------------
>  # su postgres
> postgres@thetradinghall ➤➤ mattermost/bin % bash
> bash-4.3$ psql postgresql:///mattermost?connect_timeout=10
> psql (9.5.4)
> Type "help" for help.
>
> mattermost=# \q
> =====> OK
> -----------------------------------------
> Now with the Unix user I want to use:
>
> --------------------------------------------------------
> % su mattermost
> bash-4.3$ psql postgresql:///mattermost?connect_timeout=10
> psql: FATAL:  no pg_hba.conf entry for host "[local]", user
> "mattermost", database "mattermost", SSL off
> --------------------------------------------
>
> As a reminder, I made an entry in pg_ident.conf this way:
>  mattermap      mattermost              mmuser
>
> and add this line in pg_hba.conf
> local   mattermost          mmuser                      peer
> map=mattermap
>
> What is wromg in my  UNIX/postgresql user mapping?
>

Did you reload the server after making the changes?:


GGGrrrhhhhh

-------------------------------
# systemctl restart postgresql
 # su mattermost
bash-4.3$ psql postgresql://mmuser:XXXYYYY@/mattermost?
psql (9.5.4)
Type "help" for help.

mattermost=> \q
-----------------------------------------

OK. Now I know unix user mattermost can connect to mattermost Db via unix socket. BUT when trying to write this in my URI:

postgresql://mmuser:MyPwd@/mattermost?connect_timeout=10

I get this from my app :
Failed to ping db err:pq: SSL is not enabled on the server

Is it normal to still have this error ? Adding  sslmode param will not change anything as it is ignored for Unix domain socket communication.



https://www.postgresql.org/docs/9.6/static/auth-pg-hba-conf.html

The pg_hba.conf file is read on start-up and when the main server
process receives a SIGHUP signal. If you edit the file on an active
system, you will need to signal the postmaster (using pg_ctl reload or
kill -HUP) to make it re-read the file.

https://www.postgresql.org/docs/9.6/static/auth-username-maps.html

The pg_ident.conf file is read on start-up and when the main server
process receives a SIGHUP signal. If you edit the file on an active
system, you will need to signal the postmaster (using pg_ctl reload or
kill -HUP) to make it re-read the file.



--
Adrian Klaver
adrian.klaver@aklaver.com

В списке pgsql-general по дате отправления:

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Libpq functions & string to obtain connection parameters
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Libpq functions & string to obtain connection parameters