您的位置:首页 > 其它

机房线路故障,引发多家公司不能上网,和自己de经历有感

2008-04-09 11:15 357 查看
DAC 自主访问控制
MAC 靠SELinux 实现 subject -->domain->label
object-->type->label
SELinux 配置文件 ---> /etc/sysconfig/selinux
---> /etc/selinux/config 两个文件一样
1. 启用SELinux
# getenforce 检查SELinux 是否开启
--> permissive --> 0 警告模式
--> enforcing --> 1 严格模式
--> disabled --> 没有启用SELinux
# setenforce 1 临时有效(严格控制)
# vim /etc/selinux/config 永久有效
2. label
#chcon 专门用来修改标签
-t type
-R recurive 递归
# chcon --reference =a.txt b.txt 以a.txt的type为准,修改b.txt的type
# ls --scontext a.txt 只显示安全上下文
# ls --lcontext a.txt 显示ugo属性跟安全上下文
# restorecon a.txt 恢复成名人标签
# ps -auxz 查看进程的标签
/etc/selinux/targeted/contexts/ 下保存了SELinux的安全上下文

守护进程 ---->独立守护进程-->速度快但占用资源多
---->非独立守护进程-->由超级守护进程管理,xinetd
-->其配置文件在/etc/xinetd.conf 里定义
判断一个进程是否是非独立守护进程 查看/etc/xinetd.d/service 下的内容
一个非独立守护进程如果没有在/etc/xinetd.d/ 下没有明确定义,则使用/etc/xinetd.conf 的默认选项
1. enabled =yes | disable =no 表示服务开启
也可以用 chkconfig telnet on (这里用telnet 来代替)
2. instances =50 用户并发连接量
3. per_source =10 一个客户端最多连接10个
4. cps =50 10 如果最大并发连接达到50,则隐藏服务10s ,主要防范DDOS 攻击
5. banner = /some/file 欢迎提示信息
6. wait =yes 单线程 | wait = no 多线程
7. only_from = --->numeric address (192.168.1.0)
--->network name (from /etc/networks)
--->hostname or domain (domain.com)
--->IP address/netmask range(192.168.0.0/24)
8. no_access = ---->The same to only_from
9. access_time = 12:00-18:00 定义在哪个时间段可以访问

service xinetd restart 启用服务
ldd `which xinetd` 查看xinetd 所依赖的库文件,如果出现libwrap.so.0 则表示支持tcp_wrapper 这个协议-->一种安全访问机制
以telnet 这个非独立守护进程为例:
首先检查本机是否安装 telnet-server工具
# yum install telnet-server
# vim /etc/xinetd.d/telnet
disable =no or enable =yes
#service xinetd restart
这时就可远程登录,登录时,一般不要用root用户登录-->telnet 在网络上是明文。
为了用上tcp_wrapper 这个安全协议,无奈还可以让我们的telnet 安全点
# vim /etc/hosts.allow
in.telnet : The same to only_from (:spawn echo XXX > /var/log/telnet ) 括号里的主要是记录telnet 的登入出日志的。
# vim /etc/hosts.deny
in.telnet ALL
注意:/etc/hosts.deny 一定要写些内容、、

本文出自 “赢在坚持” 博客,转载请与作者联系!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: