文章目录
前言
nfs的mount没有设置白名单,增加白名单就可以了。
一、漏洞内容
二、配置现状
1. nfs-server节点/etc/exports文件的配置
[root@node56 yum.repos.d]# cat /etc/exports
/xxxx_hdd xxx.16.112.0/24(rw,sync,no_root_squash,insecure)
2. client节点执行showmount -e 测试
31节点是需要访问nfs的节点,可以查看到挂载信息
[root@node31 ~]# showmount -e xxx.16.112.56
Export list for xxx.16.112.56:
/xxxx_hdd xxx.16.112.0/24
27节点不是需要访问nfs的节点,但是也可以查看到挂载信息
[root@node27 ~]# showmount -e xxx.16.112.56
Export list for xxx.16.112.56:
/xxxx_hdd xxx.16.112.0/24
三、nfs-server节点增加访问控制的配置
1. /etc/hosts.allow
cat /etc/hosts.allow
# 增加如下配置
mountd: xxx.16.112.31, xxx.16.112.32, xxx.16.112.45, xxx.16.112.56
rpcbind: xxx.16.112.31, xxx.16.112.32, xxx.16.112.45, xxx.16.112.56
2. /etc/hosts.deny
cat /etc/hosts.deny
# 增加如下配置
mountd: all
rpcbind: all
四、确认修改的结果
1. showmount -e 测试
31节点是需要访问nfs的节点,可以查看到挂载信息
[root@node31 ~]# showmount -e xxx.16.112.56
Export list for xxx.16.112.56:
/xxxx_hdd xxx.16.112.0/24
27节点不是需要访问nfs的节点,现在无法查看到挂载信息了
[root@node27 ~]# showmount -e xxx.16.112.56
clnt_create: RPC: Port mapper failure - Authentication error
总结
通过hosts.allow和hosts.deny两个文件进行nfs的访问控制。