Select Your Language

Infrastructure and Management

Cloud Computing

Storage

Runtimes

Integration and Automation

Securing PostgreSQL client with SSL/TLS on RHEL5

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.1.23-10.el5_!0) 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 environment variables to specify a secure connection.

    PGSSLMODE=require psql -h rhel5-32.example.com -U postgres postgres

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

    /etc/sysconfig/pgsql/pg_service.conf

in .INI format with a logical name for the service

[mypg5]
host=rhel5-32.example.com
dbname=postgres
user=postgres
sslmode=require

and then connection with the service name parameter

    $ PGSERVICE=mypg5 psql
    Password:
    Welcome to psql 8.1.23, the PostgreSQL interactive terminal.

    Type:  \copyright for distribution terms
           \h for help with SQL commands
           \? for help with psql commands
           \g or terminate with semicolon to execute query
           \q to quit

    SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)

    postgres=#

Authority Certificate File

The authority file is specified 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