买了本本身一直指望的书《Linux系统架构与目录解析》,其实想要这样一本书好久了。虽然不是一个sa,可是也想对linux作到应用方面的熟练,而对linux总体把握,甚至细到有哪些目录,哪些文件,这些文件是作什么用的,我想作到这些应该能水平提高很多。html
初步浏览了这本书,正如做者所说这本书书更像是工具书,适合查阅,而不是通篇读。又正若有人评论这本书,感受正入境了,做者却中止了他的思绪---讲得比较浅。而我要这本书仅仅是做为一个大纲。而后本身慢慢去网上找相关更详细的资料去研究。好了,废话很少说。linux
今天主要谈的三个文件安全
/etc/host.conf #1服务器
/etc/hosts #2网络
/etc/resolv.conf #3架构
第一个/etc/host.conf,linux中经过解析库将host name解析成ip地址,而host.conf则告诉linux用什么方式去解析。经过编辑/etc/host.conf来添加相关条目,举例子dom
# Lookup names via DNS first then fall back to /etc/hosts.
order bind,hosts
# We have machines with multiple IP addresses.
multi on
# Check for IP address spoofing.
nospoof on工具
经常使用的就是oder,multi,nospoof这三项。oop
order:经过什么顺序来解析host name,这里表示先经过name server解析host name,而后经过查找/etc/hosts文件。 bind(Berkeley Internet Name Domain),一种开源DNS协议实现。spa
multi on:若是你的机器有多网卡,那么这个就设置为on
nospoof on:这个主要是从安全考虑,防止黑客攻击,原理我也不大清楚,默认就是on的
第二个/etc/hosts,在上面提到了当设置了order里面包含hosts,那么表示要查找这个/etc/hosts文件(前提固然是在name server里面没找到,或是hosts的顺序在bind以前),能够编辑/etc/hosts
格式为:
ip地址 域名 别名, 好比 192.169.131.2 www.example.com example.com
第三个为/etc/resolv.conf(不是resolve.conf) ,这个是记录的域名服务器,name server
常见的有下面几种类型
domain your_domain
nameserver ip_address
上面主要是网络中的域名解析成IP地址相关的文件,原理就很少说了。另外还有两个文件/etc/hosts.allow,/etc /hosts.deny 这两个就相似于白名单、黑名单,若是配置了,先查找hosts.allow,若是须要再查找hosts.deny可是通常状况下应该不怎么用到。
参考文章:
1. http://www.faqs.org/docs/securing/chap5sec39.html /etc/host.conf
2. http://linux.die.net/man/5/hosts /etc/hosts
3. http://linux.die.net/man/5/resolv.conf /etc/resolv.conf