以下是搜索内容: 关闭

  • 首页
  • 日志
  • 友情链接
  • 关于我

KoiNL.

愿世间美好 温柔以待

“锦鲤握运,未离我韵”

“愿好运常在”

18 分类
0 标签
16 归档
  • 小站首页
  • 个人日志
  • 友情链接
  • 关于自己
  • 我的工具
站点信息

文章数目: 84 篇

最近动态: 2天前

上线时间: 531天

当前版本: v3.0.0

安全管理

分类: Linux
标签:

创建日期:2022-06-09 10:50:03

SELinux 模式共分为 3 种:
强制模式:Enforcing:0
许可模式:Permissive:1
禁用模式:Disabled:2

可以使用 getenforce 来显示安全增强型Linux系统的模式。
可以在其后追加 0、1、2 来修改其模式,不过由于其未对配置文件修改的方式,重启后会失效
而在配置文件 vi /etc/sysconfig/selinux 中修改后,重启依然有效

当然也可以只显示某一端口的模式,这里以 http 服务端口为例:semanage port -l | grep http ,格式为:semanage port -a -t 端口名 -p 端口类型 所添加端口号,例 semanage port -a -t http_cache_port_t -p udp 8888。

点击显/隐
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
[root@localhost ~]# getenforce    # 显示 SELinux 模式
Enforcing
[root@localhost ~]# setenforce 0 # 修改 SELinux 模式,未对配置文件使用
[root@localhost ~]# getenforce
Permissive
[root@localhost ~]# reboot # 重启,
[root@localhost koinl]# getenforce # 失效
Enforcing
[root@localhost koinl]# vi /etc/sysconfig/selinux # 修改 SELinux 配置文件
[root@localhost koinl]# getenforce # 重启生效
Enforcing
[root@localhost koinl]# reboot
[root@localhost koinl]# getenforce
Permissive
[root@localhost koinl]# semanage port -l | grep http # 显示 SELinux 的 http 服务端口
http_cache_port_t tcp 8080, 8118, 8123, 10001-10010
http_cache_port_t udp 3130
http_port_t tcp 80, 81, 443, 488, 8008, 8009, 8443, 9000
pegasus_http_port_t tcp 5988
pegasus_https_port_t tcp 5989
[root@localhost koinl]# semanage port -a -t http_cache_port_t -p udp 8888 # 修改第二个端口:增加一个 8888 的端口号
[root@localhost koinl]# semanage port -l | grep http | head -2
http_cache_port_t tcp 8080, 8118, 8123, 10001-10010
http_cache_port_t udp 8888, 3130
[root@localhost koinl]# semanage port -d -t http_cache_port_t -p udp 8888 # 修改第二个端口:删除一个 8888 的端口号
[root@localhost koinl]# semanage port -l | grep http | head -2
http_cache_port_t tcp 8080, 8118, 8123, 10001-10010
http_cache_port_t udp 3130
浏览量

评论区

欢迎你留下宝贵的意见,昵称输入QQ号会显示QQ头像哦~

目录

上一篇: 第二章 进程管理

下一篇 第六章 网络基础

公告栏

《 

 》

Hello~近期剽窃本站内容频发,本站唯一指定网站:https://koinl.github.io。请认准。点击点击此处选择进入。
回到顶部
查看评论

Power By Hexo.

Theme:koinl.

信息来源于锦鲤未离