---
title: "Security"
description: "Security controls of Managed PostgreSQL: TLS-only connections, the IP filter, roles and SCRAM passwords, backups and termination protection."
url: https://community.exoscale.com/product/dbaas/service-specific/postgresql/overview/security/
product: "PostgreSQL"
section: product
last_updated: 2026-11-10
---
> For AI agents: the documentation index is at https://community.exoscale.com/llms.txt. Every page is available as markdown at `<page URL>index.md` or with `Accept: text/markdown`.

# Security

This page collects the security controls of a Managed PostgreSQL service: what protects the connections, who can reach the service, what the admin user can do, and what Exoscale states about the infrastructure behind it.

## Connections Use TLS Only

The service accepts TLS connections only, on the `pg` port and on the `pgbouncer` port. A client
with TLS turned off (`sslmode=disable`) is refused with
`FATAL: no pg_hba.conf entry for host "...", user "...", database "...", no encryption`.

The server accepts TLS 1.2 and TLS 1.3, and refuses TLS 1.0 and 1.1 with a `protocol version`
alert. A current libpq negotiates TLS 1.3. Read what your session uses:

```sql
SELECT ssl, version, cipher FROM pg_stat_ssl WHERE pid = pg_backend_pid();
```

The connection URI returned by the CLI and the API uses `sslmode=require`: the traffic is
encrypted, but the client does not check the server certificate. For production, use
`verify-full` with the CA certificate of your organization, which you get with
`exo dbaas ca-certificate -z ZONE`. The SSL modes and the full procedure are in
[Connect with psql](https://community.exoscale.com/product/dbaas/service-specific/postgresql/how-to/connect-with-psql/index.md), and
the language pages linked below show `verify-full` for each driver.

To check the TLS handshake of a client network path without a PostgreSQL client:

```bash
openssl s_client -starttls postgres -connect HOST:PORT -tls1_2 -brief -CAfile ca.pem </dev/null
```

Parameters:

- `HOST`, `PORT`: hostname and port of the `pg` or `pgbouncer` component of the service, from
  `exo api get-dbaas-service-pg SERVICE_NAME -z ZONE -q 'components'`.
- `ca.pem`: the CA certificate from `exo dbaas ca-certificate`.

A successful handshake prints `CONNECTION ESTABLISHED` and `Protocol version: TLSv1.2`. The
`-starttls postgres` option needs OpenSSL 1.1.1 or later.

## The IP Filter Controls Who Can Connect

The service accepts connections only from the CIDR blocks in its IP filter. The filter applies to
the `pg` and `pgbouncer` ports. A client outside the filter gets no answer and times out, instead
of receiving an authentication error. An empty filter allows no client.

An update of the filter replaces the whole list. The procedures, and how to allow an SKS cluster,
are in
[Restrict Connections to a Service](https://community.exoscale.com/product/dbaas/service-specific/postgresql/how-to/restrict-connections/index.md)
and [Sync SKS IP Filters](https://community.exoscale.com/product/dbaas/how-to/sks-ip-filter/index.md).

> [!IMPORTANT]
> Do not rely on the IP filter to separate the Database Services of your organization from each
> other. Use separate credentials, and grant each application only the privileges it needs.

The IP filter adds a network layer to TLS and authentication. It does not replace them.

## The Admin User Is Not a Superuser

`avnadmin`, the user of the generated connection URI, is not a superuser:

```sql
SELECT rolname, rolsuper FROM pg_roles WHERE rolname = 'avnadmin';
```

returns `f`. The superuser role `postgres` is reserved to the platform. `avnadmin` cannot read the
password verifiers in `pg_authid`, cannot read server settings restricted to
`pg_read_all_settings`, and cannot grant `pg_read_all_data`. What it can do is listed in
[Manage Users and Databases](https://community.exoscale.com/product/dbaas/service-specific/postgresql/how-to/manage-users-and-databases/index.md#the-avnadmin-user).

For least privilege, create a user per application with `exo dbaas user create` and grant it a
group role, as described in
[Create Read-Only Users](https://community.exoscale.com/product/dbaas/service-specific/postgresql/how-to/create-read-only-users/index.md).

## Passwords Use scram-sha-256

On a new service:

```sql
SHOW password_encryption;
```

returns `scram-sha-256`, so new passwords, including generated ones, get SCRAM verifiers. Roles
whose password was set while the service used `md5` keep their `md5` verifier until their password
is set again. To find and rotate them, see
[Upgrade Password Encryption to scram-sha-256](https://community.exoscale.com/product/dbaas/service-specific/postgresql/how-to/upgrade-password-encryption/index.md).

The full output of `exo api get-dbaas-service-pg` contains the passwords of the users managed by
the platform, and the URI of a pool created with a `username` contains that user's password.
Restrict who can call the API with
[IAM](https://community.exoscale.com/product/security/iam/index.md), and treat that output as a secret.

## What Exoscale States About the Infrastructure

The following points come from the
[DBaaS overview](https://community.exoscale.com/product/dbaas/overview/index.md) and
[Manage Backups and Restores](https://community.exoscale.com/product/dbaas/how-to/backups-restore/index.md), and cannot be observed from
a client connection:

- Each service runs on dedicated virtual machines. No compute resources are shared across
  organizations.
- Traffic between the nodes of a service, and to the object storage that holds the backups, is
  encrypted.
- The data stays in the country of the zone you selected.
- Backups are automatic, encrypted, and stored in Object Storage.

Backups cannot be downloaded: they serve point-in-time recovery and forks. For a copy you
control, take a dump with `pg_dump`. See
[Backups and Point-In-Time Recovery](https://community.exoscale.com/product/dbaas/service-specific/postgresql/overview/backups-and-pitr/index.md).

There is no shell or SSH access to the service nodes.

## Termination Protection

`exo dbaas create` enables termination protection by default. While it is on,
`exo dbaas delete` fails with
`Forbidden: The service is protected against termination and shutdown. Remove termination protection first.`

Read the current state:

```bash
exo api get-dbaas-service-pg SERVICE_NAME -z ZONE -q '"termination-protection"'
```

Parameters:

- `SERVICE_NAME`: name of the Managed PostgreSQL service, for example `my-postgresql`.
- `ZONE`: zone the service runs in, for example `ch-gva-2`.

`exo dbaas show SERVICE_NAME -z ZONE` shows it in the `Termination Protected` row. To turn it back
on:

```bash
exo dbaas update SERVICE_NAME -z ZONE --termination-protection=true -f
```

Termination protection only prevents the deletion of the service. A `DROP TABLE` or a
`DELETE` goes through; recover from those with a point-in-time restore into a new service.

## Audit and Masking Inside the Database

Two extensions cover in-database security work. `pgaudit` writes audit records for the statement
classes you enable: see
[Collect pgaudit Logs](https://community.exoscale.com/product/dbaas/service-specific/postgresql/how-to/collect-pgaudit-logs/index.md).
PostgreSQL Anonymizer masks sensitive columns: see
[Use PostgreSQL Anonymizer](https://community.exoscale.com/product/dbaas/service-specific/postgresql/how-to/use-postgresql-anonymizer/index.md).

## Related Pages

- [Restrict Connections to a Service](https://community.exoscale.com/product/dbaas/service-specific/postgresql/how-to/restrict-connections/index.md)
- [Connect with psql](https://community.exoscale.com/product/dbaas/service-specific/postgresql/how-to/connect-with-psql/index.md)
- [Manage Users and Databases](https://community.exoscale.com/product/dbaas/service-specific/postgresql/how-to/manage-users-and-databases/index.md)
- [Upgrade Password Encryption to scram-sha-256](https://community.exoscale.com/product/dbaas/service-specific/postgresql/how-to/upgrade-password-encryption/index.md)
- [Backups and Point-In-Time Recovery](https://community.exoscale.com/product/dbaas/service-specific/postgresql/overview/backups-and-pitr/index.md)
- [DBaaS Overview](https://community.exoscale.com/product/dbaas/overview/index.md)

