Обсуждение: pg_hba.conf : bad entry for ADDRESS

Поиск
Список
Период
Сортировка

pg_hba.conf : bad entry for ADDRESS

От
arnaud gaboury
Дата:
I am deploying mattermost on my machine following their documentation[0].

My machine network settings:
----------------------------------
$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: host0@if4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue
state UP group default qlen 1000
    link/ether 0e:7f:c3:fb:25:b1 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 192.168.1.94/24 brd 192.168.1.255 scope global host0
       valid_lft forever preferred_lft forever
    inet6 fe80::c7f:c3ff:fefb:25b1/64 scope link
       valid_lft forever preferred_lft forever
--------------------------------------------------------------------

There is a public IP with a domain name (http works OK).

I entered this line in pg_hab.conf:
------------------------------
 host     mattermost         mmuser      127.0.0.1       md5
--------------------------------------------------------

Now when testing:
--------------------------------------
% psql --host=127.0.0.1 --dbname=mattermost --username=mmuser --password
Password for user mmuser:
psql: FATAL:  no pg_hba.conf entry for host "127.0.0.1", user
"mmuser", database "mattermost", SSL off
------------------------------------

What am I doing wrong?

Thank you for help








[0]https://docs.mattermost.com/install/prod-rhel-7.html
--

google.com/+arnaudgabourygabx


Re: pg_hba.conf : bad entry for ADDRESS

От
"Ilya Kazakevich"
Дата:
>I entered this line in pg_hab.conf:
Are you sure your file name is correct and it is really used by postgres?


Ilya Kazakevich

JetBrains
http://www.jetbrains.com
The Drive to Develop



Re: pg_hba.conf : bad entry for ADDRESS

От
arnaud gaboury
Дата:
On Thu, Aug 25, 2016 at 4:26 PM, Ilya Kazakevich
<Ilya.Kazakevich@jetbrains.com> wrote:
>>I entered this line in pg_hab.conf:
> Are you sure your file name is correct and it is really used by postgres?

I think so as another service (Postfix) is running and working.

How can I verify ?
>
>
> Ilya Kazakevich
>
> JetBrains
> http://www.jetbrains.com
> The Drive to Develop
>



--

google.com/+arnaudgabourygabx


Re: pg_hba.conf : bad entry for ADDRESS

От
Melvin Davidson
Дата:


On Thu, Aug 25, 2016 at 10:18 AM, arnaud gaboury <arnaud.gaboury@gmail.com> wrote:
I am deploying mattermost on my machine following their documentation[0].

My machine network settings:
----------------------------------
$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: host0@if4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue
state UP group default qlen 1000
    link/ether 0e:7f:c3:fb:25:b1 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 192.168.1.94/24 brd 192.168.1.255 scope global host0
       valid_lft forever preferred_lft forever
    inet6 fe80::c7f:c3ff:fefb:25b1/64 scope link
       valid_lft forever preferred_lft forever
--------------------------------------------------------------------

There is a public IP with a domain name (http works OK).

I entered this line in pg_hab.conf:
------------------------------
 host     mattermost         mmuser      127.0.0.1       md5
--------------------------------------------------------

Now when testing:
--------------------------------------
% psql --host=127.0.0.1 --dbname=mattermost --username=mmuser --password
Password for user mmuser:
psql: FATAL:  no pg_hba.conf entry for host "127.0.0.1", user
"mmuser", database "mattermost", SSL off
------------------------------------

What am I doing wrong?

Thank you for help








[0]https://docs.mattermost.com/install/prod-rhel-7.html
--

google.com/+arnaudgabourygabx


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


You need to change your entry from this
 host     mattermost         mmuser      127.0.0.1       md5

to this
 host     mattermost         mmuser      127.0.0.1/32       md5
or this
 host     mattermost         mmuser      127.0.0.1/24       md5
--
Melvin Davidson
I reserve the right to fantasize.  Whether or not you
wish to share my fantasy is entirely up to you.

Re: pg_hba.conf : bad entry for ADDRESS

От
Francisco Olarte
Дата:
Hi Arnaud:
On Thu, Aug 25, 2016 at 4:18 PM, arnaud gaboury
<arnaud.gaboury@gmail.com> wrote:
> There is a public IP with a domain name (http works OK).
Nice to know, but does not matter if all you use is 127.0.0.1


> I entered this line in pg_hab.conf:

Have you checked the filename? you are saying HAB, but it is HBA (
Host Based Auth ) . May be a typo, but better safe then sorry. And
have you checked it is stored in the right place?


