大网数据广告活动
服务器运维问答

Use Letsencrypt certificates for Postgresql

· 52CE 我爱测

I have successfully configured Letsencrypt for my NGINX webserver on Debian 8 Jessie. Now I have installed Postgresql 9.4 and want to use the LE certificates (in /etc/letsencrypt/live/mydomain/com/... ) for its SSL connection. I'…

问题原文

原帖链接 · algielen · CC BY-SA 3.0

I have successfully configured Letsencrypt for my NGINX webserver on Debian 8 Jessie.

Now I have installed Postgresql 9.4 and want to use the LE certificates (in /etc/letsencrypt/live/mydomain/com/...) for its SSL connection. I've set the paths to the certificate and the key in the config file ( /etc/postgresql/9.4/main/postgresql.conf).

Predictably when I try to restart Postgres via pg_ctlcluster it fails because of Permission denied to the certificate. I understand that Postgresql is run with the user postgres and that this user does not have access to this directory.

How do I fix this in a clean way?

已采纳解答

原帖链接 · silviud · CC BY-SA 4.0

You can either add the postgres user to the wheel group or a different group that can have access to the directory /etc/letsencrypt/live/mydomain/ or make the postgres user owner of the certificate (if is used exclusively).

Example command to make the postgres owner to a hypothetical location

sudo mkdir /etc/postgres/
sudo mv /etc/letsencrypt/live/mydomain/com/pg.crt /etc/postgres/pg.crt
sudo mv /etc/letsencrypt/live/mydomain/com/pg.key /etc/postgres/pg.key
sudo chown -R postgres: /etc/postgres

Then you need to adjust the /etc/postgresql/9.4/main/postgresql.conf to point to the new path.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-10-04)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。