【问题标题】:Selinux - File Contexts Look Good, But Selinux Won't Allow WriteSelinux - 文件上下文看起来不错,但 Selinux 不允许写入
【发布时间】:2013-03-31 04:57:41
【问题描述】:

我正在努力学习 Selinux。使用沙箱并使用 VSFTPD 进行试验,我有一个在 Centos 中运行的 vsfptd 服务器。我有匿名用户将文件放在 /var/ftp/incoming 中。在远程机器上,我可以让用户成功登录,但无法将文件放在删除 vsftpd 服务器上:

$ftp mysql_server
Connected to mysql_server (192.168.1.31).
220 Welcome to blah FTP service.
Name (mysql_server:root): anonymous
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer ftp> put atd 
local: atd remote: atd
227 Entering Passive Mode (192,168,1,31,19,161).
553 Could not create file.
ftp> 

在VSFTPD服务器上,aureport -a 报告显示:

[root@mysql_server ftp]# aureport -a

AVC Report
========================================================
# date time comm subj syscall class permission obj event
========================================================
4. 04/08/2013 13:30:36 vsftpd unconfined_u:system_r:ftpd_t:s0-s0:c0.c1023 21 dir write system_u:object_r:public_content_t:s0 denied 28
5. 04/08/2013 13:34:57 vsftpd unconfined_u:system_r:ftpd_t:s0-s0:c0.c1023 2 dir write system_u:object_r:public_content_t:s0 denied 47

我检查了目录,文件上下文看起来不错,所以我不明白为什么 Selinux 不允许 vsftpd 写入传入目录:

[root@mysql_server ftp]# ls -Z
drwx-wx---. root ftp  system_u:object_r:public_content_t:s0 incoming
drwxr-xr-x. root root system_u:object_r:public_content_t:s0 pub
[root@mysql_server ftp]#

【问题讨论】:

    标签: centos rhel selinux security-context


    【解决方案1】:

    您的 SELinux 类型不正确。使用“public_content_rw_t”而不是“public_content_t”。阅读更多关于http://beginlinux.com/blog/2008/11/vsftpd-and-selinux-on-centos/

    【讨论】:

      【解决方案2】:

      您需要运行以下命令以允许在 SELinux 中上传和编辑文件:

      setsebool -P allow_ftpd_full_access on
      setsebool -P ftp_home_dir on
      

      【讨论】:

        猜你喜欢
        • 2021-03-21
        • 2018-08-30
        • 2015-03-23
        • 2017-10-07
        • 2016-04-30
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-12-07
        相关资源
        最近更新 更多