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

Does nginx really need dac_override in its AppArmor policy?

· 52CE 我爱测

I am building an AppArmor policy for nginx in Ubuntu 14.04 and I cannot make it work without enabling the dac_override capability. Does nginx really need this enabled or is there some way to work around it? Overriding all discret…

问题原文

原帖链接 · Federico B. · CC BY-SA 3.0

I am building an AppArmor policy for nginx in Ubuntu 14.04 and I cannot make it work without enabling the dac_override capability.

Does nginx really need this enabled or is there some way to work around it? Overriding all discretionary access control looks risky, but perhaps it's common within the AppArmor constraints.

nginx runs fine unconfined, so I don't think there is a permission issue, but I'm new to AppArmor so I may be wrong.

已采纳解答

原帖链接 · Federico B. · CC BY-SA 3.0

The default file permissions for nginx logs in Ubuntu are rw-r-----. These files are owned by www-admin:adm.

nginx starts under user root, which has CAP_DAC_OVERRIDE capability by default (remember that root can read and write to any file in the system) but once AppArmor confinement kicks in, the process loses that capability even though it runs as root, so the master nginx process cannot open the log files.

The solution is either changing the permissions so that root can also write to these files, or adding the dac_override capability to the AppArmor nginx profile.

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

资料来源与适用范围

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

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

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