OSX: Postgresql port 5432 is closed. How to open?
Correct answer (by Daniel Vérité): About the line in pg_hba.conf
: snort-sensor-host-ip
must not be copied verbatim, it's meant to be replaced by the IP address from which the snort connection will come. If snort and postgres are on the same machine, you may use 127.0.0.1
and also configure snort to connect to postgres through 127.0.0.1
.
Related videos on Youtube
Drew
Updated on September 18, 2022Comments
-
Drew over 1 year
Mac OS X Yosemite (10.10.2)
Postgresql 9.4.1 (installed with Homebrew)
Snort 2.9.7.0 (installed with Homebrew)
I can't connect to psql - port 5432 seem to be closed:
$ psql postgres psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"? $nmap -p 5432 localhost Starting Nmap 6.47 ( http://nmap.org ) at 2015-03-03 15:51 PST Nmap scan report for localhost (127.0.0.1) Host is up (0.00013s latency). PORT STATE SERVICE 5432/tcp closed postgresql Nmap done: 1 IP address (1 host up) scanned in 0.02 seconds
I've tried restart postgresql with lunchy, but it didn't help:
$ lunchy stop postgres $ lunchy start postgres
The service.log shows:
LOG: specifying both host name and CIDR mask is invalid: "snort-sensor-host-ip/32" CONTEXT: line 95 of configuration file "/usr/local/var/postgres/pg_hba.conf" FATAL: could not load pg_hba.conf
So obviously it doesn't like this line in pg_hba.conf:
host snort snort snort-sensor-host-ip/32 password
But WHY?
I added it in accordance with this tutorial:https://discussions.apple.com/thread/3370709?start=0&tstart=0
When I comment this line - it works, but my Snort doesn't: OSX: Snort: ERROR: /etc/snort/../rules/local.rules(0) Unable to open rules file "/etc/snort/../rules/local.rules": No such file or directory
-
Daniel Vérité about 9 yearsNow look at the postgres logs to see why it failed to start
-
Daniel Vérité about 9 yearshomebrew tends to use
/usr/local/var/postgres/server.log
, otherwise see Where postgresql logs are on mac os x? -
Daniel Vérité about 9 yearsAbout the line in
pg_hba.conf
:snort-sensor-host-ip
must not be copied verbatim, it's meant to be replaced by the IP address from which the snort connection will come. If snort and postgres are on the same machine, you may use127.0.0.1
and also configure snort to connect to postgres through127.0.0.1
.
-