SELINUX 初识 未完待续

一. 3种模式:

enforcing 强制,发现越权既拦截

permissive 放行,发现服务越权警告,不拦截

disabled  对于越权行为不拦截不警告,相当与关闭selinux

修改位置 vi /etc/selinux/config

将 SELINUX=3种模式之一即可  

example, SELINUX=enforcing

二. 状态查询、生效、及临时更改

查询使用 getenforce

永久生效需要修改 1中的配置文件并reboot

临时修改 ,适用于配置文件为enforing,但是想测试用临时开关检验配置是否正确,

setenforce 0   #由enforcing 变为 permissive

setenforce 1   #由permissive 变为enforcing

 

三、安全上下文

查看安全上下文使用 ls 的-Z参数

       -Z, --context
              Display security context so it fits on most displays.  Displays only mode, user, group, security context and file name.
[root@bogon ~]# ls -Zd /home/wwwroot/
drwxr-xr-x. root root system_u:object_r:user_home_dir_t:s0 /home/wwwroot/
[root@bogon ~]# ls -Zd /var/www/html
drwxr-xr-x. root root system_u:object_r:httpd_sys_content_t:s0 /var/www/html
 

下面需要使用semanage命令---未完待续

 

semanage 用法: 

1. 添加http端口, 默认selinux不允许更改默认的http端口

查看selinux的端口

[root@moc1 ~]# semanage port -l | grep http   
http_cache_port_t              tcp      8080, 8118, 10001-10010  
http_cache_port_t              udp      3130  
http_port_t                    tcp      81, 80, 443, 488, 8008, 8009, 8443  
pegasus_http_port_t            tcp      5988  
pegasus_https_port_t           tcp      5989  
#添加端口

[root@moc1 ~]# semanage port -a -t http_port_t -p tcp 84


 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值