> ------------------------------
>  host     mattermost         mmuser      127.0.0.1       md5
> --------------------------------------------------------

Are this all the contents of you pg_hba.conf? Note order matters, all
non comment ( or at least the host ones ) need to be checked .


Also, did you signal the postmaster to reread after adding the line?

Francisco Olarte.


Re: pg_hba.conf : bad entry for ADDRESS

От
arnaud gaboury
Дата:


On Thu, Aug 25, 2016 at 4:27 PM, Melvin Davidson <melvin6925@gmail.com> wrote:


On Thu, Aug 25, 2016 at 10:18 AM, arnaud gaboury <arnaud.gaboury@gmail.com> wrote:
I am deploying mattermost on my machine following their documentation[0].

My machine network settings:
----------------------------------
$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: host0@if4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue
state UP group default qlen 1000
    link/ether 0e:7f:c3:fb:25:b1 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 192.168.1.94/24 brd 192.168.1.255 scope global host0
       valid_lft forever preferred_lft forever
    inet6 fe80::c7f:c3ff:fefb:25b1/64 scope link
       valid_lft forever preferred_lft forever
--------------------------------------------------------------------

There is a public IP with a domain name (http works OK).

I entered this line in pg_hab.conf:
------------------------------
 host     mattermost         mmuser      127.0.0.1       md5
--------------------------------------------------------

Now when testing:
--------------------------------------
% psql --host=127.0.0.1 --dbname=mattermost --username=mmuser --password
Password for user mmuser:
psql: FATAL:  no pg_hba.conf entry for host "127.0.0.1", user
"mmuser", database "mattermost", SSL off
------------------------------------

What am I doing wrong?

Thank you for help


[0]https://docs.mattermost.com/install/prod-rhel-7.html
--




You need to change your entry from this
 host     mattermost         mmuser      127.0.0.1       md5

to this
 host     mattermost         mmuser      127.0.0.1/32       md5
or this
 host     mattermost         mmuser      127.0.0.1/24       md5

The returned message is fifferent but it doesn't work too. Se  below

% psql --host=127.0.0.1/32 --dbname=mattermost --username=mmuser                                                                                                     
psql: could not translate host name "127.0.0.1/32" to address: Name or service not known
% psql --host=127.0.0.1/24 --dbname=mattermost --username=mmuser                                                                   
psql: could not translate host name "127.0.0.1/24" to address: Name or service not known




--
Melvin Davidson
I reserve the right to fantasize.  Whether or not you
wish to share my fantasy is entirely up to you.




--

Re: pg_hba.conf : bad entry for ADDRESS

От
Tom Lane
Дата:
arnaud gaboury <arnaud.gaboury@gmail.com> writes:
> I entered this line in pg_hab.conf:
> ------------------------------
>  host     mattermost         mmuser      127.0.0.1       md5

> What am I doing wrong?

Looking in the postmaster log for complaints about pg_hba.conf
would probably have helped you diagnose this.  But I think the
problem is that you're required to specify a netmask or masklen;
so "127.0.0.1/32" not just "127.0.0.1".

            regards, tom lane


Re: pg_hba.conf : bad entry for ADDRESS

От
"Ilya Kazakevich"
Дата:
>How can I verify ?
Can you connect as postgres (superuser)?
If yes, connect and type "show hba_file;"
If no, try adding "local all postgres peer" or even "local all postgres trust" to this file and restart postgres. Check
again.




Re: pg_hba.conf : bad entry for ADDRESS

От
Melvin Davidson
Дата:


On Thu, Aug 25, 2016 at 10:28 AM, arnaud gaboury <arnaud.gaboury@gmail.com> wrote:
On Thu, Aug 25, 2016 at 4:26 PM, Ilya Kazakevich
<Ilya.Kazakevich@jetbrains.com> wrote:
>>I entered this line in pg_hab.conf:
> Are you sure your file name is correct and it is really used by postgres?

I think so as another service (Postfix) is running and working.

How can I verify ?
>
>
> Ilya Kazakevich
>
> JetBrains
> http://www.jetbrains.com
> The Drive to Develop
>



--

google.com/+arnaudgabourygabx


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

per my previous reply, please review the information for correct address entry at
https://www.postgresql.org/docs/9.4/static/auth-pg-hba-conf.html

Also, please note that although it does not apply in this case, it is always helpful to provide O/S and PostgreSQL version when addressing this mail list.

--
Melvin Davidson
I reserve the right to fantasize.  Whether or not you
wish to share my fantasy is entirely up to you.

