20170317--权限控制,selinux

155921_V8kC_2918364.png

 

磁盘配额 quota:

155716_36F7_2918364.png

              quotaoff

 

155858_PUxs_2918364.png

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

 permissive ---警告模式

 enforcing    --允许

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

 

 

selinux 的安全上下文 一般常用

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

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

3.布尔值  --boolean

4.

161747_0llC_2918364.png

 

selinux 在appache中的策略

162239_LD4v_2918364.png

安全上下文的文件

162604_jx27_2918364.png

修改安全上下问的权限 chcon

162729_bzEO_2918364.png

重启系统里的所有安全上下文163104_iynz_2918364.png

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

163559_7sgN_2918364.png

 

 

164059_HSoc_2918364.png

用selinux监听端口

164616_aw2l_2918364.png

 

总结

165031_8Wsj_2918364.png

 

165300_poe9_2918364.png

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

165135_QHg0_2918364.png

在selinux中用boolean 值设置关掉cgi

方法一:

165643_EnER_2918364.png

方法二:

165825_b2JS_2918364.png

 

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

1.file context

2.port context

3.boolean

ls -Z
ps -efZ
id -Z

105946_GGcG_2918364.png

110004_o7Y1_2918364.png

110045_L3HM_2918364.png

110116_UiTS_2918364.png

 

4.setroubleshoot

105631_VMGW_2918364.png

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
                                                             

 

 

转载于:https://my.oschina.net/liubaizi/blog/863139

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值