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

Allow rsync to write to httpd_user_content_t

· 52CE 我爱测

We have rsyncd running as a daemon on our frontend web servers. We push web app updates out via rsync. We're looking at cutting down the noise in auditd and fixing up some of the issues from SELinux (so one day we can turn it on …

问题原文

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

We have rsyncd running as a daemon on our frontend web servers. We push web app updates out via rsync.

We're looking at cutting down the noise in auditd and fixing up some of the issues from SELinux (so one day we can turn it on properly).

At the moment we get the following messages when running rsync:

type=AVC msg=audit(1580772908.749:172148): avc:  denied  { write } for  pid=33806 comm="rsync" path="/public_html/docs/cg/html/1/.file.html.o9GVX9" dev="sda3" ino=37341 scontext=system_u:system_r:rsync_t:s0-s0:c0.c1023 tcontext=system_u:object_r:httpd_user_content_t:s0 tclass=file permissive=1

How can I allow rsync to write to these files with SELinux?

已采纳解答

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

You have different choices; from easier (but more coarse) to harder (but more specific):

  • setsebool -P rsync_full_access 1: grant rsync full filesystem access;
  • change your httpd file context to public_content_rw_t;
  • write a specific selinux policy patch via cat audit.log | audit2allow.

Finally, you can also set rsyncd in permissive mode issuing semanage permissive -a rsync_t, but I strongly suggest avoiding that (not last because it does not get rid of selinux audit logs).

I would use the first solution, as changing a selinux boolean is the least invasive, but more obvious and immediate change.

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

资料来源与适用范围

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

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

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