Re: pg_hba.conf : bad entry for ADDRESS

От
arnaud gaboury
Дата:
On Thu, Aug 25, 2016 at 4:29 PM, Francisco Olarte
<folarte@peoplecall.com> wrote:
> Hi Arnaud:
> On Thu, Aug 25, 2016 at 4:18 PM, arnaud gaboury
> <arnaud.gaboury@gmail.com> wrote:
>> There is a public IP with a domain name (http works OK).
> Nice to know, but does not matter if all you use is 127.0.0.1
>
>
>> I entered this line in pg_hab.conf:
>
> Have you checked the filename? you are saying HAB, but it is HBA (
> Host Based Auth ) . May be a typo,

Yes it is.

but better safe then sorry. And
> have you checked it is stored in the right place?
>
>
>> ------------------------------
>>  host     mattermost         mmuser      127.0.0.1       md5
>> --------------------------------------------------------
>
> Are this all the contents of you pg_hba.conf? Note order matters, all
> non comment ( or at least the host ones ) need to be checked .

Here is the whole content:
---------------------------------------------
     75
     76 # TYPE  DATABASE            USER        ADDRESS        METHOD    OPTION
     77
     78 # "local" is for Unix domain socket connections only
     79 local   thetradinghall      mailman                     peer
    map=mailmap
     80 local   all                 postgres                    trust
     81 #-------------------------------------------------------------------#
     82
     83 # IPv4 local connections:
     84 host     mattermost         mmuser      127.0.0.1/24    md5
     85 # IPv6 local connections:
     86
     87
     88 #--------------------------------------------------------------------#
     89

>
>
> Also, did you signal the postmaster to reread after adding the line?

What do you mean?
>
> Francisco Olarte.



--

google.com/+arnaudgabourygabx


Re: pg_hba.conf : bad entry for ADDRESS

От
arnaud gaboury
Дата:
On Thu, Aug 25, 2016 at 4:32 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> arnaud gaboury <arnaud.gaboury@gmail.com> writes:
>> I entered this line in pg_hab.conf:
>> ------------------------------
>>  host     mattermost         mmuser      127.0.0.1       md5
>
>> What am I doing wrong?
>
> Looking in the postmaster log for complaints about pg_hba.conf
> would probably have helped you diagnose this.  But I think the
> problem is that you're required to specify a netmask or masklen;
> so "127.0.0.1/32" not just "127.0.0.1".

See previous answers, it doesn't work either
>
>                         regards, tom lane



--

google.com/+arnaudgabourygabx


Re: pg_hba.conf : bad entry for ADDRESS

От
"Ilya Kazakevich"
Дата:


% psql --host=127.0.0.1/32 --dbname=mattermost --username=mmuser                                                                                                     
psql: could not translate host name "127.0.0.1/32" to address: Name or service not known
% psql --host=127.0.0.1/24 --dbname=mattermost --username=mmuser                                                                   
psql: could not translate host name "127.0.0.1/24" to address: Name or service not known


[I.K >> ] “127.0.0.1/32” is network that includes only “127.0.0.1” while “127.0.0.1” is address.

You specify network in .conf file and use address as argument to psql

Re: pg_hba.conf : bad entry for ADDRESS

От
"Joshua D. Drake"
Дата:
On 08/25/2016 07:18 AM, arnaud gaboury wrote:
> I am deploying mattermost on my machine following their documentation[0].

> There is a public IP with a domain name (http works OK).
>
> I entered this line in pg_hab.conf:

I assume you mean pg_hba.conf

> ------------------------------
>  host     mattermost         mmuser      127.0.0.1       md5
> --------------------------------------------------------
>

Make sure that is the *only* line referencing 127.0.0.1.


> Now when testing:
> --------------------------------------
> % psql --host=127.0.0.1 --dbname=mattermost --username=mmuser --password
> Password for user mmuser:
> psql: FATAL:  no pg_hba.conf entry for host "127.0.0.1", user
> "mmuser", database "mattermost", SSL off
> ------------------------------------

Did you reload PostgreSQL? That is how you tell PostgreSQL to reread the
pg_hba.conf.

FTR: I have deployed Mattermost and it works wonderfully.

JD



--
Command Prompt, Inc.                  http://the.postgres.company/
                         +1-503-667-4564
PostgreSQL Centered full stack support, consulting and development.
Everyone appreciates your honesty, until you are honest with them.


Re: pg_hba.conf : bad entry for ADDRESS

