侧边栏壁纸
博主头像
落叶人生博主等级

走进秋风,寻找秋天的落叶

  • 累计撰写 130562 篇文章
  • 累计创建 28 个标签
  • 累计收到 9 条评论
标签搜索

目 录CONTENT

文章目录

20170317--权限控制,selinux

2023-11-21 星期二 / 0 评论 / 0 点赞 / 70 阅读 / 5561 字

磁盘配额 quota: quotaoff selinux : /etc/selinux/config --增强系统安全的软件 permissive ---警告模式 enforcing --允许

 

磁盘配额 quota:

              quotaoff

 

selinux  :  /etc/selinux/config  --增强系统安全的软件

 permissive ---警告模式

 enforcing    --允许

 disable       ---禁止 //这种模式切换到其他模式后,必须重启系统才能生效

 

 

selinux 的安全上下文 一般常用

1.文件安全上下文--file context

2.端口安全上下文--port context

3.布尔值  --boolean

4.

 

selinux 在appache中的策略

安全上下文的文件

修改安全上下问的权限 chcon

重启系统里的所有安全上下文

让修改的安全上下文永久生效

 

 

用selinux监听端口

 

总结

 

在apache的配置文件中,将cgi禁止掉

在selinux中用boolean 值设置关掉cgi

方法一:

方法二:

 

selinux开启后,4种方法解决平时遇到的问题

1.file context

2.port context

3.boolean

ls -Zps -efZid -Z

 

4.setroubleshoot

selinux 的几种使用方法

man -k selinux | grep http  2 man -k selinux | grep ftp  3   4   5 [root@rh5 policy]# 1. chcon  6 [root@rh5 policy]#    restorecon  7 [root@rh5 policy]#    touch /.autorelabel  8 [root@rh5 policy]#      reboot  9 [root@rh5 policy]# 10 [root@rh5 policy]#    eg: 11 [root@rh5 policy]#    semanage fcontext -a -t httpd_sys_content_t "/www(/.*)    ?" 12 [root@rh5 policy]#    restorecon /www -R 13 [root@rh5 policy]# 14                     Port context: 15 [root@rh5 policy]#    semanage port -a -t http_port_t -p tcp 82 16  17 [root@rh5 policy]# 2. bool 18 [root@rh5 policy]#    getsebool -a | grep http | grep cgi 19 httpd_enable_cgi --> on 20 [root@rh5 policy]#    setsebool -P httpd_enable_cgi on 21 [root@rh5 policy]# 22 [root@rh5 policy]# 3. setroubleshoot-server[root@rh5 policy]# 3. setroubleshoot-server 23 [root@rh5 policy]#    yum install setroubleshoot{,-server,-plugins} -y 24 [root@rh5 policy]#    /etc/init.d/auditd restart 25 [root@rh5 policy]#    /etc/init.d/rsyslog restart 26 [root@rh5 policy]#    ... 27 [root@rh5 policy]#    vim /var/log/messages 28 [root@rh5 policy]#    grep AVC /var/log/audit/audit.log | sedispatch 29 [root@rh5 policy]#    vim /var/log/messages 30 [root@rh5 policy]# 31 [root@rh5 policy]#    sealert -l XXXXXX 32 [root@rh5 policy]#    sealert -f XXXXXX 33 [root@rh5 policy]# 34 [root@rh5 policy]# 4. audit2allow 35 [root@rh5 policy]# 36 [root@rh5 policy]#    yum install policycoreutils-python -y 37 [root@rh5 policy]#    audit2allow -a -l 38 [root@rh5 policy]#    cd /etc/selinux/targeted/policy/ 39 [root@rh5 policy]#    audit2allow -a -l -M <NAME> 40 [root@rh5 policy]#    semodule -i <NAME>.pp  # semanage fcontext -a -t public_content_rw_t /var/ftp/pub # restorecon -R -v /var/ftp/pub # setsebool -P allow_ftpd_anon_write 1                                                             

 

 

广告 广告

评论区