// postgresql · security & access

ssl

Accept TLS connections on the normal PostgreSQL port.

기본값
off
Range
on, off
Restart needed
아니요
Default checked on
PostgreSQL 18

기능

Needs a certificate (ssl_cert_file, default server.crt) and matching private key (ssl_key_file, default server.key), normally in the data directory. Turning ssl on does not force clients to use TLS; a hostssl line in pg_hba.conf does.

기본값

off. off (PostgreSQL 18). The official Docker image ships no certificates, so it stays off unless you mount them.

Check the current value

SHOW ssl;

SELECT setting, unit, boot_val, context, source, pending_restart
FROM pg_settings
WHERE name = 'ssl';

Change it

ALTER SYSTEM SET ssl = on;
SELECT pg_reload_conf();

No restart: reload with SELECT pg_reload_conf() or pg_ctl reload. It cannot be changed per session (context is sighup).

When to change it

On any server whose traffic crosses a network you do not control, together with hostssl rules in pg_hba.conf and password_encryption = scram-sha-256.

What can go wrong

A server.key that is not owned by the server's OS user, or readable by group or others, fails the start or the reload with a permission error, and a failed reload keeps the old settings running. With ssl on but no hostssl rules, clients that never ask for TLS keep connecting in the clear.

Questions about ssl

What is the default value of ssl in PostgreSQL?

off. off (PostgreSQL 18). The official Docker image ships no certificates, so it stays off unless you mount them.

Does changing ssl require a restart?

No. No restart: reload with SELECT pg_reload_conf() or pg_ctl reload. It cannot be changed per session (context is sighup).

When should I change ssl?

On any server whose traffic crosses a network you do not control, together with hostssl rules in pg_hba.conf and password_encryption = scram-sha-256.

Back to all PostgreSQL settings, or check the PostgreSQL manual for every option.

// one client for every engine

Check ssl on your own server

SQLly runs the query above against PostgreSQL and the other engines in this reference, from one desktop app on macOS, Windows and Linux.

이 페이지의 텍스트와 데이터: CC BY 4.0, 출처: SQLly (sqlly.app). 코드와 SQL 스니펫: MIT. 라이선스 세부 정보