От
arnaud gaboury
Дата:
On Thu, Aug 25, 2016 at 4:37 PM, Ilya Kazakevich
<Ilya.Kazakevich@jetbrains.com> wrote:
>
> % psql --host=127.0.0.1/32 --dbname=mattermost --username=mmuser
> psql: could not translate host name "127.0.0.1/32" to address: Name or
> service not known
> % psql --host=127.0.0.1/24 --dbname=mattermost --username=mmuser
> psql: could not translate host name "127.0.0.1/24" to address: Name or
> service not known
>
>
> [I.K >> ] “127.0.0.1/32” is network that includes only “127.0.0.1” while
> “127.0.0.1” is address.
>
> You specify network in .conf file and use address as argument to psql

Thanks a lot sir. My knowledge in TCP-IP is definitively too light.
------------------------------------------
% psql --host=127.0.0.1 --dbname=mattermost --username=mmuser
Password for user mmuser:
psql (9.5.3)
Type "help" for help.

mattermost=>

---------------------------------------------------

--

google.com/+arnaudgabourygabx


Re: pg_hba.conf : bad entry for ADDRESS

От
arnaud gaboury
Дата:
On Thu, Aug 25, 2016 at 4:38 PM, Joshua D. Drake <jd@commandprompt.com> wrote:
> On 08/25/2016 07:18 AM, arnaud gaboury wrote:
>>
>> I am deploying mattermost on my machine following their documentation[0].
>
>
>> There is a public IP with a domain name (http works OK).
>>
>> I entered this line in pg_hab.conf:
>
>
> I assume you mean pg_hba.conf
>
>> ------------------------------
>>  host     mattermost         mmuser      127.0.0.1       md5
>> --------------------------------------------------------
>>
>
> Make sure that is the *only* line referencing 127.0.0.1.
>
>
>> Now when testing:
>> --------------------------------------
>> % psql --host=127.0.0.1 --dbname=mattermost --username=mmuser --password
>> Password for user mmuser:
>> psql: FATAL:  no pg_hba.conf entry for host "127.0.0.1", user
>> "mmuser", database "mattermost", SSL off
>> ------------------------------------
>
>
> Did you reload PostgreSQL? That is how you tell PostgreSQL to reread the
> pg_hba.conf.
>
> FTR: I have deployed Mattermost and it works wonderfully.

The issue is solved (see my replies). By any chance, did you deploy on
Fedora? There is no official package and I must build my own .rpm.


>
> JD
>
>
>
> --
> Command Prompt, Inc.                  http://the.postgres.company/
>                         +1-503-667-4564
> PostgreSQL Centered full stack support, consulting and development.
> Everyone appreciates your honesty, until you are honest with them.



--

google.com/+arnaudgabourygabx


Re: pg_hba.conf : bad entry for ADDRESS

От
"Joshua D. Drake"
Дата:
On 08/25/2016 07:44 AM, arnaud gaboury wrote:
> On Thu, Aug 25, 2016 at 4:38 PM, Joshua D. Drake <jd@commandprompt.com> wrote:

>> Did you reload PostgreSQL? That is how you tell PostgreSQL to reread the
>> pg_hba.conf.
>>
>> FTR: I have deployed Mattermost and it works wonderfully.
>
> The issue is solved (see my replies). By any chance, did you deploy on
> Fedora? There is no official package and I must build my own .rpm.

No. I only run LTS releases.

Sincerely,

jD

>
>
>>
>> JD
>>
>>
>>
>> --
>> Command Prompt, Inc.                  http://the.postgres.company/
>>                         +1-503-667-4564
>> PostgreSQL Centered full stack support, consulting and development.
>> Everyone appreciates your honesty, until you are honest with them.
>
>
>


--
Command Prompt, Inc.                  http://the.postgres.company/
                         +1-503-667-4564
PostgreSQL Centered full stack support, consulting and development.
Everyone appreciates your honesty, until you are honest with them.
Unless otherwise stated, opinions are my own.


Re: pg_hba.conf : bad entry for ADDRESS

От
arnaud gaboury
Дата:
On Thu, Aug 25, 2016 at 5:26 PM, Joshua D. Drake <jd@commandprompt.com> wrote:
> On 08/25/2016 07:44 AM, arnaud gaboury wrote:
>>
>> On Thu, Aug 25, 2016 at 4:38 PM, Joshua D. Drake <jd@commandprompt.com>
>> wrote:
>
>
>>> Did you reload PostgreSQL? That is how you tell PostgreSQL to reread the
>>> pg_hba.conf.
>>>
>>> FTR: I have deployed Mattermost and it works wonderfully.
>>
>>
>> The issue is solved (see my replies). By any chance, did you deploy on
>> Fedora? There is no official package and I must build my own .rpm.
>
>
> No. I only run LTS releases.
>
On which platform please? If Fedora or Red Hat, which .rpm ?
Thank you

