1 saka1zd 310 天前 证书的权限设置了啥 |
![]() | 2 adoal 310 天前 ![]() 想多了,证书文件只是普通文件,对 Linux 内核来说跟其它文件没有什么不同。 不如先找一个能登录的其它用户,加入 ssl 组,看看能不能打开证书文件。 |
![]() | 3 dzdh 310 天前 acl |
![]() | 4 goodryb 310 天前 同一个用户组也要看你给文件的权限 600 同一个用户组也访问不了,起码 640 |
5 liaohongxing 310 天前 要用 chmod 给文件夹加组读权限, 也 644 ,ls 表现为: -rwr--r-- (644) 只有拥有者有读写权限;而属组用户和其他用户只有读权限。 |
6 liaohongxing 310 天前 或者楼上 640 |
![]() | 7 hguandl 310 天前 我感觉更常见的方案是用 nginx.conf 来设置用户。master process 启动时一般是 root 权限,读取配置后再 fork 出 worker process 并 setuid 。 |
![]() | 8 ysc3839 310 天前 via Android 我个人是让证书更新程序和 nginx 都使用 www 用户。隔离不需要太细,能起到隔离作用就行了。 @hguandl 这么干问题更多,master process 还是 root 身份运行,还是有安全风险。且更新证书后要 reload 的话,只能以 root 权限发信号。 |
![]() | 9 swLoXtOtd89pGg8t 309 天前 ![]() setfacl -Rm u:nginx-user:r /path/of/certs setfacl -Rm u:petter:rw /path/of/certs setfacl -dm u:nginx-user:r /path/of/certs setfacl -dm u:petter:rw /path/of/certs setfacl -Rm u:nginx-user:x /path setfacl -Rm u:petter:rx /path setfacl -Rm u:nginx-user:x /path/of setfacl -Rm u:petter:rx /path/of # 解释说明: 第一组的四条分别设置 nginx-user 允许读取权限,petter 允许 rw ,新的文件默认也遵循前两条;第二和第三组允许俩用户进入证书所在的父目录。 注意:nginx-user 只是一个名字,可以直接设置 nginx 运行的 uid ,权限也设置成相同 uid 就好,比如 setfacl -Rm u:81:r /path/of/certs |
![]() | 11 swLoXtOtd89pGg8t 308 天前 @raysonlu #10 acl 也是各发行版原生自带的(除非极致精简的系统),这东西就是设计被用来弥补 rwxrwxrwx 中 other 权限过于宽泛的。 |