2

Unable to connect to a postgreSQL database on a LAN. (No problems connecting to the db on the server locally)

Error shown in pgAdmin.app:

Unable to connect to server: connection to server at "xxx.local" ([ipv6]), port 5432 failed: could not imitiate GSSAPI security context: Miscellaneous failure (see text): Matching credential (krbtgt/LOCAL@LKDC:SHA1.[long hex number] not found (negative cache) connection to server at "[server name]" ([ipv6]), port 5432 failed:

Error shown in log: /usr/local/var/log/[email protected]

FATAL: no pg_hba.conf entry for host "[ipv6]", user "[user]", database "postgres", no encryption

So the pg server sees the attempted connecting and records it, but rejects.

Here's the pg_hba.conf (Confirmed active -- changes do affect the service, but so far unable to connect over LAN

# TYPE  DATABASE        USER            ADDRESS                 METHOD
local   all             all                                     trust #Also tried md5 & peer
# IPv4 local connections:
host    all             all             127.0.0.1/32            trust #Also tried md5 & peer
# IPv6 local connections:
host    all             all             ::1/128                 trust #Also tried md5 & peer
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     all                                     trust #Also tried md5 & peer
host    replication     all             127.0.0.1/32            trust #Also tried md5 & peer
host    replication     all             ::1/128                 trust #Also tried md5 & peer

NOTE: All changes implemented are followed by brew services restart postgresql@14 And confirmed implemented by monitoring /usr/local/var/log/[email protected]

in postgresql.conf:

listen_addresses = '*'

Server MacOS Monterey 12.5 psql (PostgreSQL) 14.6 (Homebrew)

Client MacOS Ventura 13.0.1

8
  • 1
    Your pg_hba.conf doesn't appear to allow any remote connections, so I'm not sure what else you expect.
    – mustaccio
    Dec 1, 2022 at 23:07
  • Ok. My (admittedly limited) understanding was the the lines showing "host" achieved that. What am I missing? Dec 1, 2022 at 23:20
  • 1
    Your hba only allows "loopback" connections (that is, they might be TCP but are still within the same machine).
    – jjanes
    Dec 1, 2022 at 23:43
  • 2
    Documentation covers this topic quite extensively; is there anything that remains unclear?
    – mustaccio
    Dec 1, 2022 at 23:54
  • 1
    Please post your comment to an answer then accept the answer after a few days. That way it will be easier for others to find your solution.
    – dwhitemv
    Dec 3, 2022 at 5:06

1 Answer 1

1

Solution here was to drill down on the Address column of pg_hba.conf and understand how the entries there allow/block traffic.

Thanks to @a_horse_with_no_name for helping clarify & @mustaccio for the postgres page on this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.