google.com/+arnaudgabourygabx


Re: pg_hba.conf : bad entry for ADDRESS

От
Francisco Olarte
Дата:
On Thu, Aug 25, 2016 at 4:28 PM, arnaud gaboury
<arnaud.gaboury@gmail.com> wrote:
> On Thu, Aug 25, 2016 at 4:26 PM, Ilya Kazakevich
> <Ilya.Kazakevich@jetbrains.com> wrote:
>>>I entered this line in pg_hab.conf:
>> Are you sure your file name is correct and it is really used by postgres?
> I think so as another service (Postfix) is running and working.

It has nothing to do with it, except if postfix is using postgres.

> How can I verify ?

If you used hab, it is wrong, if you used hba, consult the docs for
your version & os and check.

Francisco Olarte.


Re: pg_hba.conf : bad entry for ADDRESS

От
arnaud gaboury
Дата:
On Thu, Aug 25, 2016 at 5:43 PM, Francisco Olarte
<folarte@peoplecall.com> wrote:
> On Thu, Aug 25, 2016 at 4:28 PM, arnaud gaboury
> <arnaud.gaboury@gmail.com> wrote:
>> On Thu, Aug 25, 2016 at 4:26 PM, Ilya Kazakevich
>> <Ilya.Kazakevich@jetbrains.com> wrote:
>>>>I entered this line in pg_hab.conf:
>>> Are you sure your file name is correct and it is really used by postgres?
>> I think so as another service (Postfix) is running and working.
>
> It has nothing to do with it, except if postfix is using postgres.
YEs is has to do as postfix use postgress. So as postfix is working
well, I can suspect postgres is reading correctly pg_hba.conf.
>
>> How can I verify ?
>
> If you used hab, it is wrong,
I said it was a typo

if you used hba, consult the docs for
> your version & os and check.

Thank you for the tip.

Btw, if you have read the whole thread you would know my issue is solved
>
> Francisco Olarte.



--

google.com/+arnaudgabourygabx


Re: pg_hba.conf : bad entry for ADDRESS

От
Francisco Olarte
Дата:
Hi Arnaud:

On Thu, Aug 25, 2016 at 4:35 PM, arnaud gaboury
<arnaud.gaboury@gmail.com> wrote:
>> Are this all the contents of you pg_hba.conf? Note order matters, all
>> non comment ( or at least the host ones ) need to be checked .
> Here is the whole content:
>      79 local   thetradinghall      mailman                     peer
>     map=mailmap
>      80 local   all                 postgres                    trust
>      84 host     mattermost         mmuser      127.0.0.1/24    md5

.. This looks good once you've added the netmask, ehich slipped to me.

>> Also, did you signal the postmaster to reread after adding the line?
> What do you mean?

When you change the file you need to signal the postgres main process
( postmaster ) to reread it by sending it a HUP signal, or using
pg_ctl reload ( your OS/distro may have other methods ).

Francisco Olarte.


Re: pg_hba.conf : bad entry for ADDRESS

От
arnaud gaboury
Дата:
On Thu, Aug 25, 2016 at 5:50 PM, Francisco Olarte
<folarte@peoplecall.com> wrote:
> Hi Arnaud:
>
> On Thu, Aug 25, 2016 at 4:35 PM, arnaud gaboury
> <arnaud.gaboury@gmail.com> wrote:
>>> Are this all the contents of you pg_hba.conf? Note order matters, all
>>> non comment ( or at least the host ones ) need to be checked .
>> Here is the whole content:
>>      79 local   thetradinghall      mailman                     peer
>>     map=mailmap
>>      80 local   all                 postgres                    trust
>>      84 host     mattermost         mmuser      127.0.0.1/24    md5
>
> .. This looks good once you've added the netmask, ehich slipped to me.
>
>>> Also, did you signal the postmaster to reread after adding the line?
>> What do you mean?
>
> When you change the file you need to signal the postgres main process
> ( postmaster ) to reread it by sending it a HUP signal, or using
> pg_ctl reload ( your OS/distro may have other methods ).

In fact, I use systemctl to stop/start/reload postgres service. And
yes I did a reload.



>
> Francisco Olarte.



--

google.com/+arnaudgabourygabx