Select Your Language

Infrastructure and Management

Cloud Computing

Storage

Runtimes

Integration and Automation

Securing PostgreSQL client with SSL/TLS on RHEL6

Updated on

Request a new translation or translation update

A translation for your language preference does not exist. Click below to request a translation for your selected language.

Submit request

Securing postgresql (postgresql-8.4.20-8.el6_9) that uses openssl

This article is part of the Securing Applications Collection

There are a number of ways to specify the requirement for a secured connection at the client end.

The first involves providing a connection string using connection parameters.

    psql "host=rhel6-64.example.com dbname=postgres user=postgres sslmode=verify-full sslrootcert=$HOME/rhel6-64.example.com.ca.pem"

The alternate method is to utilise the service name mechanism by placing details in the service file.

    $HOME/.pg_service.conf

in .INI format with a logical name for the service

[mypg6]
host=rhel6-64.example.com
dbname=postgres
user=postgres
sslmode=verify-full
sslrootcert=/home/myhome/rhel6-64.example.com.ca.pem

and then connection with the service name parameter

    $ psql "service=mypg6"
    Password:
    psql (8.4.20)
    SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
    Type "help" for help.

    postgres=#

Authority Certificate File

The authority file is specified directly via the sslrootcert parameter, or placed at in

    $HOME/.postgresql/root.crt

Should contain the root certificate that signed the server's certificate.

This solution is part of Red Hat's fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Red Hat LinkedIn YouTube Facebook X, formerly Twitter

Quick Links

Help

Site Info

Related Sites

© 2026 Red Hat