Configure PostgreSQL to allow Remote connections

  • 7920889
  • 26-Mar-2007
  • 01-Aug-2017

Environment

PlateSpin Recon 3.0 and higher

Situation

 

This article provides information on how to configure PostGreSQL to allow remote connections (i.e. when the Recon Server is installed on a remote server).

 

By default, PostGreSQL does not allow remote connections and the following error could occur:

“No connection could be made because the target machine actively refused it”

Resolution

To allow the Recon Server to connect to the PostGreSQL Server remotely, the following steps are required:

  1. First edit the postgresql.conf file Click on Start -> Programs -> PostgreSQL 8.2 -> Configuration -> Edit postgresql.conf
    (Users can also find this file under the \Program Files\PostgreSQL 8.2\data directory).
  2. Scroll down to "Connections and Authentication"
  3. Uncomment the listen_addresses parameter by removing the #
  4. Replace the 'localhost' with the IP address of the PowerRecon Server (please note that the IP address must be encapsulated in single quotes as well) or specify '*' to allow the PostgreSQL Server to listen on all IP addresses.
  5. Edit the pg_hba.conf file (same path as in step 1).  Add the IP address of the Recon Server under the IPv4 Local Connections section.  Follow the same pattern as the host with 127.0.0.1/32, use spaces to separate entries on the columns, with the same number of spaces matching each underlying row.  Enter the IP address as x.x.x.x/32. 

    For instance, using a remote Recon Server with an IP address of 10.1.2.28 as an example, the IPv4 section should appear as follows once the changes to the pg_hba.conf have been completed:

    # IPv4 local connections:
    host    all         all         127.0.0.1/32          md5
    host    all         all         10.1.2.28/32          md5

  6. Restart the PostgreSQL service