How to Configure Postgres to Allow Remote Connections

  • 7023549
  • 29-Nov-2018
  • 30-Nov-2018


GWAVA (Secure Messaging Gateway) 7


If the Secure Messaging Gateway server is being deployed into an existing GWAVA or Secure Messaging Gateway network, there are a few settings which need to be configured. The Secure Messaging Gateway Network shares the databases to keep the configuration, quarantine, and statistics up to date and common across the whole system. A Secure Messaging Gateway Network is utilized when multiple servers are required to handle the load or must be separated due to the host network and design where multiple Secure Messaging Gateway appliances at multiple locations are required.


In order for the databases to be accessible to all Secure Messaging Gateway servers, Postgres must be configured to allow remote connections.

  1. Configure Postgres to allow remote connections.

    To configure Postgres to allow remote connections a file must be modified.

    NOTE:The file must be modified as root user.

    The file which must be modified is: (replace the 9.x directory with the running version of Postgres. Likely 9.5)


    As the root user, open the pg_hba.conf file with the preferred editor and locate the line: # IPv4 local connections:

    host all all md5

    This line only specifies connections from the localhost. Add new connection addresses to this line to allow for multiple and remote connections.

    Modify the line to make it look similar to this:

    # IPv4 local connections:
    host all all md5
    host all all md5
  2. Determine and set allowed connection addresses.

    Modifying the pg_hba_conf file correctly requires that the IP addresses of the remaining Secure Messaging Gateway servers are known. The addresses may be specified individually or they may be specified in a range.

    For example, the above specified address setting of “” will allow connections from any address of 10.1.29.x.

    If a subnet of addresses is desired, it may also be specified as such: Will allow any connection from addresses 10.x.x.x Will allow any connection from addresses 172.16.x.x Will allow any connection from addresses 192.168.1.x

    Or if a specific IP is to be specified:

    Once the file has been modified to allow connections from the desired addresses, save the file.

  3. Restart Postgres.

    Postgres must be restarted to load the new configuration. Once Postgres has been restarted, the rest of the Secure Messaging Gateway servers may be deployed and initialized.

    /etc/init.d/postgresql restart

    With Postgres now configured to allow multiple connections, the initialization of the rest of the Secure Messaging Gateway servers may be completed. Make sure that the address for the newly configured Postgres server is used for configuring the remaining servers