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:
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, 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:
openssl s_client -starttls postgres -connect HOST:PORT -tls1_2 -brief -CAfile ca.pem </dev/nullParameters:
HOST,PORT: hostname and port of thepgorpgbouncercomponent of the service, fromexo api get-dbaas-service-pg SERVICE_NAME -z ZONE -q 'components'.ca.pem: the CA certificate fromexo 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 and Sync SKS IP Filters.
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:
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.
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.
Passwords Use scram-sha-256
On a new service:
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.
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, and treat that output as a secret.
What Exoscale States About the Infrastructure
The following points come from the DBaaS overview and Manage Backups and Restores, 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.
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:
exo api get-dbaas-service-pg SERVICE_NAME -z ZONE -q '"termination-protection"'Parameters:
SERVICE_NAME: name of the Managed PostgreSQL service, for examplemy-postgresql.ZONE: zone the service runs in, for examplech-gva-2.
exo dbaas show SERVICE_NAME -z ZONE shows it in the Termination Protected row. To turn it back
on:
exo dbaas update SERVICE_NAME -z ZONE --termination-protection=true -fTermination 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.
PostgreSQL Anonymizer masks sensitive columns: see
Use PostgreSQL Anonymizer.