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.
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. Подробнее о лицензии