Allow incoming Postgresql connections to a Mac from a VM - postgresql

I'm running Postgresql 9.4 on my mac on MacOS Sierra (host) and Ubuntu 16.04 in Virtualbox (guest) and I can't seem to figure out how to allow the guest to access the host without completely disabling the firewall. I want to just allow incoming connections on port 5432 for postgres and I have added the postgres executable and psql executable to the firewall options list and without turning the firewall completely off (which I don't want to do because I'll forget to turn it back on) I can't access postgres.
Does anyone know how to add a rule to allow connections in this version of the MacOS?
As a side note, I've already configured the pg_hba.conf files and everything else to allow connections on my private network and everything works with the MacOS firewall off, I'd just prefer to have it on with the rules in place.

Related

Postgres RDS access working on Mac, not Win 10

I have 2 computers (Win 10 and Mac) and need to access a RDS Postgres database. Connection is secure via a bastion host and ecs instance. When I configure TablePlus like this:
It works perfectly on the Mac but not on Windows. I checked a bit and recommendation is to create a tunnel via Putty to forward the port 5432 to a local one and then try to access the db with a local IP. But no success.
I would like to know if there is a specific setting in TablePlus or something I'm missing that will allow me to access the database on my Windows computer? I tried also with pgAdmin and same results.

Remote access to postgresql server windows 10

As the title suggest I'm trying to configure a postgresql server to be accessible remotely. I've followed many guides and viewed some of the other answers here however I'm still having trouble.
The details:
os, windows 10
postgresql version on host is 11.6
postgresql version on remote is 11.2 with anaconda install
I have changed the pg_hba.conf and postgresql.conf to allow for connections to the server.
More specifically I've added the line
host all all xxx.xx.x.0/0 trust
I can verify that the host is listening on local address 0.0.0.0:5432 via netstat.
I can ping the ip of the host from the remote, and I have set windows firewalls on the host to allow connection.
Yet I still recieve the following error when trying to access psql from the remote.
psql: could not connect to server: Connection timed out (0x0000274C/10060)
Is the server running on host "xxx.xx.x.144" and accepting
TCP/IP connections on port 5432?```
I had to double check the windows firewall permissions. The connection was enabled but the application was not set to allowed. It turns out a local user can enable connection but I needed the system admin to set the application executable to allowed by the windows fire wall.

Access Postgres on Mac from Windows 10 on VMWare

I have postgres running on my Mac (OSX 10.13.1). Running Windows 10 in a virtual machine on VMWare Fusion (8.5.8). Requirement is to access a postgres database from an app running on the Windows VM, but I'm having trouble finding documentation and specific instructions about how to configure Postgres appropriately--appreciate any help.
The connection should be secure, and limited to local if possible--really don't want to expose a connection to the external internet.
I gather that there are some configuration settings that need to be made in postgresql.conf as well as in pg_hba.conf.
Tried adding listen_address = '*' to the postgresql.conf file, and added host all all xxx.xx.xxx.x/24 md5 (where x's indicate the IP address for the virtual machine) in the pg_hba.conf file.
On the setup screen for the postgres driver on Windows, I'm not sure how to set the driver up to find the database.
Also: I found an IP address for the VM on the Mac terminal, but does that change every time the machine restarts, or can it be set to a constant value? I.e. I don't want to have to reset the configuration every time the machine restarts.
Thanks in advance.

How to utilize GUI tool of pgadmin using vagrant

I have installed postgresql upon a vagrant ubuntu box and also companied control console with
sudo apt-get --assume-yes install pgadmin3
the tool is installed under /usr/bin
but I can not open pdadmin3 in the virtualbox due to the error
Error: Unable to initialize gtk, is DISPLAY set properly?
Could I possibly do this kind of thing in vagrant virtual box ? Or some work around
Run PgAdmin locally on your main desktop and connect to PostgreSQL on your Vagrant VM over TCP/IP.
The host can connect to guests if properly configured. You'll need to (a) ensure that Vagrant has suitable networking from host to guest, either using NAT and port forwards or using a virtual bridge; (b) ensure that PostgreSQL on the guest listens on all interfaces for TCP/IP connections using listen_addresses in postgresql.conf and (c) ensure that PostgreSQL on the guest is configured to allow connections from remote peers in pg_hba.conf.
Alternately, PgAdmin supports ssh tunnels. If you can ssh to the virtualbox you can configure PgAdmin to ssh to it too, then make a local PostgreSQL connection.
Personally I prefer to instead just use the psql command-line client for PostgreSQL directly on the VM. Way less hassle.

Easiest way to access Postgress Database from Windows Machine?

I have a Postgres database on a linux server. I have root access which in turn can give me access to the database. In Windows you get PGAdminIII, which I would love to use to connect to the Linux server. I heard that tunneling might be necessary. I am not sure if that is true, or what it is really. Can anyone shed some light on the easiest way to get access to the database?
Tunneling is not strictly necessary. As long as you have port 5432 not firewalled, you should be able to connect to your Linux PostgreSQL server without much trouble.
You can check this from your Windows box by using this command from cmd console:
telnet linuxbox 5432
If you get black screen (not an error), then everything looks good and port 5432 should be open. Note that on Windows 7 you may need to enable telnet client (it is disabled by default) using this command:
pkgmgr /iu:"TelnetClient"
If your server is not located in your local network, or if you are concerned about security like somebody using network sniffer to watch your traffic, you should configure SSL/TLS on your PostgreSQL server - it is not very difficult to do, and completely free when using self-signed certificate.
Note that by default Postgres on Linux does not listen on network interfaces, you may need to enable it by editing postgresql.conf.